MCPcopy Index your code
hub / github.com/docker/cli / parseContext

Function parseContext

cli/command/service/logs.go:335–359  ·  view source on GitHub ↗

parseContext returns a log context and REMOVES the context from the details map

(details map[string]string)

Source from the content-addressed store, hash-verified

333
334// parseContext returns a log context and REMOVES the context from the details map
335func parseContext(details map[string]string) (logContext, error) {
336 nodeID, ok := details["com.docker.swarm.node.id"]
337 if !ok {
338 return logContext{}, fmt.Errorf("missing node id in details: %v", details)
339 }
340 delete(details, "com.docker.swarm.node.id")
341
342 serviceID, ok := details["com.docker.swarm.service.id"]
343 if !ok {
344 return logContext{}, fmt.Errorf("missing service id in details: %v", details)
345 }
346 delete(details, "com.docker.swarm.service.id")
347
348 taskID, ok := details["com.docker.swarm.task.id"]
349 if !ok {
350 return logContext{}, fmt.Errorf("missing task id in details: %s", details)
351 }
352 delete(details, "com.docker.swarm.task.id")
353
354 return logContext{
355 nodeID: nodeID,
356 serviceID: serviceID,
357 taskID: taskID,
358 }, nil
359}
360
361type logContext struct {
362 nodeID string

Callers 1

WriteMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…