MCPcopy Index your code
hub / github.com/containerd/containerd / Create

Method Create

core/streaming/proxy/streaming.go:74–105  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

72}
73
74func (sc *streamCreator) Create(ctx context.Context, id string) (streaming.Stream, error) {
75 stream, err := sc.client.Stream(ctx)
76 if err != nil {
77 return nil, err
78 }
79
80 a, err := typeurl.MarshalAny(&streamingapi.StreamInit{
81 ID: id,
82 })
83 if err != nil {
84 return nil, err
85 }
86 err = stream.Send(typeurl.MarshalProto(a))
87 if err != nil {
88 if !errors.Is(err, io.EOF) {
89 err = errgrpc.ToNative(err)
90 }
91 return nil, err
92 }
93
94 // Receive an ack that stream is init and ready
95 if _, err = stream.Recv(); err != nil {
96 if !errors.Is(err, io.EOF) {
97 err = errgrpc.ToNative(err)
98 }
99 return nil, err
100 }
101
102 return &clientStream{
103 s: stream,
104 }, nil
105}
106
107type clientStream struct {
108 s streamingapi.TTRPCStreaming_StreamClient

Callers

nothing calls this directly

Calls 4

StreamMethod · 0.65
MarshalAnyMethod · 0.65
SendMethod · 0.65
RecvMethod · 0.65

Tested by

no test coverage detected