feat: thread blocking_subscribe through PUT/GET operations#2878
Closed
iduartgomez wants to merge 1 commit intomainfrom
Closed
feat: thread blocking_subscribe through PUT/GET operations#2878iduartgomez wants to merge 1 commit intomainfrom
iduartgomez wants to merge 1 commit intomainfrom
Conversation
Wire the new `blocking_subscribe` field from `ContractRequest::Put` and `ContractRequest::Get` (added in freenet-stdlib 0.1.33) through the operation state machines so that clients can opt into synchronous subscription behavior. Key changes: - put.rs: Add `blocking_subscribe` to PutState, start_op signatures, and replace hardcoded `false` in start_subscription_after_put calls - get.rs: Add `blocking_subscribe` to GetState, start_op signatures, and use it in start_subscription_request calls - client_events/mod.rs: Extract and thread the field through all PUT/GET code paths (local, dedup, legacy) - request_router.rs: Add field to DeduplicatedRequest variants - Update all call sites across core, fdev, and ping app
9ebc715 to
4231f73
Compare
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.
Problem
When clients use
subscribe=trueon PUT/GET operations, subscriptions happen asynchronously. The blocking subscription infrastructure already exists (start_subscription_after_put()andstart_subscription_request()both accept ablocking_subscription: bool), but the value was always hardcoded tofalsewith TODO comments saying it should come fromContractRequestonce stdlib was updated.Solution
With freenet-stdlib 0.1.33 now providing
blocking_subscribe: boolonContractRequest::PutandContractRequest::Get, this PR wires the field through the entire operation pipeline:blocking_subscribetoPutState::PrepareRequest/AwaitingResponse,start_op()/start_op_with_id()signatures, and replaced all hardcodedfalseinstart_subscription_after_put()calls (4 sites)blocking_subscribetoGetState::PrepareRequest/AwaitingResponse,start_op()/start_op_with_id()signatures, and wired it throughstart_subscription_request()calls (2 sites, guarded bysubscribe_requested && blocking_sub)blocking_subscribefromContractRequestand threads it through all PUT/GET code paths (local-only, dedup router, legacy)blocking_subscribefield toDeduplicatedRequest::GetandDeduplicatedRequest::Putblocking_subscribe: falsedefaultBackward compatible: the field defaults to
falsein both FlatBuffers and serde, so existing clients are unaffected.Testing
cargo fmt— cleancargo clippy --all-targets --all-features— no warningscargo test -p freenet --lib— 1280 passed, 0 failedDependencies