Skip to content

Commit 09ee039

Browse files
author
Jayash Satolia
committed
Add auth round expiry flag
1 parent 8be45f6 commit 09ee039

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

cmd/newallocation.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ var newallocationCmd = &cobra.Command{
245245
}
246246
}
247247

248+
var authRoundExpiry int64
249+
if flags.Changed("auth_round_expiry") {
250+
authRoundExpiry, err = flags.GetInt64("auth_round_expiry")
251+
if err != nil {
252+
log.Fatal("invalid forbid_upload: ", err)
253+
}
254+
}
255+
248256
var allocationID string
249257
if len(owner) == 0 {
250258
options := sdk.CreateAllocationOptions{
@@ -267,6 +275,7 @@ var newallocationCmd = &cobra.Command{
267275
Force: force,
268276
IsEnterprise: isEnterprise,
269277
StorageVersion: int(storageVersion),
278+
AuthRoundExpiry: authRoundExpiry,
270279
}
271280
allocationID, _, _, err = sdk.CreateAllocationWith(options)
272281
if err != nil {
@@ -284,7 +293,7 @@ var newallocationCmd = &cobra.Command{
284293
}
285294

286295
allocationID, _, _, err = sdk.CreateAllocationForOwner(owner, ownerPublicKey, *datashards, *parityshards,
287-
*size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, isEnterprise, force, &fileOptionParams, 0)
296+
*size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, isEnterprise, force, &fileOptionParams, authRoundExpiry)
288297
if err != nil {
289298
log.Fatal("Error creating allocation: ", err)
290299
}
@@ -366,6 +375,7 @@ func init() {
366375
newallocationCmd.Flags().Bool("forbid_rename", false, "(default false) specify if the users cannot rename objects in this allocation")
367376

368377
newallocationCmd.Flags().Int64("storage_version", 0, "storaage version of allocation")
378+
newallocationCmd.Flags().Int64("auth_round_expiry", 0, "storaage version of allocation")
369379
}
370380

371381
func storeAllocation(allocationID string) {

cmd/updateallocation.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ var updateAllocationCmd = &cobra.Command{
119119
fileOptionParams.ForbidRename.Value = forbidRename
120120
}
121121

122+
var authRoundExpiry int64
123+
if flags.Changed("auth_round_expiry") {
124+
authRoundExpiry, err = flags.GetInt64("auth_round_expiry")
125+
if err != nil {
126+
log.Fatal("invalid auth_round_expiry: ", err)
127+
}
128+
}
129+
122130
if addBlobberId != "" {
123131
allocationObj, err := sdk.GetAllocation(allocID)
124132
if err != nil {
@@ -131,7 +139,7 @@ var updateAllocationCmd = &cobra.Command{
131139
allocUnderRepair = true
132140
if txnHash, err := allocationObj.UpdateWithRepair(
133141
size,
134-
0,
142+
authRoundExpiry,
135143
extend,
136144
lock,
137145
addBlobberId,
@@ -155,7 +163,7 @@ var updateAllocationCmd = &cobra.Command{
155163
} else {
156164
txnHash, _, err := sdk.UpdateAllocation(
157165
size,
158-
0,
166+
authRoundExpiry,
159167
extend,
160168
allocID,
161169
lock,
@@ -205,4 +213,5 @@ func init() {
205213
updateAllocationCmd.Flags().Bool("forbid_copy", false, "(default false) specify if the users cannot copy object from this allocation")
206214
updateAllocationCmd.Flags().Bool("forbid_rename", false, "(default false) specify if the users cannot rename objects in this allocation")
207215

216+
updateAllocationCmd.Flags().Int64("auth_round_expiry", 0, "auth round expiry in seconds")
208217
}

0 commit comments

Comments
 (0)