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

Method Lock

coderd/database/migrations/txnmigrator.go:38–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38func (d *pgTxnDriver) Lock() error {
39 var err error
40
41 d.tx, err = d.db.BeginTx(d.ctx, nil)
42 if err != nil {
43 return err
44 }
45 const q = `
46SELECT pg_advisory_xact_lock($1)
47`
48
49 _, err = d.tx.ExecContext(d.ctx, q, lockID)
50 if err != nil {
51 return xerrors.Errorf("exec select: %w", err)
52 }
53 return nil
54}
55
56func (d *pgTxnDriver) Unlock() error {
57 err := d.tx.Commit()

Callers 15

ensureVersionTableMethod · 0.95
CloseMethod · 0.45
GetListeningPortsMethod · 0.45
setPortsMethod · 0.45
TestReinitFunction · 0.45
SubscribeMethod · 0.45
handleEventMethod · 0.45
SetRejectMethod · 0.45
provisionerJobLogsMethod · 0.45
workspaceAgentLogsMethod · 0.45

Calls 2

ExecContextMethod · 0.80
ErrorfMethod · 0.45

Tested by 15

GetListeningPortsMethod · 0.36
setPortsMethod · 0.36
TestReinitFunction · 0.36
SubscribeMethod · 0.36
SetRejectMethod · 0.36
PingMethod · 0.36
CloseMethod · 0.36
requireNotClosedMethod · 0.36