-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
node: Make Peapod's flush interval configurable
There may be a need to tune time interval b/w batch writes to disk in Peapod component. Add storage node's config with `flush_interval` key of type duration defaulting to 10ms. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
- Loading branch information
1 parent
c060b16
commit b01baf6
Showing
11 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
cmd/neofs-node/config/engine/shard/blobstor/peapod/config.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package peapodconfig | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" | ||
) | ||
|
||
// Config is a wrapper over the config section | ||
// which provides access to Peapod configurations. | ||
type Config config.Config | ||
|
||
// Various Peapod config defaults. | ||
const ( | ||
// DefaultFlushInterval is a default time interval between Peapod's batch writes | ||
// to disk. | ||
DefaultFlushInterval = 10 * time.Millisecond | ||
) | ||
|
||
// From wraps config section into Config. | ||
func From(c *config.Config) *Config { | ||
return (*Config)(c) | ||
} | ||
|
||
// FlushInterval returns the value of "flush_interval" config parameter. | ||
// | ||
// Returns DefaultFlushInterval if the value is not a positive duration. | ||
func (x *Config) FlushInterval() time.Duration { | ||
d := config.DurationSafe((*config.Config)(x), "flush_interval") | ||
if d > 0 { | ||
return d | ||
} | ||
return DefaultFlushInterval | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters