pub struct RegistryService { /* private fields */ }Expand description
StringRegistry service over an in-memory or RocksDB dictionary.
Implementations§
Source§impl RegistryService
impl RegistryService
Sourcepub fn new(shard_count: usize) -> Self
pub fn new(shard_count: usize) -> Self
In-memory registry with shard_count in-process logical shards.
Sourcepub fn open_rocksdb(
path: impl AsRef<Path>,
tuning: RocksDbTuning,
) -> Result<Self, RegistryError>
pub fn open_rocksdb( path: impl AsRef<Path>, tuning: RocksDbTuning, ) -> Result<Self, RegistryError>
RocksDB dictionary at path (created if missing).
Sourcepub fn with_warm_state(self, warm: Arc<WarmState>) -> Self
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.
Sourcepub fn with_blobs(self, blobs_root: &Path) -> Result<Self, RegistryError>
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).
Sourcepub fn with_blobs_memory(self) -> Result<Self, RegistryError>
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.
Sourcepub fn blob_store(&self) -> Option<&BlobStore>
pub fn blob_store(&self) -> Option<&BlobStore>
Blob store when one is attached.
Sourcepub fn put_blob(
&self,
blob_id: StrHash,
payload: &[u8],
) -> Result<u64, RegistryError>
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).
Sourcepub fn put_blobs(
&self,
blobs: &[(StrHash, Arc<[u8]>)],
) -> Result<(), RegistryError>
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.
Sourcepub fn get_blobs(
&self,
ids: &[StrHash],
) -> Result<Vec<Option<Vec<u8>>>, RegistryError>
pub fn get_blobs( &self, ids: &[StrHash], ) -> Result<Vec<Option<Vec<u8>>>, RegistryError>
Batched blob get: payloads positionally aligned with ids
(None = miss).
Sourcepub fn with_trace(self, enabled: bool) -> Self
pub fn with_trace(self, enabled: bool) -> Self
Enable (--trace) stderr timing lines for streamed resolves.
Sourcepub fn with_identity(self, identity: RegistryIdentity) -> Self
pub fn with_identity(self, identity: RegistryIdentity) -> Self
Set the identity Describe reports.
Sourcepub fn describe(&self) -> Result<RegistryDescribeResponse, RegistryError>
pub fn describe(&self) -> Result<RegistryDescribeResponse, RegistryError>
Identity + LSM snapshot for Describe.
Sourcepub fn shard_count(&self) -> Result<usize, RegistryError>
pub fn shard_count(&self) -> Result<usize, RegistryError>
Number of logical shards behind this process (always 1 for RocksDB).
Sourcepub fn register(
&self,
entries: impl IntoIterator<Item = (StrHash, String)>,
) -> Result<u64, RegistryError>
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.
Sourcepub fn resolve(
&self,
hashes: &[StrHash],
) -> Result<Vec<Option<String>>, RegistryError>
pub fn resolve( &self, hashes: &[StrHash], ) -> Result<Vec<Option<String>>, RegistryError>
Resolve hashes positionally; None marks a hash this registry lacks.
Sourcepub fn flush_memtables(&self) -> Result<(), RegistryError>
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.
Sourcepub fn compact_range(&self) -> Result<(), RegistryError>
pub fn compact_range(&self) -> Result<(), RegistryError>
Compact the string registry CF and the blob index (no-op on the in-memory backends).
Sourcepub fn warm_block_cache(
&self,
fill_fraction: f64,
) -> Result<WarmBlockCacheStats, RegistryError>
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
impl Clone for RegistryService
Source§fn clone(&self) -> RegistryService
fn clone(&self) -> RegistryService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegistryService
impl Debug for RegistryService
Source§impl Default for RegistryService
impl Default for RegistryService
Source§impl StringRegistry for RegistryService
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,
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,
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,
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,
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>>
type ResolveStringsStream = ReceiverStream<Result<ResolveStringsResponse, Status>>
Source§type GetBlobsStream = ReceiverStream<Result<GetBlobsResponse, Status>>
type GetBlobsStream = ReceiverStream<Result<GetBlobsResponse, Status>>
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,
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,
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,
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,
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§
impl Freeze for RegistryService
impl RefUnwindSafe for RegistryService
impl Send for RegistryService
impl Sync for RegistryService
impl Unpin for RegistryService
impl UnsafeUnpin for RegistryService
impl UnwindSafe for RegistryService
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].