mirror of
https://github.com/logos-storage/logos-storage-go-bindings.git
synced 2026-01-02 13:33:10 +00:00
Merge pull request #16 from codex-storage/fix/configuration-duration
fix: fix configuration types
This commit is contained in:
commit
8026f3fd8d
@ -159,12 +159,12 @@ type Config struct {
|
||||
|
||||
// Default block timeout in seconds - 0 disables the ttl
|
||||
// Default: 30 days
|
||||
BlockTtl int `json:"block-ttl,omitempty"`
|
||||
BlockTtl string `json:"block-ttl,omitempty"`
|
||||
|
||||
// Time interval in seconds - determines frequency of block
|
||||
// maintenance cycle: how often blocks are checked for expiration and cleanup
|
||||
// Default: 10 minutes
|
||||
BlockMaintenanceInterval int `json:"block-mi,omitempty"`
|
||||
BlockMaintenanceInterval string `json:"block-mi,omitempty"`
|
||||
|
||||
// Number of blocks to check every maintenance cycle
|
||||
// Default: 1000
|
||||
|
||||
@ -121,3 +121,33 @@ func TestCreateAndDestroyMultipleInstancesWithSameDatadir(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNumThreads(t *testing.T) {
|
||||
node := newCodexNode(t, Config{
|
||||
NumThreads: 1,
|
||||
})
|
||||
|
||||
if node == nil {
|
||||
t.Fatal("expected codex node to be created")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlockTtl(t *testing.T) {
|
||||
node := newCodexNode(t, Config{
|
||||
BlockTtl: "10H",
|
||||
})
|
||||
|
||||
if node == nil {
|
||||
t.Fatal("expected codex node to be created")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlockMaintenanceInterval(t *testing.T) {
|
||||
node := newCodexNode(t, Config{
|
||||
BlockMaintenanceInterval: "10H",
|
||||
})
|
||||
|
||||
if node == nil {
|
||||
t.Fatal("expected codex node to be created")
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +47,18 @@ func newCodexNode(t *testing.T, opts ...Config) *CodexNode {
|
||||
if c.StorageQuota != 0 {
|
||||
config.StorageQuota = c.StorageQuota
|
||||
}
|
||||
|
||||
if c.NumThreads != 0 {
|
||||
config.NumThreads = c.NumThreads
|
||||
}
|
||||
|
||||
if c.BlockTtl != "" {
|
||||
config.BlockTtl = c.BlockTtl
|
||||
}
|
||||
|
||||
if c.BlockMaintenanceInterval != "" {
|
||||
config.BlockMaintenanceInterval = c.BlockMaintenanceInterval
|
||||
}
|
||||
}
|
||||
|
||||
node, err := New(config)
|
||||
|
||||
2
vendor/nim-codex
vendored
2
vendor/nim-codex
vendored
@ -1 +1 @@
|
||||
Subproject commit c80d44ff93057dd41e8ea3d55bef572eb503dfd2
|
||||
Subproject commit 2b9fc1eb554e5eee43b8a815084fb8c61687ada9
|
||||
Loading…
x
Reference in New Issue
Block a user