Skip to main content

RegistryService

Struct RegistryService 

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

StringRegistry service over an in-memory or RocksDB dictionary.

Implementations§

Source§

impl RegistryService

Source

pub fn new(shard_count: usize) -> Self

In-memory registry with shard_count in-process logical shards.

Source

pub fn open_rocksdb( path: impl AsRef<Path>, tuning: RocksDbTuning, ) -> Result<Self, RegistryError>

RocksDB dictionary at path (created if missing).

Source

pub fn with_warm_state(self, warm: Arc<WarmState>) -> Self

Hand in the startup cache-warm tracker. The Health RPC reports warm_ready = false (plus the pending walk names) until every tracked walk completes or outlives the tracker’s max wait.

Source

pub fn with_blobs(self, blobs_root: &Path) -> Result<Self, RegistryError>

Attach the content-addressed blob store rooted at blobs_root (typically {data_dir}/{repository}/blobs).

Source

pub fn with_blobs_memory(self) -> Result<Self, RegistryError>

Attach an in-memory content-addressed blob store.

Used by the default in-memory registry mode (no data dir) so geo writes work: payloads live until process shutdown, consistent with in-memory storage semantics.

Source

pub fn blob_store(&self) -> Option<&BlobStore>

Blob store when one is attached.

Source

pub fn put_blob( &self, blob_id: StrHash, payload: &[u8], ) -> Result<u64, RegistryError>

Store one fully assembled blob (the attached BlobStore validates the content hash against the payload before writing anything).

Source

pub fn put_blobs( &self, blobs: &[(StrHash, Arc<[u8]>)], ) -> Result<(), RegistryError>

Batched, all-or-nothing blob write — the shared unit behind the unary PutBlobs RPC and its in-process twins (waratah standalone local client, geo tests).

Every payload must be non-empty, is size-checked, and is content-hash-validated before any index write. Blobs already present are skipped; new blobs are committed in one atomic index batch, so a failure leaves no partial entries. Content addressing makes a whole-batch retry idempotent.

BlobStore enforces MAX_BLOB_BYTES as a backstop; the unary PutBlobs request is already bounded by the gRPC message ceiling.

Source

pub fn get_blobs( &self, ids: &[StrHash], ) -> Result<Vec<Option<Vec<u8>>>, RegistryError>

Batched blob get: payloads positionally aligned with ids (None = miss).

Source

pub fn with_trace(self, enabled: bool) -> Self

Enable (--trace) stderr timing lines for streamed resolves.

Source

pub fn with_identity(self, identity: RegistryIdentity) -> Self

Set the identity Describe reports.

Source

pub fn describe(&self) -> Result<RegistryDescribeResponse, RegistryError>

Identity + LSM snapshot for Describe.

Source

pub fn shard_count(&self) -> Result<usize, RegistryError>

Number of logical shards behind this process (always 1 for RocksDB).

Source

pub fn register( &self, entries: impl IntoIterator<Item = (StrHash, String)>, ) -> Result<u64, RegistryError>

Register (hash, raw) pairs, returning how many entries were written.

Rejects any string over MAX_REGISTERED_STRING_BYTES before writing, so a batch either lands whole or nothing oversized is stored.

Source

pub fn resolve( &self, hashes: &[StrHash], ) -> Result<Vec<Option<String>>, RegistryError>

Resolve hashes positionally; None marks a hash this registry lacks.

Source

pub fn flush_memtables(&self) -> Result<(), RegistryError>

Flush MemTables: the string dictionary plus the blob index.

The in-memory backend and the in-memory blob variant are no-ops.

Source

pub fn compact_range(&self) -> Result<(), RegistryError>

Compact the string registry CF and the blob index (no-op on the in-memory backends).

Source

pub fn warm_block_cache( &self, fill_fraction: f64, ) -> Result<WarmBlockCacheStats, RegistryError>

Warm the registry’s block cache (see waratah_storage::Registry::warm_block_cache); no-op on the in-memory backend. Called from the registry process when WARATAH_WARM_CACHE is set.

Trait Implementations§

Source§

impl Clone for RegistryService

Source§

fn clone(&self) -> RegistryService

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 RegistryService

Source§

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

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

impl Default for RegistryService

Source§

fn default() -> Self

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

impl StringRegistry for RegistryService

Source§

fn put_blob_chunks<'life0, 'async_trait>( &'life0 self, request: Request<Streaming<PutBlobRequest>>, ) -> Pin<Box<dyn Future<Output = Result<Response<PutBlobResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Client-streaming blob put (PutBlobChunks): assemble chunks and store the payload through the attached blob store (two-tier index/segments, or in-memory), which validates the content hash against the assembled bytes before writing anything.

One call carries ONE blob (chunks repeat under the frame budget); a later PutBlobChunks of the same id is a no-op because the address is the commitment. Assembly is bounded by MAX_BLOB_BYTES. Batched puts of whole (already message-sized) blobs use PutBlobs instead.

Source§

fn put_blobs<'life0, 'async_trait>( &'life0 self, request: Request<PutBlobsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<PutBlobsResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unary batched blob put: whole blobs (each already under the message ceiling by the caller’s framing) in one round trip. All-or-nothing — see the inherent RegistryService::put_blobs for the validation and atomic-write contract.

Source§

fn get_blobs<'life0, 'async_trait>( &'life0 self, request: Request<GetBlobsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetBlobsStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Batched server-streaming blob get: chunks of every requested id that hits, packed under the frame budget by the side that knows payload sizes. Misses send nothing — the stream simply ends.

Source§

fn resolve_strings<'life0, 'async_trait>( &'life0 self, request: Request<ResolveStringsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ResolveStringsStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stream resolved entries as byte-budgeted frames.

Compute cannot predict response sizes (requests carry only 16-byte hashes), so the registry — the side that knows the string sizes — packs each frame with as many entries as fit RESOLVE_FRAME_BUDGET_BYTES before emitting it. Frames carry consecutive runs in request order, so the concatenation of all frames’ values is positionally aligned exactly like the former unary response. Resolution is pipelined per [RESOLVE_SUBBATCH] chunk with exactly one outstanding walk: the task awaits the current chunk’s lookup, starts the next chunk’s lookup, then packs the current results — so the next lookup runs during frame packing and channel sends, while two lookups never overlap (interleaved seek streams thrash disk locality). The bounded channel backpressures packing against a slow consumer.

Source§

type ResolveStringsStream = ReceiverStream<Result<ResolveStringsResponse, Status>>

Server streaming response type for the ResolveStrings method.
Source§

type GetBlobsStream = ReceiverStream<Result<GetBlobsResponse, Status>>

Server streaming response type for the GetBlobs method.
Source§

fn register_strings<'life0, 'async_trait>( &'life0 self, request: Request<RegisterStringsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<RegisterStringsResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn flush_memtables<'life0, 'async_trait>( &'life0 self, _request: Request<FlushMemtablesRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<FlushMemtablesResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn compact_range<'life0, 'async_trait>( &'life0 self, _request: Request<CompactRangeRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<CompactRangeResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn health<'life0, 'async_trait>( &'life0 self, _request: Request<HealthRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<HealthResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn describe<'life0, 'async_trait>( &'life0 self, _request: Request<RegistryDescribeRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<RegistryDescribeResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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.

§

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.

§

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].
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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,