From f997e82cca62bf79ec9186c0a4c60e523bc26f8d Mon Sep 17 00:00:00 2001 From: Akhilesh Mahajan Date: Thu, 10 Oct 2024 23:36:47 +0530 Subject: [PATCH] updated: added storage version and managing tags --- cmd/newallocation.go | 22 ++++++++++++++++++++++ cmd/storage.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index 460fdadd..3e1faa00 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -237,6 +237,22 @@ 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 managingWallet string + if flags.Changed("managing_wallet") { + managingWallet, err = flags.GetString("managing_wallet") + if err != nil { + log.Fatal("invalid managing wallet: ", err) + } + } + var allocationID string if len(owner) == 0 { options := sdk.CreateAllocationOptions{ @@ -258,6 +274,8 @@ var newallocationCmd = &cobra.Command{ ThirdPartyExtendable: thirdPartyExtendable, Force: force, IsEnterprise: isEnterprise, + StorageVersion: storageVersion, + ManagingWallet: managingWallet, } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { @@ -355,6 +373,10 @@ 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().String("storage_version", "", "storage version of the blobber") + newallocationCmd.Flags().String("managing_wallet", "", "managing wallet of the blobber") + } func storeAllocation(allocationID string) { diff --git a/cmd/storage.go b/cmd/storage.go index 7da2cf4a..c7db7d8f 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -234,6 +234,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 { @@ -274,6 +283,22 @@ var blobberUpdateCmd = &cobra.Command{ updateBlobber.IsRestricted = &ia } + var storageVersion int64 + if flags.Changed("storage_version"){ + if storageVersion, err = flags.GetInt64("storage_version"); err != nil{ + log.Fatal(err) + } + updateBlobber.StorageVersion = &storageVersion + } + + var managingWallet string + if flags.Changed("managing_wallet"){ + if managingWallet, err = flags.GetString("managing_wallet"); err != nil{ + log.Fatal(err) + } + updateBlobber.ManagingWallet = &managingWallet + } + if termsChanged { updateBlobber.Terms = terms } @@ -389,6 +414,10 @@ func init() { buf.Bool("not_available", true, "(default false) set blobber's availability for new allocations") buf.Bool("is_restricted", true, "(default false) set is_restricted") buf.String("url", "", "update the url of the blobber, optional") + buf.Int64("storage_version", 2, "storage version of the blobber, optional") + buf.String("delegate_wallet", "", "delegate wallet of the blobber, optional") + buf.String("managing_wallet", "", "managing wallet of the blobber, optional") + blobberUpdateCmd.MarkFlagRequired("blobber_id") resetBlobberStatsCmd.Flags().String("blobber_id", "", "blobber_id is required")