interface.go 588 Bytes
Newer Older
Brian Tiger Chow's avatar
Brian Tiger Chow committed
1
package exchange
Brian Tiger Chow's avatar
Brian Tiger Chow committed
2 3

import (
4
	context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
Brian Tiger Chow's avatar
Brian Tiger Chow committed
5 6 7 8 9

	blocks "github.com/jbenet/go-ipfs/blocks"
	u "github.com/jbenet/go-ipfs/util"
)

10 11 12
// Any type that implements exchange.Interface may be used as an IPFS block
// exchange protocol.
type Interface interface {
Brian Tiger Chow's avatar
Brian Tiger Chow committed
13 14

	// Block returns the block associated with a given key.
15
	Block(context.Context, u.Key) (*blocks.Block, error)
Brian Tiger Chow's avatar
Brian Tiger Chow committed
16

17 18 19
	// TODO Should callers be concerned with whether the block was made
	// available on the network?
	HasBlock(context.Context, blocks.Block) error
Brian Tiger Chow's avatar
Brian Tiger Chow committed
20
}