Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
6800f567
Commit
6800f567
authored
Jan 04, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: FetchBlocks option
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
360e8bbf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
options/global.go
options/global.go
+13
-2
No files found.
options/global.go
View file @
6800f567
...
...
@@ -2,6 +2,7 @@ package options
type
ApiSettings
struct
{
Offline
bool
FetchBlocks
bool
}
type
ApiOption
func
(
*
ApiSettings
)
error
...
...
@@ -9,6 +10,7 @@ type ApiOption func(*ApiSettings) error
func
ApiOptions
(
opts
...
ApiOption
)
(
*
ApiSettings
,
error
)
{
options
:=
&
ApiSettings
{
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
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment