feat: add internal BigSegmentStoreWrapper with caching and status polling#543
feat: add internal BigSegmentStoreWrapper with caching and status polling#543beekld wants to merge 4 commits into
Conversation
|
|
||
| // Query the store outside any lock, then publish the result to waiters and | ||
| // drop the in-flight entry. | ||
| auto result = store_->GetMembership(HashContextKey(context_key)); |
There was a problem hiding this comment.
Does IBigSegmentStore::GetMembership need to be noexcept?
We'll want to determine if we should update the spec here or the implementations. It does sound reasonably though. |
|
|
||
| BigSegmentStoreStatus BigSegmentStoreWrapper::GetStatus() { | ||
| { | ||
| std::lock_guard lock(status_mutex_); |
There was a problem hiding this comment.
Probably not a major concern, but should this have the same type of in-flight check as membership?
(It appears implementation side this is inconsistent, go/java just let it thunder while .Net creates a task and then re-uses it for subsequent waiters.)
|
|
||
| /** | ||
| * @brief Registers a listener invoked whenever the store status changes | ||
| * (not on every poll). The returned connection unregisters on destruction. |
There was a problem hiding this comment.
Does the connection actually un-register on destruction?
Summary
Internal layer between the evaluator and a customer-provided
IBigSegmentStore: hashes context keys, caches membership lookups, polls thestore's metadata in the background to track availability/staleness, and
broadcasts status changes. No caller yet — the evaluator and the public status
provider come later in the stack.
Design notes
base64(sha256(key))using the standard base64alphabet (not the existing URL-safe
Base64UrlEncode), so the lookup keymatches what the Relay Proxy writes.
than each hitting the store.
async::Delay+CancellationSource.unavailable. The spec requires this; the Java and Go SDKs don't do it, so this
is a deliberate divergence.
StoreMetadata::last_up_to_datefrom a baremillisecondsto asystem_clock::time_point, so staleness math can't mix epochs. This touchesthe Redis and DynamoDB stores (one line each) and their metadata tests.
Test plan
Note
Cursor Bugbot is generating a summary for commit 2b88796. Configure here.