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

rename #5

Merged
merged 1 commit into from
Mar 10, 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
.idea/
.vscode/

zerog-storage-client
0g-storage-client
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,33 @@ Run `go build` under the root folder to compile the executable binary.
```
--gas-limit uint Custom gas limit to send transaction
--gas-price uint Custom gas price to send transaction
-h, --help help for zerog-storage-client
-h, --help help for 0g-storage-client
--log-force-color Force to output colorful logs
--log-level string Log level (default "info")
```

**Deploy contract**

```
./zerog-storage-client deploy --url <blockchain_rpc_endpoint> --key <private_key> --bytecode <bytecode_hex_or_json_file>
./0g-storage-client deploy --url <blockchain_rpc_endpoint> --key <private_key> --bytecode <bytecode_hex_or_json_file>
```

**Generate test file**

To generate a file for test purpose, especially with a fixed file size or random file size (without `--size` option):

```
./zerog-storage-client gen --size <file_size_in_bytes>
./0g-storage-client gen --size <file_size_in_bytes>
```

**Upload file**
```
./zerog-storage-client upload --url <blockchain_rpc_endpoint> --contract <zerog-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> --node <storage_node_rpc_endpoint> --file <file_path>
```

**Download file**
```
./zerog-storage-client download --node <storage_node_rpc_endpoint> --root <file_root_hash> --file <output_file_path>
./0g-storage-client download --node <storage_node_rpc_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`.
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cmd

