func (bs *blockstore) Get(k key.Key) (*blocks.Block, error) { maybeData, err := bs.datastore.Get(k.DsKey()) if err == ds.ErrNotFound { return nil, ErrNotFound } if err != nil { return nil, err } bdata, ok := maybeData.([]byte) if !ok { return nil, ValueTypeMismatch } return blocks.NewBlockWithHash(bdata, mh.Multihash(k)) }
func (s *blockstore) DeleteBlock(k key.Key) error { return s.datastore.Delete(k.DsKey()) }
func (bs *blockstore) Has(k key.Key) (bool, error) { return bs.datastore.Has(k.DsKey()) }