[#1442] pilorama: Generate timestamp based on node position in the container
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
3caa982283
commit
4437cd7113
13 changed files with 333 additions and 169 deletions
11
pkg/local_object_storage/pilorama/util.go
Normal file
11
pkg/local_object_storage/pilorama/util.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package pilorama
|
||||
|
||||
// nextTimestamp accepts the latest local timestamp, node position in a container and container size.
|
||||
// Returns the next timestamp which can be generated by this node.
|
||||
func nextTimestamp(ts Timestamp, pos, size uint64) Timestamp {
|
||||
base := ts/size*size + pos
|
||||
if ts < base {
|
||||
return base
|
||||
}
|
||||
return base + size
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue