mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 11:57:44 +08:00
This change adds the /ipfs/bitswap/1.1.0 protocol. The new protocol adds a 'payload' field to the protobuf message and deprecates the existing 'blocks' field. The 'payload' field is an array of pairs of cid prefixes and block data. The cid prefixes are used to ensure the correct codecs and hash functions are used to handle the block on the receiving end. License: MIT Signed-off-by: Jeromy <why@ipfs.io>
29 lines
719 B
Go
29 lines
719 B
Go
// package exchange defines the IPFS Exchange interface
|
|
package exchange
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
blocks "github.com/ipfs/go-ipfs/blocks"
|
|
|
|
cid "gx/ipfs/QmXUuRadqDq5BuFWzVU6VuKaSjTcNm1gNCtLvvP1TJCW4z/go-cid"
|
|
)
|
|
|
|
// Any type that implements exchange.Interface may be used as an IPFS block
|
|
// exchange protocol.
|
|
type Interface interface { // type Exchanger interface
|
|
// GetBlock returns the block associated with a given key.
|
|
GetBlock(context.Context, *cid.Cid) (blocks.Block, error)
|
|
|
|
GetBlocks(context.Context, []*cid.Cid) (<-chan blocks.Block, error)
|
|
|
|
// TODO Should callers be concerned with whether the block was made
|
|
// available on the network?
|
|
HasBlock(blocks.Block) error
|
|
|
|
IsOnline() bool
|
|
|
|
io.Closer
|
|
}
|