Skip to content

CBG-5290: Pass context through all methods#144

Merged
bbrks merged 6 commits into
mainfrom
CBG-5290
May 11, 2026
Merged

CBG-5290: Pass context through all methods#144
bbrks merged 6 commits into
mainfrom
CBG-5290

Conversation

@bbrks

@bbrks bbrks commented May 7, 2026

Copy link
Copy Markdown
Member

CBG-5290

Pass context through all sg-bucket API methods

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 updates the sgbucket public interfaces to thread context.Context through additional API entrypoints, aligning bucket/query/view/feed operations with context-aware cancellation/logging patterns.

Changes:

  • Added ctx context.Context parameters to multiple core interfaces (BucketStore, KVStore, ViewStore, QueryableStore, MutationFeed, and related callback types).
  • Updated ViewResult’s iterator methods to match the updated QueryResultIterator interface (NextBytes(ctx), Close(ctx)), and propagated ctx into view doc-loading (ds.Get(ctx, ...)).
  • Updated callback types used by DCP feed handling to include ctx.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
bucket.go Adds context.Context to many bucket/datastore/KV interfaces and callback types.
queries.go Makes query capability + iterators context-aware (incl. NextBytes(ctx) / Close(ctx)).
views.go Threads ctx through view processing and iterator API; uses ctx for doc fetch via DataStore.
tap.go Makes mutation feed interface + event callback context-aware.
Comments suppressed due to low confidence (1)

queries.go:71

  • The doc comment says QueryResultIterator is implemented by gocb.ViewResults and gocb.QueryResults, but adding ctx parameters to NextBytes/Close means the upstream gocb types will no longer satisfy this interface. Update the comment (and/or introduce adapter wrappers) so consumers aren’t misled about compatibility.
// Common query iterator interface,
// implemented by sgbucket.ViewResult, gocb.ViewResults, and gocb.QueryResults
type QueryResultIterator interface {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bucket.go
Comment thread bucket.go Outdated
Comment thread bucket.go Outdated
Comment thread bucket.go Outdated
Comment thread tap.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
bbrks and others added 2 commits May 8, 2026 18:47
The ctx parameter was being ignored by every caller — drop it from the
callback signature. Callers can still log via the ctx passed to
KVStore.Update itself, or via closure capture.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same rationale as the previous UpdateFunc commit: ctx was being ignored
by every caller. Drop it from the callback signatures uniformly.
Callers can still log via the ctx passed to the surrounding API call,
or via closure capture.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bbrks bbrks merged commit 015dc33 into main May 11, 2026
19 checks passed
@bbrks bbrks deleted the CBG-5290 branch May 11, 2026 14:22
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.

4 participants