IpfsBackend

Trait IpfsBackend 

Source
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§

Source

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,

Adiciona dados ao IPFS e retorna o CID resultante

§Argumentos
  • data - Stream de dados para adicionar
§Retorna

Resposta contendo o CID e metadados do objeto adicionado

Source

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,

Recupera dados do IPFS pelo CID

§Argumentos
  • cid - Content Identifier do objeto desejado
§Retorna

Stream de dados do objeto

Source

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
Source

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
Source

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,

Lista objetos fixados

§Retorna

Lista de CIDs fixados com seus tipos

Source

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,

Conecta explicitamente a um peer

§Argumentos
  • peer - ID do peer para conectar
Source

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,

Lista peers atualmente conectados

§Retorna

Lista de informações dos peers conectados

Source

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

Obtém informações do nó local

§Retorna

Informações do nó incluindo ID, chaves públicas, endereços

Source

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,

Resolve um peer ID para seus endereços conhecidos

§Argumentos
  • peer - PeerId a ser resolvido
§Retorna

Lista de endereços multiaddr do peer

Source

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.

Source

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

Obtém versão e informações do nó IPFS

§Retorna

Informações de versão do software IPFS

Source

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,

Obtém um bloco raw pelo seu CID

§Argumentos
  • cid - CID do bloco desejado
§Retorna

Dados raw do bloco

Source

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,

Armazena dados raw como bloco

§Argumentos
  • data - Dados raw para armazenar
§Retorna

CID do bloco criado

Source

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,

Verifica se um bloco existe localmente

§Argumentos
  • cid - CID do bloco a verificar
§Retorna

true se o bloco existe localmente

Source

fn backend_type(&self) -> BackendType

Retorna o tipo/nome do backend

Source

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

Source

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

Source

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

Implementors§