Skip to main content

StateBackendConfig

Enum StateBackendConfig 

Source
pub enum StateBackendConfig {
    InProcess {
        vnode_capacity: u32,
    },
    Local {
        path: PathBuf,
        instance_id: String,
        vnode_capacity: u32,
    },
    ObjectStore {
        url: String,
        storage: StorageOptions,
        instance_id: String,
        vnode_capacity: u32,
        vnodes: Option<Vec<u32>>,
        merger_instance: Option<String>,
        discovery: DiscoveryMode,
        seed_peers: Vec<String>,
    },
}
Expand description

Tagged-union config that selects the runtime StateBackend.

See module docs for the five deployment shapes.

Variants§

§

InProcess

Non-durable in-process backend. The default.

Fields

§vnode_capacity: u32

Number of vnodes the backend should size for.

§

Local

Durable single-node backend on a local filesystem path. Shorthand for an object_store backend with a file:// URL.

Fields

§path: PathBuf

Filesystem root for state.

§instance_id: String

Node identity (written into epoch commit markers for audit).

§vnode_capacity: u32

Number of vnodes the backend should size for.

§

ObjectStore

Durable shared-state backend on S3 / GCS / Azure. Used by all distributed-embedded and cluster modes.

Fields

§url: String

Object store URL: s3://bucket/prefix, gs://bucket/prefix, etc.

§storage: StorageOptions

Cloud credentials/config overrides (e.g. endpoint, aws_access_key_id), same keys as [checkpoint.storage]. Anything absent falls back to the provider’s standard env vars (AWS_ACCESS_KEY_ID, …).

§instance_id: String

This node’s identity. Written into epoch manifests and used by the assignment-version fence to reject stale writes.

§vnode_capacity: u32

Number of vnodes the backend should size for.

§vnodes: Option<Vec<u32>>

Static vnode subset for this instance. None means “all vnodes” (useful for the merger instance or for dynamic mode).

§merger_instance: Option<String>

Optional merger instance — the node that fans in partials for sink emission. Only meaningful in static mode.

§discovery: DiscoveryMode

Discovery strategy: static assignment or chitchat gossip.

§seed_peers: Vec<String>

Seed peers for dynamic discovery.

Implementations§

Source§

impl StateBackendConfig

Source

pub fn in_process() -> Self

Builder: embedded library, single process.

Source

pub fn local(path: impl Into<PathBuf>) -> Self

Builder: single-node durable state on the local filesystem.

Source

pub fn object_store( url: impl Into<String>, instance_id: impl Into<String>, ) -> Self

Builder: distributed-embedded over an object store, static mode. Credentials resolve from the provider’s standard env vars; use the storage config field for explicit overrides.

Source

pub async fn build( &self, ) -> Result<Arc<dyn StateBackend>, StateBackendBuildError>

Instantiate the runtime backend.

Declared async because backends added in later iterations (object store, distributed) need to perform async setup. The in-process path completes synchronously today; callers must still .await for forward-compatibility.

§Errors
Source

pub fn local_storage_dir(&self) -> Option<&Path>

Filesystem path for durable state, if any. Returns None for non-filesystem backends.

Source

pub fn build_object_store( &self, ) -> Result<Option<Arc<dyn ObjectStore>>, StateBackendBuildError>

Build the underlying object_store handle (if any) so callers that need to share the same store — e.g. an AssignmentSnapshotStore alongside the state backend — can avoid re-parsing the URL. None for InProcess.

§Errors

Same failure modes as Self::build.

Source

pub fn is_durable(&self) -> bool

Returns true if this backend persists state across process restarts.

Source

pub fn vnode_capacity(&self) -> u32

Number of vnodes this backend is sized for.

Trait Implementations§

Source§

impl Clone for StateBackendConfig

Source§

fn clone(&self) -> StateBackendConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StateBackendConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StateBackendConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StateBackendConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for StateBackendConfig

Source§

impl PartialEq for StateBackendConfig

Source§

fn eq(&self, other: &StateBackendConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StateBackendConfig

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more