Skip to content
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

feat: support query offset #409

Merged
10 commits merged into from Nov 4, 2022
Merged
682 changes: 346 additions & 336 deletions api/open_saves.pb.go

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions api/open_saves.proto
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ service OpenSaves {
// omitted.
rpc Ping(PingRequest) returns (PingResponse) {}

// CompareAndSwap compares the property to old_value and updates the property to value
// CompareAndSwap compares the property to old_value and updates the property to value
// if the old_value and the current property are equal.
// The updated field in CompareAndSwapResponse is set to true if the swap is executed.
// For example, CompareAndSwap(property, value = 42, old_value = 24) will set the
// property to 42 if the current value is 24.
// CompareAndSwap also supports swapping with a value of another type, e.g.
// CompareAndSwap also supports swapping with a value of another type, e.g.
// CompareAndSwap(property, value = "42", old_value = 24).
// Otherwise it will not update the property and return the current (unchanged) value
// and updated = false. The operation is executed atomically.
Expand Down Expand Up @@ -131,7 +131,7 @@ service OpenSaves {
// AtomicSubInt does the same except it subtracts a number.
rpc AtomicSubInt(AtomicIntRequest) returns (AtomicIntResponse) {}

// AtomicInc increments the number of an integer property if less than upper_bound.
// AtomicInc increments the number of an integer property if less than upper_bound.
// Otherwise it resets the property to lower_bound.
// if (property < upper_bound) {
// property++
Expand Down Expand Up @@ -359,16 +359,19 @@ message QueryRecordsRequest {
// owner_id is the owner of records, represented as an external user ID.
string owner_id = 4;

// List of sort orders to return records. These SortOrders are applied
// List of sort orders to return records. These SortOrders are applied
// in sequence.
repeated SortOrder sort_orders = 5;

// the limit of the number of records to return.
int32 limit = 6;

// If keys_only is set to true, the server will only return records.key
// If keys_only is set to true, the server will only return records.key
// and store_keys in the QueryRecordsResponse message.
bool keys_only = 7;

// Number of records to skip when performing queries.
int32 offset = 8;
}

// FilterOperator has a list of comperators.
Expand Down Expand Up @@ -517,7 +520,7 @@ message CreateChunkedBlobRequest {

// Size of each chunk
int64 chunk_size = 3;

// Expected number of chunks.
// When set to non-zero, the server checks if it has received the exact number of
// chunks when CommitChunkedUpload is called.
Expand Down Expand Up @@ -677,7 +680,7 @@ message CompareAndSwapRequest {
// old_value is compared against the current property value.
Property old_value = 5;

// Performance hints.
// Performance hints.
Hint hint = 6;
}

Expand All @@ -686,7 +689,7 @@ message CompareAndSwapRequest {
message CompareAndSwapResponse {
// updated indicates that the condition is satisfied and the property has been updated.
bool updated = 1;

// value is the old value of the property.
Property value = 2;
}
Expand All @@ -706,7 +709,7 @@ message AtomicIntRequest {
// value is the operand for each method (see method descriptions).
int64 value = 4;

// Performance hints.
// Performance hints.
Hint hint = 5;
}

Expand All @@ -715,7 +718,7 @@ message AtomicIntRequest {
message AtomicIntResponse {
// updated indicates that the condition is satisfied and the property has been updated.
bool updated = 1;

// value is the property value before the atomic operation.
int64 value = 2;
}
Expand All @@ -737,6 +740,6 @@ message AtomicIncRequest {
// upper_bound is the upper bound of the interval.
int64 upper_bound = 5;

// Performance hints.
// Performance hints.
Hint hint = 6;
}
2 changes: 1 addition & 1 deletion api/open_saves_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ Multiple conditions are AND&#39;ed together.
| sort_orders | [SortOrder](#opensaves-SortOrder) | repeated | List of sort orders to return records. These SortOrders are applied in sequence. |
| limit | [int32](#int32) | | the limit of the number of records to return. |
| keys_only | [bool](#bool) | | If keys_only is set to true, the server will only return records.key and store_keys in the QueryRecordsResponse message. |
| offset | [int32](#int32) | | Number of records to skip when performing queries. |



Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/alicebob/miniredis/v2 v2.22.0
github.com/go-redis/redis/v8 v8.11.5
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.5.8
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/pseudomuto/protoc-gen-doc v1.5.1
github.com/sirupsen/logrus v1.9.0
Expand All @@ -18,19 +18,19 @@ require (
github.com/vmihailenco/msgpack/v5 v5.3.5
go.opencensus.io v0.23.0
gocloud.dev v0.25.0
google.golang.org/api v0.90.0
google.golang.org/grpc v1.48.0
google.golang.org/api v0.100.0
google.golang.org/grpc v1.50.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0
google.golang.org/protobuf v1.28.1
)

require (
cloud.google.com/go v0.103.0 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/monitoring v1.4.0 // indirect
cloud.google.com/go/storage v1.24.0 // indirect
cloud.google.com/go/trace v1.2.0 // indirect
cloud.google.com/go v0.105.0 // indirect
cloud.google.com/go/compute v1.10.0 // indirect
cloud.google.com/go/iam v0.6.0 // indirect
cloud.google.com/go/monitoring v1.7.0 // indirect
cloud.google.com/go/storage v1.27.0 // indirect
cloud.google.com/go/trace v1.3.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
Expand All @@ -40,16 +40,16 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/envoyproxy/protoc-gen-validate v0.6.7 // indirect
github.com/envoyproxy/protoc-gen-validate v0.6.13 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/wire v0.5.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
Expand All @@ -67,17 +67,17 @@ require (
github.com/subosito/gotenv v1.4.0 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/mod v0.5.0 // indirect
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462 // indirect
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9 // indirect
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading