MCPcopy Create free account
hub / github.com/cloudbase/garm / Lock

Function Lock

locking/locking.go:42–52  ·  view source on GitHub ↗
(key, identifier string)

Source from the content-addressed store, hash-verified

40}
41
42func Lock(key, identifier string) {
43 if locker == nil {
44 panic("no locker is registered")
45 }
46
47 _, filename, line, _ := runtime.Caller(1)
48 slog.Debug("attempting to lock", "key", key, "identifier", identifier, "caller", fmt.Sprintf("%s:%d", filename, line))
49 defer slog.Debug("lock acquired", "key", key, "identifier", identifier, "caller", fmt.Sprintf("%s:%d", filename, line))
50
51 locker.Lock(key, identifier)
52}
53
54func LockWithContext(ctx context.Context, key, identifier string) error {
55 if locker == nil {

Callers 8

StartMethod · 0.92
HandleJobsCompletedMethod · 0.92
HandleJobsStartedMethod · 0.92
TestLockerDeleteMethod · 0.85
TestLockUnlockMethod · 0.85
TestLockedByMethod · 0.85

Calls 1

LockMethod · 0.65

Tested by 5

TestLockerDeleteMethod · 0.68
TestLockUnlockMethod · 0.68
TestLockedByMethod · 0.68