[#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
|
@ -1,6 +1,7 @@
|
|||
package meta_test
|
||||
|
||||
import (
|
||||
"math"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
@ -18,6 +19,12 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type epochState struct{}
|
||||
|
||||
func (s epochState) CurrentEpoch() uint64 {
|
||||
return math.MaxUint64
|
||||
}
|
||||
|
||||
// saves "big" object in DB.
|
||||
func putBig(db *meta.DB, obj *object.Object) error {
|
||||
return metaPut(db, obj, nil)
|
||||
|
@ -36,8 +43,13 @@ func testSelect(t *testing.T, db *meta.DB, cnr cid.ID, fs object.SearchFilters,
|
|||
func newDB(t testing.TB, opts ...meta.Option) *meta.DB {
|
||||
path := t.Name()
|
||||
|
||||
bdb := meta.New(append([]meta.Option{meta.WithPath(path), meta.WithPermissions(0600)},
|
||||
opts...)...)
|
||||
bdb := meta.New(
|
||||
append([]meta.Option{
|
||||
meta.WithPath(path),
|
||||
meta.WithPermissions(0600),
|
||||
meta.WithEpochState(epochState{}),
|
||||
}, opts...)...,
|
||||
)
|
||||
|
||||
require.NoError(t, bdb.Open(false))
|
||||
require.NoError(t, bdb.Init())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue