[#1634] meta: Add epoch state

It allows performing expiration checks on the stored objects.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-07-27 21:34:25 +03:00 committed by Pavel Karpy
parent a97dee008c
commit 9aba0ba512
9 changed files with 76 additions and 7 deletions

View file

@ -2,6 +2,7 @@ package shard_test
import (
"crypto/sha256"
"math"
"math/rand"
"os"
"path/filepath"
@ -25,6 +26,12 @@ import (
"go.uber.org/zap"
)
type epochState struct{}
func (s epochState) CurrentEpoch() uint64 {
return math.MaxUint64
}
func newShard(t testing.TB, enableWriteCache bool) *shard.Shard {
return newCustomShard(t, t.TempDir(), enableWriteCache,
[]writecache.Option{writecache.WithMaxMemSize(0)},
@ -49,6 +56,7 @@ func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts
),
shard.WithMetaBaseOptions(
meta.WithPath(filepath.Join(rootPath, "meta")),
meta.WithEpochState(epochState{}),
),
shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(rootPath, "pilorama"))),
shard.WithWriteCache(enableWriteCache),