Skip to content

Commit

Permalink
updated: added storage version and managing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Akhilesh53 committed Oct 10, 2024
1 parent 86795cf commit f997e82
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cmd/newallocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -258,6 +274,8 @@ var newallocationCmd = &cobra.Command{
ThirdPartyExtendable: thirdPartyExtendable,
Force: force,
IsEnterprise: isEnterprise,
StorageVersion: storageVersion,

Check failure on line 277 in cmd/newallocation.go

View workflow job for this annotation

GitHub Actions / unit-test

unknown field StorageVersion in struct literal of type sdk.CreateAllocationOptions
ManagingWallet: managingWallet,

Check failure on line 278 in cmd/newallocation.go

View workflow job for this annotation

GitHub Actions / unit-test

unknown field ManagingWallet in struct literal of type sdk.CreateAllocationOptions
}
allocationID, _, _, err = sdk.CreateAllocationWith(options)
if err != nil {
Expand Down Expand Up @@ -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) {
Expand Down
29 changes: 29 additions & 0 deletions cmd/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Check failure on line 291 in cmd/storage.go

View workflow job for this annotation

GitHub Actions / unit-test

updateBlobber.StorageVersion undefined (type *sdk.UpdateBlobber has no field or method StorageVersion)
}

var managingWallet string
if flags.Changed("managing_wallet"){
if managingWallet, err = flags.GetString("managing_wallet"); err != nil{
log.Fatal(err)
}
updateBlobber.ManagingWallet = &managingWallet

Check failure on line 299 in cmd/storage.go

View workflow job for this annotation

GitHub Actions / unit-test

updateBlobber.ManagingWallet undefined (type *sdk.UpdateBlobber has no field or method ManagingWallet)
}

if termsChanged {
updateBlobber.Terms = terms
}
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit f997e82

Please sign in to comment.