pub struct IpfsClient { /* private fields */ }Expand description
Cliente principal da API IPFS Core
Implementations§
Source§impl IpfsClient
impl IpfsClient
Sourcepub async fn new(config: ClientConfig) -> Result<Self>
pub async fn new(config: ClientConfig) -> Result<Self>
Cria uma nova instância do cliente IPFS
Sourcepub async fn development() -> Result<Self>
pub async fn development() -> Result<Self>
Cria uma instância para desenvolvimento
Sourcepub async fn production() -> Result<Self>
pub async fn production() -> Result<Self>
Cria uma instância para produção
Sourcepub async fn new_with_backend(backend: Arc<IrohBackend>) -> Result<Self>
pub async fn new_with_backend(backend: Arc<IrohBackend>) -> Result<Self>
Cria uma instância usando um backend Iroh existente
Sourcepub async fn add<R>(&self, data: R) -> Result<AddResponse>
pub async fn add<R>(&self, data: R) -> Result<AddResponse>
Adiciona dados ao IPFS usando backend Iroh
Sourcepub async fn add_bytes(&self, data: Vec<u8>) -> Result<AddResponse>
pub async fn add_bytes(&self, data: Vec<u8>) -> Result<AddResponse>
Adiciona dados de Vec
Sourcepub async fn cat(&self, path: &str) -> Result<Pin<Box<dyn AsyncRead + Send>>>
pub async fn cat(&self, path: &str) -> Result<Pin<Box<dyn AsyncRead + Send>>>
Recupera dados do IPFS pelo hash/CID usando backend Iroh
Sourcepub async fn dag_get(&self, cid: &Cid, _path: Option<&str>) -> Result<Vec<u8>>
pub async fn dag_get(&self, cid: &Cid, _path: Option<&str>) -> Result<Vec<u8>>
Recupera um objeto DAG do IPFS
Sourcepub async fn pubsub_publish(&self, topic: &str, data: &[u8]) -> Result<()>
pub async fn pubsub_publish(&self, topic: &str, data: &[u8]) -> Result<()>
Publica uma mensagem em um tópico do pubsub
Sourcepub async fn pubsub_subscribe(&self, topic: &str) -> Result<PubsubStream>
pub async fn pubsub_subscribe(&self, topic: &str) -> Result<PubsubStream>
Subscreve a um tópico do pubsub
Sourcepub async fn pubsub_peers(&self, topic: &str) -> Result<Vec<PeerId>>
pub async fn pubsub_peers(&self, topic: &str) -> Result<Vec<PeerId>>
Lista os peers conectados a um tópico do pubsub
Sourcepub async fn pubsub_topics(&self) -> Result<Vec<String>>
pub async fn pubsub_topics(&self) -> Result<Vec<String>>
Lista todos os tópicos ativos
Sourcepub async fn pubsub_unsubscribe(&self, topic: &str) -> Result<()>
pub async fn pubsub_unsubscribe(&self, topic: &str) -> Result<()>
Cancela subscrição de um tópico
Sourcepub async fn swarm_connect(&self, peer: &PeerId) -> Result<()>
pub async fn swarm_connect(&self, peer: &PeerId) -> Result<()>
Conecta a um peer específico
Sourcepub async fn swarm_peers(&self) -> Result<Vec<PeerInfo>>
pub async fn swarm_peers(&self) -> Result<Vec<PeerInfo>>
Lista todos os peers conectados ao swarm
Sourcepub async fn pin_add(&self, hash: &str, recursive: bool) -> Result<PinResponse>
pub async fn pin_add(&self, hash: &str, recursive: bool) -> Result<PinResponse>
Adiciona um objeto aos pins
Sourcepub async fn pin_rm(&self, hash: &str) -> Result<PinResponse>
pub async fn pin_rm(&self, hash: &str) -> Result<PinResponse>
Remove um objeto dos pins
Sourcepub async fn pin_ls(
&self,
pin_type_filter: Option<PinType>,
) -> Result<Vec<PinResponse>>
pub async fn pin_ls( &self, pin_type_filter: Option<PinType>, ) -> Result<Vec<PinResponse>>
Lista objetos pinned
Sourcepub fn get_channel_id(&self, other_peer: &PeerId) -> String
pub fn get_channel_id(&self, other_peer: &PeerId) -> String
Gera um ID único para canal de comunicação entre dois peers Compatível com get_channel_id do one_on_one_channel.rs
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Obtém configuração atual
Trait Implementations§
Source§impl Clone for IpfsClient
impl Clone for IpfsClient
Source§fn clone(&self) -> IpfsClient
fn clone(&self) -> IpfsClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl IpfsClientCompat for IpfsClient
impl IpfsClientCompat for IpfsClient
async fn add_compat<R>(&self, data: R) -> Result<AddResponse>
async fn cat_compat(&self, hash: &str) -> Result<Vec<u8>>
Auto Trait Implementations§
impl Freeze for IpfsClient
impl !RefUnwindSafe for IpfsClient
impl Send for IpfsClient
impl Sync for IpfsClient
impl Unpin for IpfsClient
impl !UnwindSafe for IpfsClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more