Storage Node API
Table of Contents
Methods
Method Name | Request Type | Response Type | Description |
---|---|---|---|
uploadSegment | SegmentWithProof | - | This uploads segment to storage node |
uploadSegments | [SegmentWithProof] | - | This uploads multiple segments at the same time to the storage node |
downloadSegment | DataRoot, usize, usize | Segment | This download the segment by locating the data with the merkle root, start&end index |
downloadSegmentWithProof | DataRoot, usize | SegmentWithProof | This downoads segment with the merkle proof |
getFileInfo | DataRoot | FileInfo | This gets the file information given the data merkle root |
getFileInfoByTxSeq | u64 | FileInfo | This gets the file information by querying the correponsing sequence index |
Data Structure
SegmentWithProof
Field | Type | Description |
---|---|---|
root | DataRoot | File merkle root |
data | [u8] | file data |
index | usize | segment index |
proof | FileProof | Merkle proof whose leaf node is the segment root |
file_size | usize | file size |
DataRoot
DataRoot = H256
Segment
Segment = [u8]
FileInfo
Field | Type | Description |
---|---|---|
tx | Transaction | file transaction |
finalized | bool | whether the file is finalized |
is_cached | bool | whether the file is cached |
uploaded_seg_num | usize | number of the segments |
Transaction
Field | Type | Description |
---|---|---|
stream_ids | [u256] | file transaction |
data | [u8] | transaction data |
data_merkle_root | DataRoot | merkle root of the data |
merkle_nodes | [(usize, DataRoot)] | [(subtree_depth, subtree_root)] |
start_entry_index | u64 | index of the start entry |
size | u64 | data size |
seq | u64 | sequence number |
Last updated