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§
Required Methods§
fn events(&self) -> &dyn EmitterInterface
Sourcefn 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 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
Sourcefn index(&self) -> Box<dyn StoreIndex<Error = Self::Error> + Send + Sync>
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
Sourcefn store_type(&self) -> &str
fn store_type(&self) -> &str
Retorna o tipo da store como uma string (ex: “eventlog”, “kvstore”).
Sourcefn replication_status(&self) -> ReplicationInfo
fn replication_status(&self) -> ReplicationInfo
Retorna o status atual da replicação.
Sourcefn replicator(&self) -> Option<Arc<Replicator>>
fn replicator(&self) -> Option<Arc<Replicator>>
Retorna o replicador responsável pela sincronização de dados.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn op_log(&self) -> Arc<RwLock<Log>> ⓘ
fn op_log(&self) -> Arc<RwLock<Log>> ⓘ
Retorna o log de operações (OpLog) subjacente. Modificado para retornar Arc para evitar problemas de lifetime
Sourcefn ipfs(&self) -> Arc<IpfsClient>
fn ipfs(&self) -> Arc<IpfsClient>
Retorna a instância da API do IPFS.
Sourcefn access_controller(&self) -> &dyn AccessController
fn access_controller(&self) -> &dyn AccessController
Retorna o controlador de acesso da store.
Sourcefn 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 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.
Sourcefn span(&self) -> Arc<Span>
fn span(&self) -> Arc<Span>
Retorna o span. Modificado para retornar Arc para evitar problemas de lifetime
Sourcefn tracer(&self) -> Arc<TracerWrapper>
fn tracer(&self) -> Arc<TracerWrapper>
Retorna o tracer para telemetria.
Implementors§
Source§impl Store for KeyValueStoreAdapter
impl Store for KeyValueStoreAdapter
type Error = GuardianError
Source§impl Store for KeyValueStoreBoxWrapper
impl Store for KeyValueStoreBoxWrapper
type Error = GuardianError
Source§impl Store for BaseStore
Implementação do trait Store para BaseStore
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.