mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-11-30 04:37:27 +00:00
add logs
This commit is contained in:
parent
1bbe6127db
commit
3ceda31452
@ -87,4 +87,7 @@ pub trait Rpc {
|
||||
|
||||
#[method(name = "getFlowContext")]
|
||||
async fn get_flow_context(&self) -> RpcResult<(H256, u64)>;
|
||||
|
||||
#[method(name = "getChunkByIndex")]
|
||||
async fn get_chunk_by_index(&self, chunk_index: u64) -> RpcResult<Option<Vec<u8>>>;
|
||||
}
|
||||
|
||||
@ -238,6 +238,25 @@ impl RpcServer for RpcServerImpl {
|
||||
async fn get_flow_context(&self) -> RpcResult<(H256, u64)> {
|
||||
Ok(self.ctx.log_store.get_context().await?)
|
||||
}
|
||||
|
||||
async fn get_chunk_by_index(&self, chunk_index: u64) -> RpcResult<Option<Vec<u8>>> {
|
||||
debug!(%chunk_index, "zgs_getChunkByIndex");
|
||||
match self
|
||||
.ctx
|
||||
.log_store
|
||||
.get_chunk_by_flow_index(chunk_index, 1)
|
||||
.await?
|
||||
{
|
||||
Some(chunk_array) => {
|
||||
if chunk_array.data.len() > 0 {
|
||||
Ok(Some(chunk_array.data))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RpcServerImpl {
|
||||
|
||||
@ -236,7 +236,7 @@ impl FlowWrite for FlowStore {
|
||||
|
||||
debug!(
|
||||
"Entry batch data at 12288 before insert: {:?}",
|
||||
batch_data_12288.as_ssz_bytes()
|
||||
batch_data_12288
|
||||
);
|
||||
|
||||
let mut batch_list = Vec::new();
|
||||
@ -293,7 +293,7 @@ impl FlowWrite for FlowStore {
|
||||
|
||||
debug!(
|
||||
"Entry batch data at 12288 after insert: {:?}",
|
||||
batch_data_12288.as_ssz_bytes()
|
||||
batch_data_12288
|
||||
);
|
||||
|
||||
res
|
||||
|
||||
@ -1125,6 +1125,7 @@ impl LogManager {
|
||||
let chunk_roots = self.flow_store.append_entries(flow_entry_array)?;
|
||||
debug!("fill leaf for pora_chunks_merkle");
|
||||
for (chunk_index, chunk_root) in chunk_roots {
|
||||
debug!("fill leaf: chunk_index={}, chunk_root={:?}", chunk_index, chunk_root);
|
||||
if chunk_index < merkle.pora_chunks_merkle.leaves() as u64 {
|
||||
merkle
|
||||
.pora_chunks_merkle
|
||||
|
||||
Loading…
Reference in New Issue
Block a user