diff --git a/codex/codex.go b/codex/codex.go index 24495b4..ab62c68 100644 --- a/codex/codex.go +++ b/codex/codex.go @@ -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 diff --git a/codex/codex_test.go b/codex/codex_test.go index 15c6cc3..6d2bc9b 100644 --- a/codex/codex_test.go +++ b/codex/codex_test.go @@ -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") + } +} diff --git a/codex/testutil.go b/codex/testutil.go index fb0471c..2d297da 100644 --- a/codex/testutil.go +++ b/codex/testutil.go @@ -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) diff --git a/vendor/nim-codex b/vendor/nim-codex index c80d44f..2b9fc1e 160000 --- a/vendor/nim-codex +++ b/vendor/nim-codex @@ -1 +1 @@ -Subproject commit c80d44ff93057dd41e8ea3d55bef572eb503dfd2 +Subproject commit 2b9fc1eb554e5eee43b8a815084fb8c61687ada9