Skip to content

Commit

Permalink
Set check status (#158)
Browse files Browse the repository at this point in the history
* set check status

* set page limit to 1000

* update gosdk

* add check for v2 alloc
  • Loading branch information
Hitenjain14 authored Nov 13, 2024
1 parent f0dca56 commit 4021fe2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/gateway/zcn/dStorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
var tempdir string

const (
pageLimit = 100
pageLimit = 1000
numBlocks = 100
dirType = "d"
fileType = "f"
Expand Down
8 changes: 8 additions & 0 deletions cmd/gateway/zcn/gateway-zcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,18 @@ func (z *ZCN) NewGatewayLayer(creds madmin.Credentials) (minio.ObjectLayer, erro
if err != nil {
return nil, err
}
status, _, _ := allocation.CheckAllocStatus()
if status == sdk.Broken {
return nil, errors.New("allocation_broken")
}
if allocation.StorageVersion == sdk.StorageV2 && status == sdk.Broken {
return nil, errors.New("repair_allocation")
}
sdk.CurrentMode = sdk.UploadModeHigh
sdk.SetSingleClietnMode(true)
sdk.SetShouldVerifyHash(false)
sdk.SetSaveProgress(false)
allocation.SetCheckStatus(true)
zob := &zcnObjects{
alloc: allocation,
metrics: minio.NewMetrics(),
Expand Down
5 changes: 3 additions & 2 deletions cmd/gateway/zcn/initSDK.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package zcn
import (
"encoding/json"
"fmt"
"github.com/0chain/gosdk/core/client"
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/0chain/gosdk/core/client"

"github.com/0chain/gosdk/core/conf"
"github.com/0chain/gosdk/core/logger"
"github.com/0chain/gosdk/zboxcore/sdk"
Expand Down Expand Up @@ -103,7 +104,7 @@ func initializeSDK(configDir, allocid string, nonce int64) error {

conf.InitClientConfig(&cfg)

sdk.SetNumBlockDownloads(10)
sdk.SetNumBlockDownloads(100)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.5
require (
cloud.google.com/go/storage v1.28.1
github.com/0chain/errors v1.0.3
github.com/0chain/gosdk v1.18.0-RC5
github.com/0chain/gosdk v1.18.0-RC18
github.com/Azure/azure-pipeline-go v0.2.2
github.com/Azure/azure-storage-blob-go v0.10.0
github.com/Shopify/sarama v1.28.0
Expand Down Expand Up @@ -104,7 +104,7 @@ require (
cloud.google.com/go/compute v1.19.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.13.0 // indirect
github.com/0chain/common v1.18.0 // indirect
github.com/0chain/common v1.18.3 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/Luzifer/go-openssl/v3 v3.1.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ contrib.go.opencensus.io/exporter/stackdriver v0.12.1/go.mod h1:iwB6wGarfphGGe/e
contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE=
contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/0chain/common v1.18.0 h1:vCkD869DR0zTZS4CDl5MMN3qixxyfTNxDDcHp7cTRrc=
github.com/0chain/common v1.18.0/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s=
github.com/0chain/common v1.18.3 h1:42dYOv2KyMTSanuS67iDtfv+ErbSRqR8NJ3MG72MwaI=
github.com/0chain/common v1.18.3/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw=
github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM=
github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc=
github.com/0chain/gosdk v1.18.0-RC5 h1:zmxjYm+KL0hrc22xZlSp6iE2xvQVpALC1PaOViTj4fw=
github.com/0chain/gosdk v1.18.0-RC5/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ=
github.com/0chain/gosdk v1.18.0-RC18 h1:CEC0XsGnQ+Yk08s51c1CEm0dDez72Acq243ypx7yxfA=
github.com/0chain/gosdk v1.18.0-RC18/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw=
github.com/Azure/azure-amqp-common-go/v2 v2.1.0/go.mod h1:R8rea+gJRuJR6QxTir/XuEd+YuKoUiazDC/N96FiDEU=
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
github.com/Azure/azure-pipeline-go v0.2.2 h1:6oiIS9yaG6XCCzhgAgKFfIWyo4LLCiDhZot6ltoThhY=
Expand Down
4 changes: 4 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ contrib.go.opencensus.io/resource v0.1.1 h1:4r2CANuYhKGmYWP02+5E94rLRcS/YeD+KlxS
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=
gioui.org v0.0.0-20210308172011-57750fc8a0a6 h1:K72hopUosKG3ntOPNG4OzzbuhxGuVf06fa2la1/H/Ho=
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
github.com/0chain/common v1.18.3 h1:42dYOv2KyMTSanuS67iDtfv+ErbSRqR8NJ3MG72MwaI=
github.com/0chain/common v1.18.3/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw=
github.com/0chain/gorocksdb v0.0.0-20220406081817-640f6b0a3abb h1:FOnCz8xXwqo6cJZpI83T9x/kmjbT0YdYqxzSHIVkMGs=
github.com/0chain/gorocksdb v0.0.0-20220406081817-640f6b0a3abb/go.mod h1:3i9d+2Osik7apjXERxpAlKxE7SilJKkHoW9Ihdjdfxs=
github.com/0chain/gosdk v1.8.5 h1:vZGart1W3pijEF3mhGk3d4CBsrRo4iqLxORY7rRkIP4=
Expand All @@ -515,6 +517,8 @@ github.com/0chain/gosdk v1.15.5 h1:e+khk21/YrjlxuvQPFCI2JsQbgSCyr/Y/Km82HCH+MM=
github.com/0chain/gosdk v1.15.5/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg=
github.com/0chain/gosdk v1.16.0 h1:3CKuU9i9d+X2/htJOIyxNwviKG5H/lp+q8ogzCgnoQI=
github.com/0chain/gosdk v1.16.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg=
github.com/0chain/gosdk v1.18.0-RC18 h1:CEC0XsGnQ+Yk08s51c1CEm0dDez72Acq243ypx7yxfA=
github.com/0chain/gosdk v1.18.0-RC18/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/Azure/azure-amqp-common-go/v2 v2.1.0 h1:+QbFgmWCnPzdaRMfsI0Yb6GrRdBj5jVL8N3EXuEUcBQ=
Expand Down

0 comments on commit 4021fe2

Please sign in to comment.