Store

Trait Store 

Source
pub trait Store: Send + Sync {
    type Error: Error + Send + Sync + 'static;

Show 23 methods // Required methods fn events(&self) -> &dyn EmitterInterface; fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn address(&self) -> &dyn Address; fn index(&self) -> Box<dyn StoreIndex<Error = Self::Error> + Send + Sync>; fn store_type(&self) -> &str; fn replication_status(&self) -> ReplicationInfo; fn replicator(&self) -> Option<Arc<Replicator>>; fn cache(&self) -> Arc<dyn Datastore>; fn drop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load<'life0, 'async_trait>( &'life0 mut self, amount: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync<'life0, 'async_trait>( &'life0 mut self, heads: Vec<Entry>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_more_from<'life0, 'async_trait>( &'life0 mut self, amount: u64, entries: Vec<Entry>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_from_snapshot<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn op_log(&self) -> Arc<RwLock<Log>> ; fn ipfs(&self) -> Arc<IpfsClient>; fn db_name(&self) -> &str; fn identity(&self) -> &Identity; fn access_controller(&self) -> &dyn AccessController; fn add_operation<'life0, 'async_trait>( &'life0 mut self, op: Operation, on_progress_callback: Option<ProgressCallback>, ) -> Pin<Box<dyn Future<Output = Result<Entry, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn span(&self) -> Arc<Span>; fn tracer(&self) -> Arc<TracerWrapper>; fn event_bus(&self) -> Arc<EventBus>; fn as_any(&self) -> &dyn Any;
}
Expand description

Define as operações comuns a todos os tipos de stores.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn events(&self) -> &dyn EmitterInterface

👎Deprecated: use event_bus() instead
Source

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fecha a store e libera seus recursos. Modificado para aceitar &self em vez de &mut self para compatibilidade com Arc

Source

fn address(&self) -> &dyn Address

Retorna o endereço da store.

Source

fn index(&self) -> Box<dyn StoreIndex<Error = Self::Error> + Send + Sync>

Retorna o índice da store, que mantém o estado atual dos dados. Retorna Box para evitar problemas de lifetime com RwLock

Source

fn store_type(&self) -> &str

Retorna o tipo da store como uma string (ex: “eventlog”, “kvstore”).

Source

fn replication_status(&self) -> ReplicationInfo

Retorna o status atual da replicação.

Source

fn replicator(&self) -> Option<Arc<Replicator>>

Retorna o replicador responsável pela sincronização de dados.

Source

fn cache(&self) -> Arc<dyn Datastore>

Retorna o cache da store.

Source

fn drop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove todo o conteúdo local da store.

Source

fn load<'life0, 'async_trait>( &'life0 mut self, amount: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Carrega as amount entradas mais recentes da rede.

Source

fn sync<'life0, 'async_trait>( &'life0 mut self, heads: Vec<Entry>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sincroniza a store com uma lista de heads (entradas mais recentes) de outro par.

Source

fn load_more_from<'life0, 'async_trait>( &'life0 mut self, amount: u64, entries: Vec<Entry>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Carrega mais entradas a partir de um conjunto de CIDs conhecidos.

Source

fn load_from_snapshot<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Carrega o conteúdo da store a partir de um snapshot.

Source

fn op_log(&self) -> Arc<RwLock<Log>>

Retorna o log de operações (OpLog) subjacente. Modificado para retornar Arc para evitar problemas de lifetime

Source

fn ipfs(&self) -> Arc<IpfsClient>

Retorna a instância da API do IPFS.

Source

fn db_name(&self) -> &str

Retorna o nome do banco de dados.

Source

fn identity(&self) -> &Identity

Retorna a identidade usada pela store.

Source

fn access_controller(&self) -> &dyn AccessController

Retorna o controlador de acesso da store.

Source

fn add_operation<'life0, 'async_trait>( &'life0 mut self, op: Operation, on_progress_callback: Option<ProgressCallback>, ) -> Pin<Box<dyn Future<Output = Result<Entry, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Adiciona uma nova operação à store.

Source

fn span(&self) -> Arc<Span>

Retorna o span. Modificado para retornar Arc para evitar problemas de lifetime

Source

fn tracer(&self) -> Arc<TracerWrapper>

Retorna o tracer para telemetria.

Source

fn event_bus(&self) -> Arc<EventBus>

Retorna o barramento de eventos.

Source

fn as_any(&self) -> &dyn Any

Método auxiliar para downcast

Implementors§

Source§

impl Store for KeyValueStoreAdapter

Source§

impl Store for KeyValueStoreBoxWrapper

Source§

impl Store for BaseStore

Implementação do trait Store para BaseStore

Esta implementação torna BaseStore compatível com a interface Store, permitindo que seja usada em qualquer contexto que espere uma Store.

Source§

impl Store for GuardianDBDocumentStore

Source§

impl Store for GuardianDBEventLogStore

Source§

impl Store for GuardianDBKeyValue