Skip to content

Commit

Permalink
rename (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroxsatoshi authored Mar 10, 2024
1 parent bbb5632 commit 1d09ec4
Show file tree
Hide file tree
Showing 30 changed files with 70 additions and 70 deletions.
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

0 comments on commit 1d09ec4

Please sign in to comment.