@@ -2,10 +2,10 @@ package options
2
2
3
3
// DagPutSettings is a set of DagPut options.
4
4
type DagPutSettings struct {
5
- InputEnc string
6
- Kind string
7
- Pin string
8
- Hash string
5
+ InputCodec string
6
+ StoreCodec string
7
+ Pin string
8
+ Hash string
9
9
}
10
10
11
11
// DagPutOption is a single DagPut option.
@@ -14,10 +14,10 @@ type DagPutOption func(opts *DagPutSettings) error
14
14
// DagPutOptions applies the given options to a DagPutSettings instance.
15
15
func DagPutOptions (opts ... DagPutOption ) (* DagPutSettings , error ) {
16
16
options := & DagPutSettings {
17
- InputEnc : "dag-json" ,
18
- Kind : "dag-cbor" ,
19
- Pin : "false" ,
20
- Hash : "sha2-256" ,
17
+ InputCodec : "dag-json" ,
18
+ StoreCodec : "dag-cbor" ,
19
+ Pin : "false" ,
20
+ Hash : "sha2-256" ,
21
21
}
22
22
23
23
for _ , opt := range opts {
@@ -42,20 +42,20 @@ func (dagOpts) Pin(pin string) DagPutOption {
42
42
}
43
43
}
44
44
45
- // InputEnc is an option for Dag.Put which specifies the input encoding of the
46
- // data. Default is "json", most formats/codecs support "raw ".
47
- func (dagOpts ) InputEnc ( enc string ) DagPutOption {
45
+ // InputCodec is an option for Dag.Put which specifies the input encoding of the
46
+ // data. Default is "dag- json".
47
+ func (dagOpts ) InputCodec ( codec string ) DagPutOption {
48
48
return func (opts * DagPutSettings ) error {
49
- opts .InputEnc = enc
49
+ opts .InputCodec = codec
50
50
return nil
51
51
}
52
52
}
53
53
54
- // Kind is an option for Dag.Put which specifies the format that the dag
55
- // will be added as . Default is "cbor".
56
- func (dagOpts ) Kind ( kind string ) DagPutOption {
54
+ // StoreCodec is an option for Dag.Put which specifies the codec that the stored
55
+ // object will be encoded with . Default is "dag- cbor".
56
+ func (dagOpts ) StoreCodec ( codec string ) DagPutOption {
57
57
return func (opts * DagPutSettings ) error {
58
- opts .Kind = kind
58
+ opts .StoreCodec = codec
59
59
return nil
60
60
}
61
61
}
0 commit comments