Skip to main content

FlowFabricAdminClient

Struct FlowFabricAdminClient 

Source
pub struct FlowFabricAdminClient { /* private fields */ }
Expand description

Client for the ff-server admin REST surface.

Construct via FlowFabricAdminClient::new (no auth) or FlowFabricAdminClient::with_token (Bearer auth). Both return a ready-to-use client backed by a single pooled reqwest::Client — reuse the instance across calls instead of building one per request.

Implementations§

Source§

impl FlowFabricAdminClient

Source

pub fn new(base_url: impl Into<String>) -> Result<Self, SdkError>

Build a client without auth. Suitable for a dev ff-server whose api_token is unconfigured. Production deployments should use with_token.

Source

pub fn with_token( base_url: impl Into<String>, token: impl AsRef<str>, ) -> Result<Self, SdkError>

Build a client that sends Authorization: Bearer <token> on every request. The token is passed by value so the caller retains ownership policy (e.g. zeroize on drop at the caller side); the SDK only reads it.

§Empty-token guard

An empty or all-whitespace token returns SdkError::Config instead of silently constructing Authorization: Bearer (which the server rejects with 401, leaving the operator chasing a “why is auth broken” ghost). Common source: FF_ADMIN_TOKEN="" in a shell where the var was meant to be set; the unset-expansion is the empty string. Prefer an obvious error at construction over a silent 401 at first request.

If the caller genuinely wants an unauthenticated client (dev ff-server without api_token configured), use FlowFabricAdminClient::new instead.

Source

pub async fn claim_for_worker( &self, req: ClaimForWorkerRequest, ) -> Result<Option<ClaimForWorkerResponse>, SdkError>

POST /v1/workers/{worker_id}/claim — scheduler-routed claim.

Batch C item 2 PR-B. Swaps the SDK’s direct-Valkey claim for a server-side one: the request carries lane + identity + capabilities + grant TTL; the server runs budget, quota, and capability admission via ff_scheduler::Scheduler::claim_for_worker and returns a ClaimGrant on success.

Returns Ok(None) when the server responds 204 No Content (no eligible execution on the lane). Callers that want to keep polling should back off per their claim cadence.

Source

pub async fn rotate_waitpoint_secret( &self, req: RotateWaitpointSecretRequest, ) -> Result<RotateWaitpointSecretResponse, SdkError>

Rotate the waitpoint HMAC secret on the server.

Promotes the currently-installed kid to previous_kid (accepted for the server’s configured FF_WAITPOINT_HMAC_GRACE_MS window) and installs new_secret_hex under new_kid as the new current. Fans out across every execution partition. Idempotent: re-running with the same (new_kid, new_secret_hex) converges.

The server returns 200 if at least one partition rotated OR at least one partition was already rotating under a concurrent request. See RotateWaitpointSecretResponse fields for the breakdown.

§Errors
  • SdkError::AdminApi — non-2xx response (400 invalid input, 401 missing/bad bearer, 429 concurrent rotate, 500 all partitions failed, 504 server-side timeout).
  • SdkError::Http — transport error (connect, body decode, client-side timeout).
§Retry semantics

Rotation is idempotent on the same (new_kid, new_secret_hex) so retries are SAFE even on 504s or partial failures.

Trait Implementations§

Source§

impl Clone for FlowFabricAdminClient

Source§

fn clone(&self) -> FlowFabricAdminClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FlowFabricAdminClient

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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> 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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