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

Method storeRecordingArtifact

coderd/x/chatd/recording.go:225–258  ·  view source on GitHub ↗
(
	ctx context.Context,
	chatID uuid.UUID,
	ownerID uuid.UUID,
	organizationID uuid.UUID,
	name string,
	mediaType string,
	data []byte,
)

Source from the content-addressed store, hash-verified

223}
224
225func (p *Server) storeRecordingArtifact(
226 ctx context.Context,
227 chatID uuid.UUID,
228 ownerID uuid.UUID,
229 organizationID uuid.UUID,
230 name string,
231 mediaType string,
232 data []byte,
233) (chattool.AttachmentMetadata, error) {
234 storedName, verifiedMediaType, err := chatfiles.PrepareRecordingArtifact(name, mediaType, data)
235 if err != nil {
236 return chattool.AttachmentMetadata{}, err
237 }
238
239 var attachment chattool.AttachmentMetadata
240 err = p.db.InTx(func(tx database.Store) error {
241 var err error
242 attachment, err = storeLinkedChatFileTx(
243 ctx,
244 tx,
245 chatID,
246 ownerID,
247 organizationID,
248 storedName,
249 verifiedMediaType,
250 data,
251 )
252 return err
253 }, database.DefaultTXOptions().WithID("store_recording_artifact"))
254 if err != nil {
255 return chattool.AttachmentMetadata{}, err
256 }
257 return attachment, nil
258}

Callers 1

stopAndStoreRecordingMethod · 0.95

Calls 5

PrepareRecordingArtifactFunction · 0.92
DefaultTXOptionsFunction · 0.92
storeLinkedChatFileTxFunction · 0.85
InTxMethod · 0.65
WithIDMethod · 0.45

Tested by

no test coverage detected