3 // DagPutSettings is a set of DagPut options.
4 type DagPutSettings struct {
10 // DagPutOption is a single DagPut option.
11 type DagPutOption func(opts *DagPutSettings) error
13 // DagPutOptions applies the given options to a DagPutSettings instance.
14 func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) {
15 options := &DagPutSettings{
21 for _, opt := range opts {
34 // Pin is an option for Dag.Put which specifies whether to pin the added
35 // dags. Default is "false".
36 func (dagOpts) Pin(pin string) DagPutOption {
37 return func(opts *DagPutSettings) error {
43 // InputEnc is an option for Dag.Put which specifies the input encoding of the
44 // data. Default is "json", most formats/codecs support "raw".
45 func (dagOpts) InputEnc(enc string) DagPutOption {
46 return func(opts *DagPutSettings) error {
52 // Kind is an option for Dag.Put which specifies the format that the dag
53 // will be added as. Default is "cbor".
54 func (dagOpts) Kind(kind string) DagPutOption {
55 return func(opts *DagPutSettings) error {