mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 12:57:44 +08:00
coreapi: FetchBlocks option
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@6800f56736 This commit was moved from ipfs/boxo@030083beef
This commit is contained in:
parent
80aace0fa2
commit
3702f185fb
@ -1,14 +1,16 @@
|
||||
package options
|
||||
|
||||
type ApiSettings struct {
|
||||
Offline bool
|
||||
Offline bool
|
||||
FetchBlocks bool
|
||||
}
|
||||
|
||||
type ApiOption func(*ApiSettings) error
|
||||
|
||||
func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
|
||||
options := &ApiSettings{
|
||||
Offline: false,
|
||||
Offline: false,
|
||||
FetchBlocks: true,
|
||||
}
|
||||
|
||||
return ApiOptionsTo(options, opts...)
|
||||
@ -34,3 +36,12 @@ func (apiOpts) Offline(offline bool) ApiOption {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// FetchBlocks when set to false prevents api from fetching blocks from the
|
||||
// network while allowing other services such as IPNS to still be online
|
||||
func (apiOpts) FetchBlocks(fetch bool) ApiOption {
|
||||
return func(settings *ApiSettings) error {
|
||||
settings.FetchBlocks = fetch
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user