MCPcopy
hub / github.com/probelabs/goreplay / NewFileInput

Function NewFileInput

input_file.go:220–239  ·  view source on GitHub ↗

NewFileInput constructor for FileInput. Accepts file path as argument.

(path string, loop bool, readDepth int, maxWait time.Duration, dryRun bool)

Source from the content-addressed store, hash-verified

218
219// NewFileInput constructor for FileInput. Accepts file path as argument.
220func NewFileInput(path string, loop bool, readDepth int, maxWait time.Duration, dryRun bool) (i *FileInput) {
221 i = new(FileInput)
222 i.data = make(chan []byte, 1000)
223 i.exit = make(chan bool)
224 i.path = path
225 i.speedFactor = 1
226 i.loop = loop
227 i.readDepth = readDepth
228 i.stats = expvar.NewMap("file-" + path)
229 i.dryRun = dryRun
230 i.maxWait = maxWait
231
232 if err := i.init(); err != nil {
233 return
234 }
235
236 go i.emit()
237
238 return
239}
240
241func (i *FileInput) init() (err error) {
242 defer i.mu.Unlock()

Calls 2

initMethod · 0.45
emitMethod · 0.45