Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update comments #37

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,24 @@ To generate a file for test purpose, especially with a fixed file size or random

**Upload file**

Use storage nodes urls directly:

```
./0g-storage-client upload --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --node <storage_node_rpc_endpoint> --file <file_path>
./0g-storage-client upload --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --indexer <storage_indexer_endpoint> --file <file_path>
```

The `--node` accept comma separated URLs, the client will submit the data segments to all these nodes according to their shard configurations.

Use indexer url to fetch storage nodes:
```
./0g-storage-client upload --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --indexer <indexer_rpc_endpoint> --file <file_path>
```
The client will submit the data segments to the storage nodes which is determined by the indexer according to their shard configurations.

**Download file**
```
./0g-storage-client download --node <storage_node_rpc_endpoint> --root <file_root_hash> --file <output_file_path>
./0g-storage-client download --indexer <storage_indexer_endpoint> --root <file_root_hash> --file <output_file_path>
```

To download file from multiple storage nodes **in parallel**, `--node` option supports to specify multiple comma separated URLs, e.g. `url1,url2,url3`.

If you want to verify the **merkle proof** of downloaded segment, please specify `--proof` option.

**Write to KV**

By storage node urls:

```
./0g-storage-client kv-write --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --node <storage_node_rpc_endpoint> --stream-id <stream_id> --stream-keys <stream_keys> --stream-values <stream_values>
```

By indexer:
```
./0g-storage-client kv-write --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --indexer <indexer_rpc_endpoint> --stream-id <stream_id> --stream-keys <stream_keys> --stream-values <stream_values>
./0g-storage-client kv-write --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --indexer <storage_indexer_endpoint> --stream-id <stream_id> --stream-keys <stream_keys> --stream-values <stream_values>
```

`--stream-keys` and `--stream-values` are comma separated string list and their length must be equal.
Expand All @@ -75,4 +60,4 @@ By indexer:
./0g-storage-client kv-read --node <kv_node_rpc_endpoint> --stream-id <stream_id> --stream-keys <stream_keys>
```

Please pay attention here `--node` is the url of a KV node, different from the command above.
Please pay attention here `--node` is the url of a KV node.
2 changes: 1 addition & 1 deletion node/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Transaction struct {
Seq uint64 `json:"seq"` // sequence id in on-chain flow contract
}

// FileInfo information about a file responsed from 0g storage node
// FileInfo information about a file responded from 0g storage node
type FileInfo struct {
Tx Transaction `json:"tx"` // on-chain transaction
Finalized bool `json:"finalized"` // whether the file has been finalized in the storage node
Expand Down
Loading