Add RangeScanStore interface for KV range scans#139
Merged
Conversation
This was referenced Feb 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new RangeScanStore interface to the sgbucket package for performing KV range scan operations, mirroring the gocb Collection.Scan() API in a simplified form. This is an infrastructure addition that provides an abstraction layer for range scanning across different bucket implementations.
Changes:
- Added new
RangeScanStoreinterface with scan operations includingRangeScan,ScanTerm,ScanResultIterator, andScanOptionstypes - Added
BucketStoreFeatureRangeScanfeature flag to enable detection of range scan support - Included a helper function
NewRangeScanForPrefix()for common prefix-based scanning patterns
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| rangescan.go | New file defining the RangeScanStore interface, scan types, iterator pattern, and helper functions for range scanning |
| bucket.go | Added BucketStoreFeatureRangeScan feature flag to the BucketStoreFeature enum |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add sgbucket.RangeScanStore interface with Scan() method, supporting RangeScan and SamplingScan types. Includes ScanResultIterator for streaming results and NewRangeScanForPrefix helper.
5019980 to
072a200
Compare
- Thread ctx through Scan/Next/Close to match the post-CBG-5290 DataStore conventions (other iterator interfaces such as QueryResultIterator already take a ctx). - Drop ScanResultItem.IDOnly: the per-item flag is redundant given ScanOptions.IDsOnly is known to the caller. Document that Body is nil when IDsOnly is set. - Fix stale doc comment that referenced a non-existent SamplingScan implementation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gregns1
approved these changes
May 19, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new
sgbucket.RangeScanStoreinterface that exposes KV range scan operations through the bucket abstraction layer.This mirrors the gocb Collection.Scan() API in a simplified form.
RangeScanStoreinterface withScan()methodRangeScanscan type withScanTermboundaries (inclusive/exclusive)ScanResultIteratorfor streaming results withNext()/Close()ScanOptionswithIDsOnlysupport for key-only scansNewRangeScanForPrefix()helper for common prefix-based scans (iterate through all docs starting with prefix)BucketStoreFeatureRangeScan