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

Method StartRecording

agent/x/agentdesktop/api_test.go:140–169  ·  view source on GitHub ↗
(_ context.Context, recordingID string)

Source from the content-addressed store, hash-verified

138}
139
140func (f *fakeDesktop) StartRecording(_ context.Context, recordingID string) error {
141 f.recMu.Lock()
142 defer f.recMu.Unlock()
143 if f.recordings == nil {
144 f.recordings = make(map[string]string)
145 }
146 if path, ok := f.recordings[recordingID]; ok {
147 // Check if already stopped (file still exists but stop was
148 // called). For the fake, a stopped recording means its ID
149 // appears in stopCalls. In that case, remove the old file
150 // and start fresh.
151 stopped := slices.Contains(f.stopCalls, recordingID)
152 if !stopped {
153 // Active recording - no-op.
154 return nil
155 }
156 // Completed recording - discard old file, start fresh.
157 _ = os.Remove(path)
158 delete(f.recordings, recordingID)
159 }
160 f.startCount++
161 tmpFile, err := os.CreateTemp("", "fake-recording-*.mp4")
162 if err != nil {
163 return err
164 }
165 _, _ = tmpFile.Write([]byte(fmt.Sprintf("fake-mp4-data-%s-%d", recordingID, f.startCount)))
166 _ = tmpFile.Close()
167 f.recordings[recordingID] = tmpFile.Name()
168 return nil
169}
170
171func (f *fakeDesktop) StopRecording(_ context.Context, recordingID string) (*agentdesktop.RecordingArtifact, error) {
172 f.recMu.Lock()

Callers

nothing calls this directly

Calls 7

RemoveMethod · 0.65
WriteMethod · 0.65
CloseMethod · 0.65
NameMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected