-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
41 lines (36 loc) · 926 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package motion
import (
"github.com/filecoin-shipyard/jiffy"
"github.com/filecoin-shipyard/telefil"
)
type (
// Option represents a configurable parameter in Store.
Option func(*options) error
options struct {
telefilOptions []telefil.Option
jiffyOptions []jiffy.Option
}
)
func newOptions(o ...Option) (*options, error) {
var opts options
for _, apply := range o {
if err := apply(&opts); err != nil {
return nil, err
}
}
return &opts, nil
}
// WithTelefilOptions sets the options used to instantiate a telefil.Telefil Filecoin chain API client.
func WithTelefilOptions(opts ...telefil.Option) Option {
return func(o *options) error {
o.telefilOptions = opts
return nil
}
}
// WithJiffyOptions sets the options used to instantiate the jiffy.Jiffy backing store.
func WithJiffyOptions(opts ...jiffy.Option) Option {
return func(o *options) error {
o.jiffyOptions = opts
return nil
}
}