MCPcopy
hub / github.com/NVIDIA/aistore / NewObjStream

Function NewObjStream

transport/api.go:102–126  ·  view source on GitHub ↗

object stream //

(client Client, dstURL, dstID string, extra *Extra)

Source from the content-addressed store, hash-verified

100///////////////////
101
102func NewObjStream(client Client, dstURL, dstID string, extra *Extra) (s *Stream) {
103 if extra == nil {
104 extra = &Extra{Config: cmn.GCO.Get()}
105 } else if extra.Config == nil {
106 extra.Config = cmn.GCO.Get()
107 }
108 s = &Stream{streamBase: *newStreamBase(client, dstURL, dstID, extra)}
109 s.streamBase.streamer = s
110 s.callback = extra.Callback
111 if extra.Compressed() {
112 s.initCompression(extra)
113 }
114 debug.Assert(s.usePDU() == extra.UsePDU())
115
116 burst := burst(extra.Config) // num objects the caller can post without blocking
117 s.workCh = make(chan *Obj, burst) // Send Qeueue (SQ)
118 s.cmplCh = make(chan cmpl, burst) // Send Completion Queue (SCQ)
119
120 s.wg.Add(2)
121 go s.sendLoop(dryrun()) // handle SQ
122 go s.cmplLoop() // handle SCQ
123
124 gc.ctrlCh <- ctrl{&s.streamBase, true /* collect */}
125 return
126}
127
128// Asynchronously send an object (transport.Obj) defined by its header and its reader.
129//

Callers 10

Example_headersFunction · 0.92
Example_objFunction · 0.92
Test_MultipleNetworksFunction · 0.92
Test_OnSendCallbackFunction · 0.92
Test_ObjAttrsFunction · 0.92
Test_CompressedOneFunction · 0.92
Test_DryRunFunction · 0.92
Test_CompletionCountFunction · 0.92
streamWriteUntilFunction · 0.92
ResyncMethod · 0.92

Calls 12

AssertFunction · 0.92
newStreamBaseFunction · 0.85
burstFunction · 0.85
dryrunFunction · 0.85
CompressedMethod · 0.80
initCompressionMethod · 0.80
usePDUMethod · 0.80
sendLoopMethod · 0.80
cmplLoopMethod · 0.80
GetMethod · 0.65
AddMethod · 0.65
UsePDUMethod · 0.45

Tested by 9

Example_headersFunction · 0.74
Example_objFunction · 0.74
Test_MultipleNetworksFunction · 0.74
Test_OnSendCallbackFunction · 0.74
Test_ObjAttrsFunction · 0.74
Test_CompressedOneFunction · 0.74
Test_DryRunFunction · 0.74
Test_CompletionCountFunction · 0.74
streamWriteUntilFunction · 0.74