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

Method Apply

provisioner/echo/serve.go:285–305  ·  view source on GitHub ↗

Apply reads requests from the provided directory to stream responses.

(sess *provisionersdk.Session, req *proto.ApplyRequest, canceledOrComplete <-chan struct{})

Source from the content-addressed store, hash-verified

283
284// Apply reads requests from the provided directory to stream responses.
285func (*echo) Apply(sess *provisionersdk.Session, req *proto.ApplyRequest, canceledOrComplete <-chan struct{}) *proto.ApplyComplete {
286 responses, err := readResponses(
287 sess,
288 strings.ToLower(req.GetMetadata().GetWorkspaceTransition().String()),
289 "apply.protobuf")
290 if err != nil {
291 return &proto.ApplyComplete{Error: err.Error()}
292 }
293 for _, response := range responses {
294 if log := response.GetLog(); log != nil {
295 sess.ProvisionLog(log.Level, log.Output)
296 }
297 if complete := response.GetApply(); complete != nil {
298 return complete
299 }
300 }
301
302 // some tests use Echo without a complete response to test cancel
303 <-canceledOrComplete
304 return provisionersdk.ApplyErrorf("canceled")
305}
306
307func (*echo) Shutdown(_ context.Context, _ *proto.Empty) (*proto.Empty, error) {
308 return &proto.Empty{}, nil

Callers

nothing calls this directly

Calls 9

ApplyErrorfFunction · 0.92
readResponsesFunction · 0.85
ProvisionLogMethod · 0.65
StringMethod · 0.45
GetMetadataMethod · 0.45
ErrorMethod · 0.45
GetLogMethod · 0.45
GetApplyMethod · 0.45

Tested by

no test coverage detected