1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 14:34:24 +08:00
Files
kubo/exchange/interface.go
Jeromy Johnson 5a0b8023be Merge pull request #2256 from ipfs/feat/gx-libp2p
vendor libp2p with gx
2016-02-05 16:52:02 -08:00

26 lines
744 B
Go

// package exchange defines the IPFS Exchange interface
package exchange
import (
"io"
blocks "github.com/ipfs/go-ipfs/blocks"
key "github.com/ipfs/go-ipfs/blocks/key"
context "gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
)
// 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, key.Key) (*blocks.Block, error)
GetBlocks(context.Context, []key.Key) (<-chan *blocks.Block, error)
// TODO Should callers be concerned with whether the block was made
// available on the network?
HasBlock(*blocks.Block) error
io.Closer
}