pub trait IpfsBackend:
Send
+ Sync
+ 'static {
Show 18 methods
// Required methods
fn add<'life0, 'async_trait>(
&'life0 self,
data: Pin<Box<dyn AsyncRead + Send>>,
) -> Pin<Box<dyn Future<Output = Result<AddResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn cat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn pin_add<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn pin_rm<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn pin_ls<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PinInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<NodeInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn dht_find_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn repo_stat<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RepoStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VersionInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn block_get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn block_put<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn block_stat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<BlockStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn backend_type(&self) -> BackendType;
fn is_online<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BackendMetrics>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait principal para backends IPFS intercambiáveis
Define a interface comum que todos os backends devem implementar, garantindo compatibilidade total independentemente da implementação subjacente.
Required Methods§
Sourcefn add<'life0, 'async_trait>(
&'life0 self,
data: Pin<Box<dyn AsyncRead + Send>>,
) -> Pin<Box<dyn Future<Output = Result<AddResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add<'life0, 'async_trait>(
&'life0 self,
data: Pin<Box<dyn AsyncRead + Send>>,
) -> Pin<Box<dyn Future<Output = Result<AddResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn cat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn pin_add<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pin_add<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fixa um objeto no storage local (evita garbage collection)
§Argumentos
cid- CID do objeto a ser fixado
Sourcefn pin_rm<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pin_rm<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove fixação de um objeto (permite garbage collection)
§Argumentos
cid- CID do objeto a ser desfixado
Sourcefn pin_ls<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PinInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pin_ls<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PinInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<NodeInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<NodeInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn dht_find_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dht_find_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn repo_stat<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RepoStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn repo_stat<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RepoStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Obtém estatísticas do repositório local
§Retorna
Estatísticas incluindo tamanho, número de objetos, etc.
Sourcefn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VersionInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VersionInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn block_get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn block_get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn block_put<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block_put<'life0, 'async_trait>(
&'life0 self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn block_stat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<BlockStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn block_stat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<BlockStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn backend_type(&self) -> BackendType
fn backend_type(&self) -> BackendType
Retorna o tipo/nome do backend
Sourcefn is_online<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_online<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Verifica se o backend está online e operacional
Sourcefn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BackendMetrics>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BackendMetrics>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Obtém métricas de performance do backend
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executa health check completo do backend