-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
local generation of global IDs; archive, etl, mirror
* part two, prev. commit c0698c2 * add prime-time and xact/xreg/uuid.go * cover multi-object archive, multi-object copy, and etl * PUT => mirrored bucket won't be dropping pending work anymore - via x-put-copies * tests: copy-bucket _may_ return multiple UUIDs Signed-off-by: Alex Aizman <[email protected]>
- Loading branch information
1 parent
c0698c2
commit 896aca0
Showing
14 changed files
with
152 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Package xreg provides registry and (renew, find) functions for AIS eXtended Actions (xactions). | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. | ||
*/ | ||
package xreg | ||
|
||
import ( | ||
"math/rand" | ||
"time" | ||
|
||
"github.com/NVIDIA/aistore/cmn/atomic" | ||
"github.com/NVIDIA/aistore/cmn/cos" | ||
) | ||
|
||
var ( | ||
PrimeTime atomic.Int64 | ||
MyTime atomic.Int64 | ||
) | ||
|
||
// see related: cmn/cos/uuid.go | ||
|
||
func GenBeUID(div, slt int64) (buid string) { | ||
now := time.Now().UnixNano() - MyTime.Load() + PrimeTime.Load() | ||
rem := now % div | ||
|
||
seed := now - rem + slt | ||
if seed < 0 { | ||
seed = now - rem - slt | ||
} | ||
rnd := rand.New(rand.NewSource(seed)) | ||
buid = cos.RandStringWithSrc(rnd, cos.LenShortID) | ||
|
||
if xctn, err := GetXact(buid); err != nil /*unlikely*/ || xctn != nil /*idling away*/ { | ||
// fallback | ||
buid = cos.GenUUID() | ||
} | ||
return | ||
} |
Oops, something went wrong.