import (
"github.com/0glabs/0g-storage-client/common/blockchain"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/zero-gravity-labs/zerog-storage-client/common/blockchain"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/download.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package cmd

import (
"github.com/0glabs/0g-storage-client/node"
"github.com/0glabs/0g-storage-client/transfer"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/zero-gravity-labs/zerog-storage-client/node"
"github.com/zero-gravity-labs/zerog-storage-client/transfer"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/gateway.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cmd

import (
"github.com/0glabs/0g-storage-client/gateway"
"github.com/0glabs/0g-storage-client/node"
"github.com/spf13/cobra"
"github.com/zero-gravity-labs/zerog-storage-client/gateway"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/generate_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"time"

"github.com/0glabs/0g-storage-client/core"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/zero-gravity-labs/zerog-storage-client/core"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import (
"fmt"
"os"

"github.com/0glabs/0g-storage-client/common/blockchain"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/zero-gravity-labs/zerog-storage-client/common/blockchain"
)

var (
logLevel string
logColorForced bool

rootCmd = &cobra.Command{
Use: "zerog-storage-client",
Use: "0g-storage-client",
Short: "ZeroGStorage client to interact with ZeroGStorage network",
PersistentPreRun: func(*cobra.Command, []string) {
initLog()
Expand Down
10 changes: 5 additions & 5 deletions cmd/upload.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package cmd

import (
"github.com/0glabs/0g-storage-client/common/blockchain"
"github.com/0glabs/0g-storage-client/contract"
"github.com/0glabs/0g-storage-client/core"
"github.com/0glabs/0g-storage-client/node"
"github.com/0glabs/0g-storage-client/transfer"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/zero-gravity-labs/zerog-storage-client/common/blockchain"
"github.com/zero-gravity-labs/zerog-storage-client/contract"
"github.com/zero-gravity-labs/zerog-storage-client/core"
"github.com/zero-gravity-labs/zerog-storage-client/node"
"github.com/zero-gravity-labs/zerog-storage-client/transfer"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package contract
import (
"fmt"

"github.com/0glabs/0g-storage-client/common/blockchain"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/openweb3/web3go"
"github.com/zero-gravity-labs/zerog-storage-client/common/blockchain"
)

type FlowContract struct {
Expand Down
4 changes: 2 additions & 2 deletions core/dataflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"runtime"
"time"

"github.com/0glabs/0g-storage-client/common/parallel"
"github.com/0glabs/0g-storage-client/core/merkle"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/sirupsen/logrus"
"github.com/zero-gravity-labs/zerog-storage-client/common/parallel"
"github.com/zero-gravity-labs/zerog-storage-client/core/merkle"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion core/dataflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestFileAndInMemoryData(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, n, len(data))

tmpFile, err := os.CreateTemp("", "zerog-storage-client-*")
tmpFile, err := os.CreateTemp("", "0g-storage-client-*")
assert.NoError(t, err)
defer os.Remove(tmpFile.Name())

Expand Down
6 changes: 3 additions & 3 deletions core/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"runtime"
"time"

"github.com/0glabs/0g-storage-client/common/parallel"
"github.com/0glabs/0g-storage-client/contract"
"github.com/0glabs/0g-storage-client/core/merkle"
"github.com/sirupsen/logrus"
"github.com/zero-gravity-labs/zerog-storage-client/common/parallel"
"github.com/zero-gravity-labs/zerog-storage-client/contract"
"github.com/zero-gravity-labs/zerog-storage-client/core/merkle"
)

type Flow struct {
Expand Down
2 changes: 1 addition & 1 deletion core/merkle/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (

// Proof represents a merkle tree proof of target content, e.g. chunk or segment of file.
type Proof struct {
// Lemma is made up of 3 parts to keep consistent with zerog-storage-rust:
// Lemma is made up of 3 parts to keep consistent with 0g-storage-rust:
// 1. Target content hash (leaf node).
// 2. Hashes from bottom to top of sibing nodes.
// 3. Root hash.
Expand Down
4 changes: 2 additions & 2 deletions core/tree_builder_initializer.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package core

import (
"github.com/0glabs/0g-storage-client/common/parallel"
"github.com/0glabs/0g-storage-client/core/merkle"
"github.com/ethereum/go-ethereum/common"
"github.com/zero-gravity-labs/zerog-storage-client/common/parallel"
"github.com/zero-gravity-labs/zerog-storage-client/core/merkle"
)

type TreeBuilderInitializer struct {
Expand Down
4 changes: 2 additions & 2 deletions example/kv_iterator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"fmt"

"github.com/0glabs/0g-storage-client/kv"
"github.com/0glabs/0g-storage-client/node"
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/zero-gravity-labs/zerog-storage-client/kv"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

const KvClientAddr = "http://127.0.0.1:6789"
Expand Down
8 changes: 4 additions & 4 deletions example/kv_put/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"fmt"

"github.com/0glabs/0g-storage-client/common/blockchain"
"github.com/0glabs/0g-storage-client/contract"
"github.com/0glabs/0g-storage-client/kv"
"github.com/0glabs/0g-storage-client/node"
"github.com/ethereum/go-ethereum/common"
"github.com/zero-gravity-labs/zerog-storage-client/common/blockchain"
"github.com/zero-gravity-labs/zerog-storage-client/contract"
"github.com/zero-gravity-labs/zerog-storage-client/kv"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

const ZgsClientAddr = "http://127.0.0.1:5678"
Expand Down
4 changes: 2 additions & 2 deletions example/kv_query/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"fmt"

"github.com/0glabs/0g-storage-client/kv"
"github.com/0glabs/0g-storage-client/node"
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/zero-gravity-labs/zerog-storage-client/kv"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

const KvClientAddr = "http://127.0.0.1:6789"
Expand Down
6 changes: 3 additions & 3 deletions gateway/local_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package gateway
import (
"path/filepath"

"github.com/0glabs/0g-storage-client/core"
"github.com/0glabs/0g-storage-client/node"
"github.com/0glabs/0g-storage-client/transfer"
"github.com/ethereum/go-ethereum/common"
"github.com/gin-gonic/gin"
"github.com/zero-gravity-labs/zerog-storage-client/core"
"github.com/zero-gravity-labs/zerog-storage-client/node"
"github.com/zero-gravity-labs/zerog-storage-client/transfer"
)

var LocalFileRepo string = "."
Expand Down
2 changes: 1 addition & 1 deletion gateway/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package gateway
import (
"net/http"

"github.com/0glabs/0g-storage-client/node"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/sirupsen/logrus"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

const httpStatusInternalError = 600
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/zero-gravity-labs/zerog-storage-client
module github.com/0glabs/0g-storage-client

go 1.21

Expand Down
2 changes: 1 addition & 1 deletion kv/Iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package kv
import (
"errors"

"github.com/0glabs/0g-storage-client/node"
"github.com/ethereum/go-ethereum/common"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

var errIteratorInvalid = errors.New("iterator is invalid")
Expand Down
8 changes: 4 additions & 4 deletions kv/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package kv
import (
"math"

"github.com/0glabs/0g-storage-client/contract"
"github.com/0glabs/0g-storage-client/core"
"github.com/0glabs/0g-storage-client/node"
"github.com/0glabs/0g-storage-client/transfer"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/zero-gravity-labs/zerog-storage-client/contract"
"github.com/zero-gravity-labs/zerog-storage-client/core"
"github.com/zero-gravity-labs/zerog-storage-client/node"
"github.com/zero-gravity-labs/zerog-storage-client/transfer"
)

// Client is used for users to communicate with server for kv operations.
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import "github.com/zero-gravity-labs/zerog-storage-client/cmd"
import "github.com/0glabs/0g-storage-client/cmd"

func main() {
cmd.Execute()
Expand Down
2 changes: 1 addition & 1 deletion node/types.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package node

import (
"github.com/0glabs/0g-storage-client/core/merkle"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/zero-gravity-labs/zerog-storage-client/core/merkle"
)

type Status struct {
Expand Down
2 changes: 1 addition & 1 deletion transfer/download/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestMetadataSerde(t *testing.T) {

func TestMetadata(t *testing.T) {
// create tmp file to test
tmpFile, err := os.CreateTemp(os.TempDir(), "zerog-storage-client-test-*")
tmpFile, err := os.CreateTemp(os.TempDir(), "0g-storage-client-test-*")
assert.NoError(t, err)
tmpFilename := tmpFile.Name()

Expand Down
8 changes: 4 additions & 4 deletions transfer/download_parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package transfer
import (
"fmt"

"github.com/0glabs/0g-storage-client/common/parallel"
"github.com/0glabs/0g-storage-client/core"
"github.com/0glabs/0g-storage-client/node"
"github.com/0glabs/0g-storage-client/transfer/download"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/zero-gravity-labs/zerog-storage-client/common/parallel"
"github.com/zero-gravity-labs/zerog-storage-client/core"
"github.com/zero-gravity-labs/zerog-storage-client/node"
"github.com/zero-gravity-labs/zerog-storage-client/transfer/download"
)

const minBufSize = 8
Expand Down
6 changes: 3 additions & 3 deletions transfer/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"os"

"github.com/0glabs/0g-storage-client/core"
"github.com/0glabs/0g-storage-client/node"
"github.com/0glabs/0g-storage-client/transfer/download"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/zero-gravity-labs/zerog-storage-client/core"
"github.com/zero-gravity-labs/zerog-storage-client/node"
"github.com/zero-gravity-labs/zerog-storage-client/transfer/download"
)

type Downloader struct {
Expand Down
10 changes: 5 additions & 5 deletions transfer/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"runtime"
"time"

"github.com/0glabs/0g-storage-client/common/parallel"
"github.com/0glabs/0g-storage-client/contract"
"github.com/0glabs/0g-storage-client/core"
"github.com/0glabs/0g-storage-client/core/merkle"
"github.com/0glabs/0g-storage-client/node"
"github.com/ethereum/go-ethereum/common"
"github.com/openweb3/web3go/types"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/zero-gravity-labs/zerog-storage-client/common/parallel"
"github.com/zero-gravity-labs/zerog-storage-client/contract"
"github.com/zero-gravity-labs/zerog-storage-client/core"
"github.com/zero-gravity-labs/zerog-storage-client/core/merkle"
"github.com/zero-gravity-labs/zerog-storage-client/node"
)

// smallFileSizeThreshold is the maximum file size to upload without log entry available on storage node.
Expand Down
Loading
Loading