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

Method Track

coderd/boundaryusage/tracker.go:55–66  ·  view source on GitHub ↗

Track records boundary usage for a workspace.

(workspaceID, ownerID uuid.UUID, allowed, denied int64)

Source from the content-addressed store, hash-verified

53
54// Track records boundary usage for a workspace.
55func (t *Tracker) Track(workspaceID, ownerID uuid.UUID, allowed, denied int64) {
56 t.mu.Lock()
57 defer t.mu.Unlock()
58
59 t.workspaces[workspaceID] = struct{}{}
60 t.users[ownerID] = struct{}{}
61 t.workspacesDelta[workspaceID] = struct{}{}
62 t.usersDelta[ownerID] = struct{}{}
63 t.allowedRequests += allowed
64 t.deniedRequests += denied
65 t.usageSinceLastFlush = true
66}
67
68// FlushToDB writes stats to the database. For unique counts, cumulative values
69// are used on UPDATE (replacing the DB value) while delta values are used on

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45