File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import (
13
13
cbg "github.com/whyrusleeping/cbor-gen"
14
14
)
15
15
16
+ const DefaultMultihash = uint64 (mh .BLAKE2B_MIN + 31 )
17
+
16
18
// IpldStore wraps a Blockstore and provides an interface for storing and retrieving CBOR encoded data.
17
19
type IpldStore interface {
18
20
Get (ctx context.Context , c cid.Cid , out interface {}) error
@@ -41,6 +43,8 @@ type BasicIpldStore struct {
41
43
Viewer IpldBlockstoreViewer
42
44
43
45
Atlas * atlas.Atlas
46
+
47
+ DefaultMultihash uint64
44
48
}
45
49
46
50
var _ IpldStore = & BasicIpldStore {}
@@ -89,7 +93,11 @@ type cidProvider interface {
89
93
90
94
// Put marshals and writes content `v` to the backing blockstore returning its CID.
91
95
func (s * BasicIpldStore ) Put (ctx context.Context , v interface {}) (cid.Cid , error ) {
92
- mhType := uint64 (mh .BLAKE2B_MIN + 31 )
96
+ mhType := DefaultMultihash
97
+ if s .DefaultMultihash != 0 {
98
+ mhType = s .DefaultMultihash
99
+ }
100
+
93
101
mhLen := - 1
94
102
codec := uint64 (cid .DagCBOR )
95
103
You can’t perform that action at this time.
0 commit comments