-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add Update/Put item output #47
Conversation
pkg/dataplane/http/context.go
Outdated
@@ -1476,3 +1490,30 @@ func (c *context) stop(reason string, timeout *time.Duration) error { | |||
|
|||
return nil | |||
} | |||
|
|||
// parsing the mtime from a header of the form `__mtime_secs==1581605100 and __mtime_nsecs==498349956` | |||
func parseMtimeHeader(response *v3io.Response) (int, int) { |
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.
Don't ignore errors
pkg/dataplane/http/context.go
Outdated
updateItemInput.Path, | ||
putItemFunctionName, | ||
updateItemInput.Attributes, | ||
updateItemInput.Condition, | ||
putItemHeaders, | ||
body) | ||
|
||
mtimeSecs, mtimeNSecs := parseMtimeHeader(response) | ||
output := &v3io.UpdateItemOutput{MtimeSecs: mtimeSecs, MtimeNSecs: mtimeNSecs} |
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 do you need this "output" variable? Just set .Output to &v3io.UpdateItemOutput{...
Same as in the other place(s)
if err != nil { | ||
return 0, 0 | ||
} | ||
} |
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.
else? is this an error?
pkg/dataplane/http/context.go
Outdated
mtimeParts := strings.Split(expression, "==") | ||
mtimeType := strings.TrimSpace(mtimeParts[0]) | ||
if mtimeType == "__mtime_secs" { | ||
mtimeSecsStr := strings.TrimSpace(mtimeParts[1]) |
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.
You're repeating the parse logic here. Please move to a small helper function that returns int, error
Create an output for update and put item containing
mtime
.