-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(act): chunk download and granteelist handling #46
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,6 @@ func (c *ControllerStruct) UploadHandler( | |
storage kvs.KeyValueStore | ||
actRef swarm.Address | ||
) | ||
now := time.Now().Unix() | ||
if historyRef.IsZero() { | ||
history, err := NewHistory(ls) | ||
if err != nil { | ||
|
@@ -94,7 +93,7 @@ func (c *ControllerStruct) UploadHandler( | |
if err != nil { | ||
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
err = history.Add(ctx, actRef, &now, nil) | ||
err = history.Add(ctx, actRef, nil, nil) | ||
if err != nil { | ||
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
|
@@ -107,12 +106,11 @@ func (c *ControllerStruct) UploadHandler( | |
if err != nil { | ||
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
entry, err := history.Lookup(ctx, now) | ||
actRef = entry.Reference() | ||
entry, err := history.Lookup(ctx, time.Now().Unix()) | ||
if err != nil { | ||
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
storage, err = kvs.NewReference(ls, actRef) | ||
storage, err = kvs.NewReference(ls, entry.Reference()) | ||
if err != nil { | ||
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
|
@@ -197,15 +195,12 @@ func (c *ControllerStruct) UpdateHandler( | |
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
} | ||
granteesToAdd := addList | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the point of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. granteesToAdd can change due to remove(), if removelist is non-empty, then granteesToAdd = gl.Get() |
||
if len(removeList) != 0 { | ||
err = gl.Remove(removeList) | ||
if err != nil { | ||
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
} | ||
|
||
var granteesToAdd []*ecdsa.PublicKey | ||
if len(removeList) != 0 || encryptedglref.IsZero() { | ||
// generate new access key and new act | ||
act, err = kvs.New(ls) | ||
if err != nil { | ||
|
@@ -216,8 +211,6 @@ func (c *ControllerStruct) UpdateHandler( | |
return swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, swarm.ZeroAddress, err | ||
} | ||
granteesToAdd = gl.Get() | ||
} else { | ||
granteesToAdd = addList | ||
} | ||
|
||
for _, grantee := range granteesToAdd { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it logging
nil
to error level and log the error to debug?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this pattern is used in other endpoints (I agree it is strange)