1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 03:19:47 +08:00
Files
kubo/exchange/interface.go
Jeromy 53d47669da bubble up go-datastore deps
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-11-28 22:29:38 -08:00

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/QmcTcsTvfaeEBRFo1TkFgT8sRmgi1n1LTZpecfVP8fzpGD/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
}