[#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
parent
8ef5e15de6
commit
69c8e7aea9
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue