Skip to content

Add RangeScanStore interface for KV range scans#139

Merged
bbrks merged 3 commits into
mainfrom
rosmar_kv_range_scan
May 19, 2026
Merged

Add RangeScanStore interface for KV range scans#139
bbrks merged 3 commits into
mainfrom
rosmar_kv_range_scan

Conversation

@bbrks

@bbrks bbrks commented Feb 26, 2026

Copy link
Copy Markdown
Member

Adds a new sgbucket.RangeScanStore interface that exposes KV range scan operations through the bucket abstraction layer.
This mirrors the gocb Collection.Scan() API in a simplified form.

  • RangeScanStore interface with Scan() method
  • RangeScan scan type with ScanTerm boundaries (inclusive/exclusive)
  • ScanResultIterator for streaming results with Next()/Close()
  • ScanOptions with IDsOnly support for key-only scans
  • NewRangeScanForPrefix() helper for common prefix-based scans (iterate through all docs starting with prefix)
  • BucketStoreFeatureRangeScan

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RangeScanStore interface with scan operations including RangeScan, ScanTerm, ScanResultIterator, and ScanOptions types
  • Added BucketStoreFeatureRangeScan feature 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.

Comment thread rangescan.go Outdated
Comment thread rangescan.go Outdated
Comment thread rangescan.go Outdated
Comment thread rangescan.go Outdated
Add sgbucket.RangeScanStore interface with Scan() method, supporting
RangeScan and SamplingScan types. Includes ScanResultIterator for
streaming results and NewRangeScanForPrefix helper.
@bbrks bbrks force-pushed the rosmar_kv_range_scan branch from 5019980 to 072a200 Compare May 18, 2026 14:38
- 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>
@bbrks bbrks requested a review from gregns1 May 18, 2026 20:55
@bbrks bbrks merged commit 9e05bfc into main May 19, 2026
11 checks passed
@bbrks bbrks deleted the rosmar_kv_range_scan branch May 19, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants