[#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:
parent
a97dee008c
commit
9aba0ba512
9 changed files with 76 additions and 7 deletions
|
@ -2,6 +2,7 @@ package engine
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
@ -25,6 +26,12 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type epochState struct{}
|
||||
|
||||
func (s epochState) CurrentEpoch() uint64 {
|
||||
return math.MaxUint64
|
||||
}
|
||||
|
||||
func BenchmarkExists(b *testing.B) {
|
||||
b.Run("2 shards", func(b *testing.B) {
|
||||
benchmarkExists(b, 2)
|
||||
|
@ -104,6 +111,7 @@ func testNewShard(t testing.TB, id int) *shard.Shard {
|
|||
shard.WithMetaBaseOptions(
|
||||
meta.WithPath(filepath.Join(t.Name(), fmt.Sprintf("%d.metabase", id))),
|
||||
meta.WithPermissions(0700),
|
||||
meta.WithEpochState(epochState{}),
|
||||
))
|
||||
|
||||
require.NoError(t, s.Open())
|
||||
|
@ -125,6 +133,7 @@ func testEngineFromShardOpts(t *testing.T, num int, extraOpts func(int) []shard.
|
|||
shard.WithMetaBaseOptions(
|
||||
meta.WithPath(filepath.Join(t.Name(), fmt.Sprintf("metabase%d", i))),
|
||||
meta.WithPermissions(0700),
|
||||
meta.WithEpochState(epochState{}),
|
||||
),
|
||||
shard.WithPiloramaOptions(
|
||||
pilorama.WithPath(filepath.Join(t.Name(), fmt.Sprintf("pilorama%d", i)))),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue