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

Storage V2 #646

Merged
merged 17 commits into from
Oct 30, 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
12 changes: 6 additions & 6 deletions .github/workflows/build-zbox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev containerd docker.io

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup gopath and gocache
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
make install

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-linux
path: zbox
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
go env -w "CC=/mingw64/bin/clang.exe"

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install
run: make install
Expand All @@ -93,7 +93,7 @@ jobs:
zip zbox-windows.zip zbox.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-windows.zip
path: zbox-windows.zip
Expand All @@ -115,13 +115,13 @@ jobs:
go-version: '1.21'

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install
run: make install

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-macos
path: zbox
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/distribute-zboxcli-apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}

Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
DEB_DIR: ${{ github.workspace }}/deb-files
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}

Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-zboxcli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install deps
run: |
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
tag_schema: semantic

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-linux
path: zbox
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
go env -w "CC=/mingw64/bin/clang.exe"

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install
run: make install
Expand All @@ -140,7 +140,7 @@ jobs:
zip zbox-windows.zip zbox.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-windows.zip
path: zbox-windows.zip
Expand All @@ -162,7 +162,7 @@ jobs:
go-version: '1.20' # The Go version to download (if necessary) and use.

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install
run: make install
Expand All @@ -171,7 +171,7 @@ jobs:
run: tar -czvf zbox-macos.tar.gz ./zbox

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-macos
path: zbox
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
OUTPUT_DIR: ${{ github.workspace }}/output
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}

Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
OUTPUT_DIR: ${{ github.workspace }}/output
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}

Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
OUTPUT_DIR: ${{ github.workspace }}\output
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: '1.21'

- name: Clone Zbox
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Packages
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
go-version: '1.21'

- name: Clone 0Box
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: check software
run: |
Expand All @@ -52,7 +52,7 @@ jobs:
run: make install

- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: zbox-linux
path: zbox
Expand Down
11 changes: 11 additions & 0 deletions cmd/newallocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ var newallocationCmd = &cobra.Command{
fileOptionParams.ForbidRename.Value = forbidRename
}

var storageVersion int64
if flags.Changed("storage_version") {
storageVersion, err = flags.GetInt64("storage_version")
if err != nil {
log.Fatal("invalid forbid_upload: ", err)
}
}

var allocationID string
if len(owner) == 0 {
options := sdk.CreateAllocationOptions{
Expand All @@ -258,6 +266,7 @@ var newallocationCmd = &cobra.Command{
ThirdPartyExtendable: thirdPartyExtendable,
Force: force,
IsEnterprise: isEnterprise,
StorageVersion: int(storageVersion),
}
allocationID, _, _, err = sdk.CreateAllocationWith(options)
if err != nil {
Expand Down Expand Up @@ -355,6 +364,8 @@ func init() {
newallocationCmd.Flags().Bool("forbid_move", false, "(default false) specify if the users cannot move objects from this allocation")
newallocationCmd.Flags().Bool("forbid_copy", false, "(default false) specify if the users cannot copy object from this allocation")
newallocationCmd.Flags().Bool("forbid_rename", false, "(default false) specify if the users cannot rename objects in this allocation")

newallocationCmd.Flags().Int64("storage_version", 0, "storaage version of allocation")
}

func storeAllocation(allocationID string) {
Expand Down
29 changes: 28 additions & 1 deletion cmd/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ var blobberUpdateCmd = &cobra.Command{
updateBlobber.Capacity = &changedCapacity
}

var delegateWallet string
if flags.Changed("delegate_wallet") {
if delegateWallet, err = flags.GetString("delegate_wallet"); err != nil {
log.Fatal(err)
}
updateBlobber.DelegateWallet = &delegateWallet
}

var storageVersion int
if flags.Changed("storage_version") {
if storageVersion, err = flags.GetInt("storage_version"); err != nil {
log.Fatal(err)
}
updateBlobber.StorageVersion = &storageVersion
}

terms := &sdk.UpdateTerms{}
var termsChanged bool
if flags.Changed("read_price") {
Expand Down Expand Up @@ -235,6 +251,15 @@ var blobberUpdateCmd = &cobra.Command{
stakePoolSettingChanged = true
}

if flags.Changed("delegate_Wallet") {
var dw string
if dw, err = flags.GetString("delegate_wallet"); err != nil {
log.Fatal(err)
}
stakePoolSettings.DelegateWallet = &dw
stakePoolSettingChanged = true
}

if flags.Changed("service_charge") {
var sc float64
if sc, err = flags.GetFloat64("service_charge"); err != nil {
Expand Down Expand Up @@ -379,7 +404,9 @@ func init() {

buf := blobberUpdateCmd.Flags()
buf.String("blobber_id", "", "blobber ID, required")
buf.Int64("capacity", 0, " update blobber capacity bid, optional")
buf.String("delegate_wallet", "", "delegate wallet, optional")
buf.Int64("storage_version", 0, "update storage version, optional")
buf.Int64("capacity", 0, "update blobber capacity bid, optional")
buf.Float64("read_price", 0.0, "update read_price, optional")
buf.Float64("write_price", 0.0, "update write_price, optional")
buf.Duration("max_offer_duration", 0*time.Second, "update max_offer_duration, optional")
Expand Down
Loading