Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Send + Sync {
Show 17 methods // Required methods fn store_schema<'life0, 'async_trait>( &'life0 self, schema: Schema, ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaId>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_schema<'life0, 'async_trait>( &'life0 self, id: SchemaId, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<Schema>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_schema_by_fingerprint<'life0, 'life1, 'async_trait>( &'life0 self, fingerprint: &'life1 str, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<Schema>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn register_subject_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, schema_id: SchemaId, ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaVersion>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_versions<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<u32>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_subject_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<SubjectVersion>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_latest_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<SubjectVersion>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_subjects<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<Subject>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, permanent: bool, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<u32>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, permanent: bool, ) -> Pin<Box<dyn Future<Output = SchemaResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn next_schema_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaId>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subject_exists<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_version_state<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, state: VersionState, ) -> Pin<Box<dyn Future<Output = SchemaResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_version_state<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, ) -> Pin<Box<dyn Future<Output = SchemaResult<VersionState>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_deleted_subjects<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<Subject>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn undelete_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<u32>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn register_schema_atomic<'life0, 'life1, 'async_trait>( &'life0 self, schema: Schema, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<(SchemaId, SchemaVersion)>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

Storage backend trait for schema persistence

Required Methods§

Source

fn store_schema<'life0, 'async_trait>( &'life0 self, schema: Schema, ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Store a schema and return its ID

Source

fn get_schema<'life0, 'async_trait>( &'life0 self, id: SchemaId, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<Schema>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get schema by ID

Source

fn get_schema_by_fingerprint<'life0, 'life1, 'async_trait>( &'life0 self, fingerprint: &'life1 str, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<Schema>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get schema by fingerprint (for deduplication)

Source

fn register_subject_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, schema_id: SchemaId, ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaVersion>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register a schema under a subject

Source

fn get_versions<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<u32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all versions for a subject

Source

fn get_subject_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<SubjectVersion>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a specific version of a subject

Source

fn get_latest_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<Option<SubjectVersion>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the latest version of a subject

Source

fn list_subjects<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<Subject>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all subjects

Source

fn delete_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, permanent: bool, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<u32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a subject (soft delete by default)

Source

fn delete_version<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, permanent: bool, ) -> Pin<Box<dyn Future<Output = SchemaResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a specific version

Source

fn next_schema_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the next schema ID

Source

fn subject_exists<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a subject exists

Source

fn set_version_state<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, state: VersionState, ) -> Pin<Box<dyn Future<Output = SchemaResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the state of a version (enabled/deprecated/disabled)

Source

fn get_version_state<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, version: SchemaVersion, ) -> Pin<Box<dyn Future<Output = SchemaResult<VersionState>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the state of a version

Source

fn list_deleted_subjects<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<Subject>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List deleted subjects (for recovery)

Source

fn undelete_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<u32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Undelete a soft-deleted subject

Provided Methods§

Source

fn register_schema_atomic<'life0, 'life1, 'async_trait>( &'life0 self, schema: Schema, subject: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = SchemaResult<(SchemaId, SchemaVersion)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomically register a schema under a subject in a single write.

Combines ID allocation, schema storage, and subject-version registration into one durable write to prevent partial state from crashes between separate writes. Default implementation allocates an ID via next_schema_id, then stores the schema and registers the version (suitable for in-memory backends where atomicity is guaranteed).

Implementors§