mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-07 09:17:49 +08:00
SQUASHME: some cleanup
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
parent
c8fe495934
commit
29c1872e1d
@ -119,7 +119,6 @@ func (s *BlockService) AddObjects(bs []Object) ([]*cid.Cid, error) {
|
||||
func (s *BlockService) GetBlock(ctx context.Context, c *cid.Cid) (blocks.Block, error) {
|
||||
log.Debugf("BlockService GetBlock: '%s'", c)
|
||||
|
||||
// TODO: blockstore shouldnt care about Cids, need an easier way to strip the abstraction
|
||||
block, err := s.Blockstore.Get(key.Key(c.Hash()))
|
||||
if err == nil {
|
||||
return block, nil
|
||||
@ -200,11 +199,3 @@ func (s *BlockService) Close() error {
|
||||
log.Debug("blockservice is shutting down...")
|
||||
return s.Exchange.Close()
|
||||
}
|
||||
|
||||
type RawBlockObject struct {
|
||||
blocks.Block
|
||||
}
|
||||
|
||||
func (rob *RawBlockObject) Cid() *cid.Cid {
|
||||
return cid.NewCidV0(rob.Block.Multihash())
|
||||
}
|
||||
|
||||
@ -119,6 +119,12 @@ type NodeOption struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
// TODO: this is a mid-term hack to get around the fact that blocks don't
|
||||
// have full CIDs and potentially (though we don't know of any such scenario)
|
||||
// may have the same block with multiple different encodings.
|
||||
// We have discussed the possiblity of using CIDs as datastore keys
|
||||
// in the future. This would be a much larger changeset than i want to make
|
||||
// right now.
|
||||
func cidsToKeyMapping(cids []*cid.Cid) map[key.Key]*cid.Cid {
|
||||
mapping := make(map[key.Key]*cid.Cid)
|
||||
for _, c := range cids {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user