kubo/exchange/interface.go
Thomas Gardner aaa6569f2c trivial: various superficial fixes
misc/completion/ipfs-completion.bash: add `ipfs stats` to BASH completion

core/commands/mount_unix.go: ensure error is not nil before printing it

contribute.md: fix bibliography indexing in example

core/commands/swarm.go: change tabs to spaces in USAGE message

*: 80-column readability improvements

License: MIT
Signed-off-by: Thomas Gardner <tmg@fastmail.com>
2016-02-03 15:46:28 +10:00

26 lines
745 B
Go

// package exchange defines the IPFS Exchange interface
package exchange
import (
"io"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
blocks "github.com/ipfs/go-ipfs/blocks"
key "github.com/ipfs/go-ipfs/blocks/key"
)
// 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
}