[#34] netmap: Add snapshot getter by epoch number

There are cases when NeoFS applications need to fetch netmap
snapshot of exact epoch. This method provides convenient atomic
way to do that.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-01-12 11:09:30 +03:00 committed by Alex Vanin
parent 8ef5e15de6
commit 69c8e7aea9

View file

@ -273,6 +273,12 @@ func Snapshot(diff int) []storageNode {
return getSnapshot(ctx, key) return getSnapshot(ctx, key)
} }
func SnapshotByEpoch(epoch int) []storageNode {
currentEpoch := storage.Get(ctx, snapshotEpoch).(int)
return Snapshot(currentEpoch - epoch)
}
func Config(key []byte) interface{} { func Config(key []byte) interface{} {
return getConfig(ctx, key) return getConfig(ctx, key)
} }