Skip to content

Commit

Permalink
Merge pull request #1470 from 0chain/sprint-1.17
Browse files Browse the repository at this point in the history
Sprint 1.17
  • Loading branch information
dabasov authored Aug 29, 2024
2 parents b915d1d + 385ebf6 commit 3dc0b63
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions code/go/0chain.net/blobbercore/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ type Config struct {
// AutomacitUpdate Whether to automatically update blobber updates to blockchain
AutomaticUpdate bool
BlobberUpdateInterval time.Duration

IsEnterprise bool
}

/*Configuration of the system */
Expand Down Expand Up @@ -298,6 +300,8 @@ func ReadConfig(deploymentMode int) {
Configuration.CommitLimitMonthly = viper.GetInt64("rate_limiters.commit_limit_monthly")
Configuration.CommitLimitDaily = viper.GetInt64("rate_limiters.commit_limit_daily")
Configuration.CommitZeroLimitDaily = viper.GetInt64("rate_limiters.commit_zero_limit_daily")

Configuration.IsEnterprise = viper.GetBool("is_enterprise")
}

// StorageSCConfiguration will include all the required sc configs to operate blobber
Expand Down
2 changes: 2 additions & 0 deletions code/go/0chain.net/blobbercore/handler/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func getStorageNode() (*transaction.StorageNode, error) {
sn.StakePoolSettings.NumDelegates = config.Configuration.NumDelegates
sn.StakePoolSettings.ServiceCharge = config.Configuration.ServiceCharge

sn.IsEnterprise = config.Configuration.IsEnterprise

return sn, nil
}

Expand Down
4 changes: 2 additions & 2 deletions code/go/0chain.net/blobbercore/reference/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ func GetReferenceByLookupHashForDownload(ctx context.Context, allocationID, path
func GetReferencesByName(ctx context.Context, allocationID, name string) (refs []*Ref, err error) {
db := datastore.GetStore().GetTransaction(ctx)
err = db.Model(&Ref{}).
Where("allocation_id = ? AND name @@ plainto_tsquery(?)", allocationID, name).
Order("ts_rank_cd(to_tsvector('english', name), plainto_tsquery(?)) DESC").
Where("allocation_id = ? AND name LIKE ?", allocationID, "%"+name+"%").
Limit(20).
Find(&refs).Error
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions code/go/0chain.net/core/transaction/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type StorageNode struct {
Capacity int64 `json:"capacity"`
PublicKey string `json:"-"`
StakePoolSettings StakePoolSettings `json:"stake_pool_settings"`
IsEnterprise bool `json:"is_enterprise"`
}

type BlobberAllocation struct {
Expand Down
2 changes: 2 additions & 0 deletions config/0chain_blobber.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ write_price: 0.025 # token / GB / time_unit for writing
price_in_usd: false
price_worker_in_hours: 12

is_enterprise: false

# update_allocations_interval used to refresh known allocation objects from SC
update_allocations_interval: 60m

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/0chain/errors v1.0.3
github.com/0chain/gosdk v1.16.5
github.com/0chain/gosdk v1.17.0-RC6
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/didip/tollbooth/v6 v6.1.2
github.com/go-openapi/runtime v0.26.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs
github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E=
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.16.5 h1:EGtndZLj5+m8OAIzfAfjqu4llEolWuxgKQxXS0tfe7Q=
github.com/0chain/gosdk v1.16.5/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg=
github.com/0chain/gosdk v1.17.0-RC6 h1:NB4pfu0VbVWfQQEfnFqn5inaiQuyhSaUW7VwgH3LW8U=
github.com/0chain/gosdk v1.17.0-RC6/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
Expand Down

0 comments on commit 3dc0b63

Please sign in to comment.