MCPcopy
hub / github.com/containerd/containerd / WithRandomID

Function WithRandomID

core/leases/id.go:27–35  ·  view source on GitHub ↗

WithRandomID sets the lease ID to a random unique value

()

Source from the content-addressed store, hash-verified

25
26// WithRandomID sets the lease ID to a random unique value
27func WithRandomID() Opt {
28 return func(l *Lease) error {
29 t := time.Now()
30 var b [3]byte
31 rand.Read(b[:])
32 l.ID = fmt.Sprintf("%d-%s", t.Nanosecond(), base64.URLEncoding.EncodeToString(b[:]))
33 return nil
34 }
35}
36
37// WithID sets the ID for the lease
38func WithID(id string) Opt {

Callers 8

WithLeaseMethod · 0.92
testExportImportFunction · 0.92
TestLeaseResourcesFunction · 0.92
snapshotLeaseFunction · 0.92
withLeaseMethod · 0.92
prune.goFile · 0.92
CreateMethod · 0.92

Calls 1

ReadMethod · 0.65

Tested by 4

testExportImportFunction · 0.74
TestLeaseResourcesFunction · 0.74
snapshotLeaseFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…