[#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>
enable-notary-in-public-chains
Alex Vanin 2021-01-12 11:09:30 +03:00 committed by Alex Vanin
parent 8ef5e15de6
commit 69c8e7aea9
1 changed files with 6 additions and 0 deletions

View File

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