diff --git a/code/go/0chain.net/blobbercore/config/config.go b/code/go/0chain.net/blobbercore/config/config.go index 3cef13b2d..7e9d2dccc 100644 --- a/code/go/0chain.net/blobbercore/config/config.go +++ b/code/go/0chain.net/blobbercore/config/config.go @@ -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 */ @@ -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 diff --git a/code/go/0chain.net/blobbercore/handler/protocol.go b/code/go/0chain.net/blobbercore/handler/protocol.go index 3f32965e7..976828558 100644 --- a/code/go/0chain.net/blobbercore/handler/protocol.go +++ b/code/go/0chain.net/blobbercore/handler/protocol.go @@ -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 } diff --git a/code/go/0chain.net/blobbercore/reference/ref.go b/code/go/0chain.net/blobbercore/reference/ref.go index 4de000da6..6c50cf1b3 100644 --- a/code/go/0chain.net/blobbercore/reference/ref.go +++ b/code/go/0chain.net/blobbercore/reference/ref.go @@ -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 diff --git a/code/go/0chain.net/core/transaction/entity.go b/code/go/0chain.net/core/transaction/entity.go index defed28a1..6a41ff980 100644 --- a/code/go/0chain.net/core/transaction/entity.go +++ b/code/go/0chain.net/core/transaction/entity.go @@ -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 { diff --git a/config/0chain_blobber.yaml b/config/0chain_blobber.yaml index eac82db9c..55b5bcf37 100755 --- a/config/0chain_blobber.yaml +++ b/config/0chain_blobber.yaml @@ -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 diff --git a/go.mod b/go.mod index 97f131e2a..e747651f4 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 2053ba373..a4f5c3b19 100644 --- a/go.sum +++ b/go.sum @@ -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=