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

Method Unit

agent/unit/manager.go:130–139  ·  view source on GitHub ↗

Unit fetches a unit from the manager. If the unit does not exist, it returns the Unit zero-value as a placeholder unit, because units may depend on other units that have not yet been created.

(id ID)

Source from the content-addressed store, hash-verified

128// it returns the Unit zero-value as a placeholder unit, because
129// units may depend on other units that have not yet been created.
130func (m *Manager) Unit(id ID) (Unit, error) {
131 if id == "" {
132 return Unit{}, xerrors.Errorf("unit ID cannot be empty: %w", ErrUnitIDRequired)
133 }
134
135 m.mu.RLock()
136 defer m.mu.RUnlock()
137
138 return m.units[id], nil
139}
140
141func (m *Manager) IsReady(id ID) (bool, error) {
142 if id == "" {

Callers 6

TestManager_RegisterFunction · 0.95
TestManager_UpdateStatusFunction · 0.95
TestManager_IsReadyFunction · 0.95
SyncStatusMethod · 0.80

Calls 1

ErrorfMethod · 0.45

Tested by 5

TestManager_RegisterFunction · 0.76
TestManager_UpdateStatusFunction · 0.76
TestManager_IsReadyFunction · 0.76