MCPcopy Index your code
hub / github.com/coder/coder / GenLockID

Function GenLockID

coderd/database/lock.go:22–27  ·  view source on GitHub ↗

GenLockID generates a unique and consistent lock ID from a given string.

(name string)

Source from the content-addressed store, hash-verified

20
21// GenLockID generates a unique and consistent lock ID from a given string.
22func GenLockID(name string) int64 {
23 hash := fnv.New64()
24 _, _ = hash.Write([]byte(name))
25 // #nosec G115 - Safe conversion as FNV hash should be treated as random value and both uint64/int64 have the same range of unique values
26 return int64(hash.Sum64())
27}

Callers 1

runOnceMethod · 0.92

Calls 1

WriteMethod · 0.65

Tested by

no test coverage detected