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

Method AsWorkspaceIdentity

coderd/agentapi/cached_workspace.go:58–66  ·  view source on GitHub ↗

Returns the Workspace, true, unless the workspace has not been cached (nuked or was a prebuild).

()

Source from the content-addressed store, hash-verified

56
57// Returns the Workspace, true, unless the workspace has not been cached (nuked or was a prebuild).
58func (cws *CachedWorkspaceFields) AsWorkspaceIdentity() (database.WorkspaceIdentity, bool) {
59 cws.lock.RLock()
60 defer cws.lock.RUnlock()
61 // Should we be more explicit about all fields being set to be valid?
62 if cws.identity.Equal(database.WorkspaceIdentity{}) {
63 return database.WorkspaceIdentity{}, false
64 }
65 return cws.identity, true
66}
67
68// ContextInject attempts to inject the rbac object for the cached workspace fields
69// into the given context, either returning the wrapped context or the original.

Callers 7

ContextInjectMethod · 0.95
TestCacheClearFunction · 0.95
TestCacheUpdateFunction · 0.95
UpdateStatsMethod · 0.80
UpdateAppStatusMethod · 0.80
ReportConnectionMethod · 0.80

Calls 1

EqualMethod · 0.45

Tested by 2

TestCacheClearFunction · 0.76
TestCacheUpdateFunction · 0.76