forked from TrueCloudLab/frostfs-contract
[#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:
parent
8ef5e15de6
commit
69c8e7aea9
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue