View Source MyspaceIPFS.Bitswap (Myspace IPFS v0.2.0-alpha.1)

MyspaceIPFS.Bitswap is where the bitswap commands of the IPFS API reside.

Link to this section Summary

Types

A struct that represents the ledger for a peer in the bitswap network.

A struct that represents the stats for the bitswap network.

A struct that represents the wantlist for a peer in the bitswap network.

Functions

Get the current bitswap ledger for a given peer.

Reprovide blocks to the network.

Show some diagnostic information on the bitswap agent.

Get the current bitswap wantlist.

Get the current bitswap wantlist for a peer.

Link to this section Types

@type ledger() :: %MyspaceIPFS.BitswapLedger{
  exchanged: pos_integer(),
  peer: MyspaceIPFS.peer_id(),
  recv: pos_integer(),
  sent: pos_integer(),
  value: float()
}

A struct that represents the ledger for a peer in the bitswap network.

@type stat() :: %MyspaceIPFS.BitswapStat{
  blocks_received: non_neg_integer(),
  blocks_sent: non_neg_integer(),
  data_received: non_neg_integer(),
  data_sent: non_neg_integer(),
  dup_blks_received: non_neg_integer(),
  dup_data_received: non_neg_integer(),
  messages_received: list(),
  peers: [MyspaceIPFS.peer_id()],
  provide_buf_len: integer(),
  wantlist: [MyspaceIPFS.slash_cid()]
}

A struct that represents the stats for the bitswap network.

@type wantlist() :: %MyspaceIPFS.BitswapWantList{keys: list() | nil}

A struct that represents the wantlist for a peer in the bitswap network.

Link to this section Functions

@spec ledger(MyspaceIPFS.peer_id()) ::
  {:ok, [ledger()]} | MyspaceIPFS.Api.error_response()

Get the current bitswap ledger for a given peer.

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-bitswap-ledger

parameters

Parameters

peer - The peer ID to get the ledger for.

Link to this function

reprovide(timeout \\ 5000)

View Source
@spec reprovide(timeout()) :: :ok

Reprovide blocks to the network.

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-bitswap-reprovide

NB! I am unsure what is supposed to happen here. Mostly I get no reply. I haven't been able to find any documentation on this endpoint.

@spec stat(list()) :: {:ok, [stat()]} | MyspaceIPFS.Api.error_response()

Show some diagnostic information on the bitswap agent.

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-bitswap-stat

@spec wantlist() :: {:ok, wantlist()} | MyspaceIPFS.Api.error_response()

Get the current bitswap wantlist.

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-bitswap-wantlist

@spec wantlist(MyspaceIPFS.peer_id()) ::
  {:ok, wantlist()} | MyspaceIPFS.Api.error_response()

Get the current bitswap wantlist for a peer.

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-bitswap-wantlist

parameters

Parameters

peer - The peer ID to get the wantlist for. Optional.