NewFileInput constructor for FileInput. Accepts file path as argument.
(path string, loop bool, readDepth int, maxWait time.Duration, dryRun bool)
| 218 | |
| 219 | // NewFileInput constructor for FileInput. Accepts file path as argument. |
| 220 | func 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 | |
| 241 | func (i *FileInput) init() (err error) { |
| 242 | defer i.mu.Unlock() |