add asp commands#1701
Draft
nickpoindexter wants to merge 4 commits into
Draft
Conversation
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.
Summary
Adds first-class driver support for Atlas Stream Processing (ASP), implementing the ASP driver spec. Today users have to drop down to
Database::run_commandagainst a workspace endpoint; this PR adds a dedicated client/handles/operations layer.What's new
Public module (
driver/src/stream_processing.rs,driver/src/stream_processing/)StreamProcessingClient— workspace-scoped client distinct fromClient. Validates the workspace URI (atlas-stream-*.<region>.a.query.mongodb.netand the.mongodb-<env>.netstaging variants), enforces TLS, defaultsauthSource=admin. Constructor pair:with_uri_strandwith_options. Staticis_workspace_uri(&str) -> boolis exposed for callers that want to gate before connecting.StreamProcessors—create()/get()/get_info()for managing processors in a workspace.StreamProcessor—start()/stop()/drop()/stats()/samples()for a named processor.StreamProcessorInfo— typed deserialization target forgetStreamProcessor. Fields the spec marks as Optional (e.g.id,pipeline_version) areOption<T>.StreamProcessorSamples— result ofsamples(), exposescursor_id,documents,is_exhausted(). - Options:CreateStreamProcessorOptions,StartStreamProcessorOptions,FailoverOptions,GetStreamProcessorStatsOptions,GetStreamProcessorSamplesOptions. All#[derive(TypedBuilder, Serialize, Deserialize)]with#[skip_serializing_none]to match the rest of the driver's options pattern.Operation layer (
driver/src/operation/stream_processing/)One
OperationWithDefaultsimpl per wire command:createStreamProcessor,startStreamProcessor,stopStreamProcessor,dropStreamProcessor,getStreamProcessor,getStreamProcessorStats,startSampleStreamProcessor,getMoreSampleStreamProcessor. All target theadmindatabase viaOperationTarget::admin(client). Retryable reads (getStreamProcessor,getStreamProcessorStats) declareRetryability::read(options)per the spec's retryability matrix.Notable spec / server alignment
startAfter(inStartStreamProcessorOptions) is intentionally not exposed — the spec marks it RESERVED for future use and explicitly forbids drivers from sending it. - Dev-server response shape deviations are accommodated, matching the workarounds in the Python POC and PHP PR:GetStreamProcessorunwraps a top-levelresultwrapper when the server returns{ ok: 1, result: { … } }.GetMoreSampleStreamProcessoraccepts bothnextBatch(spec) andmessages(current dev server). -StreamProcessorInfo::idandpipeline_versionareOption<T>rather than required.samples()is a single-command dispatch: absent / zerocursor_id→startSampleStreamProcessor(returnscursor_id, empty docs); non-zerocursor_id→getMoreSampleStreamProcessor. Callers stop whencursor_id ==0.String, not an enum — per the spec, drivers MUST surface unknown state values as-is rather than mapping to a closed set.tenantID,projectId,processorId) are not surfaced in the user-facing API.Test plan
cargo check -p mongodbcleancargo clippy -p mongodb --all-targets -- -D warnings— no new warnings on the new code (only pre-existing CSFLE-feature-gated dead-code warnings inclient.rs/tracking_arc.rsthat are present onmain)cargo +nightly fmt --check -- --unstable-featurescleancargo test -p mongodb --lib stream_processing::tests— 10 unit tests pass (URI detection for prod / staging / creds-and-port / case-insensitivity / four reject cases; async rejection paths for non-workspace URI and SRVscheme)stream_processing::lifecycleindriver/src/test/stream_processing.rsruns the fullcreate → start → stats → sample → stop → droplifecycle. Self-skips vialog_uncapturedunlessMONGODB_STREAM_PROCESSING_URIis set to a real workspace endpoint — needs an Evergreen variant configured with workspace creds before it actually exercises in CI.