Skip to content

Commit

Permalink
Support mtime header (#136)
Browse files Browse the repository at this point in the history
* support mtime header in getItem req

* make map with size

Co-authored-by: shay <[email protected]>
  • Loading branch information
assaf758 and speretz-ig authored Nov 9, 2022
1 parent c952df9 commit 599eeea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/dataplane/http/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,19 @@ func (c *context) GetItemsSync(getItemsInput *v3io.GetItemsInput) (*v3io.Respons
return nil, err
}

headers := getItemsHeadersCapnp
commonHeaders := getItemsHeadersCapnp
if getItemsInput.RequestJSONResponse {
headers = getItemsHeaders
commonHeaders = getItemsHeaders
}

headers := make(map[string]string, len(commonHeaders))
for k, v := range commonHeaders {
headers[k] = v
}

if len(getItemsInput.DataPlaneInput.MtimeSec) > 0 {
headers["conditional-mtime-sec"] = getItemsInput.DataPlaneInput.MtimeSec
headers["conditional-mtime-nsec"] = getItemsInput.DataPlaneInput.MtimeNsec
}

response, err := c.sendRequest(&getItemsInput.DataPlaneInput,
Expand Down
3 changes: 3 additions & 0 deletions pkg/dataplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type DataPlaneInput struct {
ContainerName string
AuthenticationToken string
AccessKey string
MtimeSec string
MtimeNsec string
Timeout time.Duration
IncludeResponseInError bool
}
Expand Down Expand Up @@ -295,6 +297,7 @@ type GetItemsInput struct {
SortKeyRangeEnd string
AllowObjectScatter string
ReturnData string
ReturnAllInodes bool
DataMaxSize int
RequestJSONResponse bool `json:"RequestJsonResponse"`
ChokeGetItemsMS int
Expand Down

0 comments on commit 599eeea

Please sign in to comment.