Struct mz_persist_client::schema::SchemaCache
source · pub(crate) struct SchemaCache<K: Codec, V: Codec, T, D> {
maps: Arc<SchemaCacheMaps<K, V>>,
applier: Applier<K, V, T, D>,
key_migration_by_ids: MigrationCacheMap,
val_migration_by_ids: MigrationCacheMap,
}
Expand description
A cache of decoded schemas and schema migrations.
The decoded schemas are a cache of the registry in state, and so are shared process-wide.
On the other hand, the migrations have an N^2 problem and so are per-handle. This also seems reasonable because for any given write handle, the write schema will be the same for all migration entries, and ditto for read handle and read schema.
Fields§
§maps: Arc<SchemaCacheMaps<K, V>>
§applier: Applier<K, V, T, D>
§key_migration_by_ids: MigrationCacheMap
§val_migration_by_ids: MigrationCacheMap
Implementations§
source§impl<K, V, T, D> SchemaCache<K, V, T, D>
impl<K, V, T, D> SchemaCache<K, V, T, D>
pub fn new( maps: Arc<SchemaCacheMaps<K, V>>, applier: Applier<K, V, T, D>, ) -> Self
async fn schemas(&self, id: &SchemaId) -> Option<Schemas<K, V>>
fn key_migration( &mut self, write: &Schemas<K, V>, read: &Schemas<K, V>, ) -> Option<Arc<Migration>>
fn val_migration( &mut self, write: &Schemas<K, V>, read: &Schemas<K, V>, ) -> Option<Arc<Migration>>
fn migration<C: Codec>(write: &C::Schema, read: &C::Schema) -> Option<Migration>
async fn get_or_try_init<MK: Clone + Ord, MV: PartialEq + Debug>( &self, map: &SchemaCacheMap<MK, MV>, key: &MK, f: impl Fn(&BTreeMap<SchemaId, EncodedSchemas>) -> Option<MV>, ) -> Option<Arc<MV>>
Trait Implementations§
Auto Trait Implementations§
impl<K, V, T, D> Freeze for SchemaCache<K, V, T, D>
impl<K, V, T, D> !RefUnwindSafe for SchemaCache<K, V, T, D>
impl<K, V, T, D> Send for SchemaCache<K, V, T, D>
impl<K, V, T, D> Sync for SchemaCache<K, V, T, D>
impl<K, V, T, D> Unpin for SchemaCache<K, V, T, D>
impl<K, V, T, D> !UnwindSafe for SchemaCache<K, V, T, D>
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
Wrap the input message
T
in a tonic::Request
Creates a shared type from an unshared type.
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
The method of
std::ops::AddAssign
, for types that do not implement AddAssign
.