pub struct ShardSpec {
pub id: String,
pub descriptor: Value,
pub size_estimate: Option<u64>,
}Expand description
One independently-processable slice of a shardable source.
The descriptor is opaque to the coordinator — only
the producing/consuming connector interprets it (e.g. {"pk_range":[0,1000]}
for a key-range split, {"prefix":"dt=2026-06-11/"} for an object split). It
must round-trip through JSON unchanged so the coordinator can persist it and
hand it back to apply_shard on the worker that
claims the shard.
Fields§
§id: StringStable identifier, unique within a run’s shard set. Also used as the
per-shard state-key suffix ({run}::{shard.id}), so it must be a valid
state-key segment (no : — see
validate_state_key).
descriptor: ValueConnector-specific, opaque shard descriptor. Persisted verbatim and
passed back to apply_shard.
size_estimate: Option<u64>Optional relative size estimate (rows / bytes / objects — the unit is the
connector’s choice, only comparisons within one run’s set matter) used
for skew-aware assignment. None when the source cannot cheaply
estimate; the coordinator then falls back to count-based balancing.
Implementations§
Source§impl ShardSpec
impl ShardSpec
Sourcepub fn whole() -> Self
pub fn whole() -> Self
The single whole-dataset shard a non-shardable source enumerates to.
Its id is "0" and its descriptor is JSON null;
apply_shard’s default ignores it, so the
source streams its entire dataset unchanged.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ShardSpec
impl<'de> Deserialize<'de> for ShardSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ShardSpec
impl StructuralPartialEq for ShardSpec
Auto Trait Implementations§
impl Freeze for ShardSpec
impl RefUnwindSafe for ShardSpec
impl Send for ShardSpec
impl Sync for ShardSpec
impl Unpin for ShardSpec
impl UnsafeUnpin for ShardSpec
impl UnwindSafe for ShardSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request