jbenet/go-ipfs — pull request #85 by perfmode (2014-09-16 10:44:32+00:00)
Title: feat(blockstore): implement blockstore

This PR adds a simple `datastore` wrapper so we don't need to repeat boilerplate pack/unpacking in places where the datastore is used.

```
type Blockstore interface {
Get(u.Key) (*blocks.Block, error)
Put(blocks.Block) error
}
```

> How is this different from the `blockservice`?

The `blockservice` falls back to querying the `exchange` (bitswap) when values aren't present in the `blockstore`.

> Where does this belong?

I'm not so sure myself. Either as a top-level package or as as `util/blockstore`. Due to circular dependencies there are a number of places where it certainly cannot go (`dht`, `bitswap`, `blockservice`, etc.)