-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Support specifying MaxBytes in range request #16300
Open
linxiulei
wants to merge
6
commits into
etcd-io:main
Choose a base branch
from
linxiulei:size_paging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19cc23e
server: add a new field More into RangeResult
linxiulei f37bf69
rpc.proto: add a new field max_bytes into RangeRequest
linxiulei 3a4ce3a
rpc.proto: regenerate rpc.proto related files
linxiulei 8a56218
server: Implement MaxBytes option for RangeRequest
linxiulei 80b2f29
etcdctl: add max-bytes flag for get command
linxiulei d48d3e2
tests: add tests with specifying MaxBytes option
linxiulei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -36,6 +36,7 @@ type Op struct { | |||||
|
||||||
// for range | ||||||
limit int64 | ||||||
maxBytes int64 | ||||||
sort *SortOption | ||||||
serializable bool | ||||||
keysOnly bool | ||||||
|
@@ -157,6 +158,7 @@ func (op Op) toRangeRequest() *pb.RangeRequest { | |||||
Key: op.key, | ||||||
RangeEnd: op.end, | ||||||
Limit: op.limit, | ||||||
MaxBytes: op.maxBytes, | ||||||
Revision: op.rev, | ||||||
Serializable: op.serializable, | ||||||
KeysOnly: op.keysOnly, | ||||||
|
@@ -267,6 +269,8 @@ func OpDelete(key string, opts ...OpOption) Op { | |||||
panic("unexpected filter in delete") | ||||||
case ret.createdNotify: | ||||||
panic("unexpected createdNotify in delete") | ||||||
case ret.maxBytes != 0: | ||||||
panic("unexpected maxBytes in delete") | ||||||
} | ||||||
return ret | ||||||
} | ||||||
|
@@ -296,6 +300,8 @@ func OpPut(key, val string, opts ...OpOption) Op { | |||||
panic("unexpected filter in put") | ||||||
case ret.createdNotify: | ||||||
panic("unexpected createdNotify in put") | ||||||
case ret.maxBytes != 0: | ||||||
panic("unexpected maxBytes in delete") | ||||||
} | ||||||
return ret | ||||||
} | ||||||
|
@@ -323,6 +329,8 @@ func opWatch(key string, opts ...OpOption) Op { | |||||
panic("unexpected mod revision filter in watch") | ||||||
case ret.minCreateRev != 0, ret.maxCreateRev != 0: | ||||||
panic("unexpected create revision filter in watch") | ||||||
case ret.maxBytes != 0: | ||||||
panic("unexpected maxBytes in delete") | ||||||
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.
Suggested change
|
||||||
} | ||||||
return ret | ||||||
} | ||||||
|
@@ -345,6 +353,10 @@ func WithLease(leaseID LeaseID) OpOption { | |||||
// If WithLimit is given a 0 limit, it is treated as no limit. | ||||||
func WithLimit(n int64) OpOption { return func(op *Op) { op.limit = n } } | ||||||
|
||||||
// WithMaxBytes limits the size in bytes of results to return from 'Get' request. | ||||||
// If WithMaxBytes is given a 0 limit, it is treated as no limit. | ||||||
func WithMaxBytes(n int64) OpOption { return func(op *Op) { op.maxBytes = n } } | ||||||
|
||||||
// WithRev specifies the store revision for 'Get' request. | ||||||
// Or the start revision of 'Watch' request. | ||||||
func WithRev(rev int64) OpOption { return func(op *Op) { op.rev = rev } } | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.