SQUASHME: some cleanup
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Sep 7, 2016 at 15:16 UTC
29c1872e1d0bb3ca6d8a680cb052005410ee6184
2 files changed
+6
-9
blockservice/blockservice.go
-9
@@ -119,7 +119,6 @@ func (s *BlockService) AddObjects(bs []Object) ([]*cid.Cid, error) {
119
func (s *BlockService) GetBlock(ctx context.Context, c *cid.Cid) (blocks.Block, error) {
120
log.Debugf("BlockService GetBlock: '%s'", c)
121
122
- // TODO: blockstore shouldnt care about Cids, need an easier way to strip the abstraction
122
block, err := s.Blockstore.Get(key.Key(c.Hash()))
123
if err == nil {
124
return block, nil
@@ -200,11 +199,3 @@ func (s *BlockService) Close() error {
199
log.Debug("blockservice is shutting down...")
200
return s.Exchange.Close()
201
}
203
-
204
-type RawBlockObject struct {
205
- blocks.Block
206
-}
207
-
208
-func (rob *RawBlockObject) Cid() *cid.Cid {
209
- return cid.NewCidV0(rob.Block.Multihash())
210
-}
merkledag/merkledag.go
+6
@@ -119,6 +119,12 @@ type NodeOption struct {
119
Err error
120
}
121
122
+// TODO: this is a mid-term hack to get around the fact that blocks don't
123
+// have full CIDs and potentially (though we don't know of any such scenario)
124
+// may have the same block with multiple different encodings.
125
+// We have discussed the possiblity of using CIDs as datastore keys
126
+// in the future. This would be a much larger changeset than i want to make
127
+// right now.
128
func cidsToKeyMapping(cids []*cid.Cid) map[key.Key]*cid.Cid {
129
mapping := make(map[key.Key]*cid.Cid)
130
for _, c := range cids {