| 29 | const defaultPollInterval = 30 * time.Second |
| 30 | |
| 31 | func (s *Source) OneShot(ctx context.Context, out chan pipeline.Event) error { |
| 32 | s.logger.Debug("In oneshot") |
| 33 | |
| 34 | for _, file := range s.files { |
| 35 | fi, err := os.Stat(file) |
| 36 | if err != nil { |
| 37 | return fmt.Errorf("could not stat file %s : %w", file, err) |
| 38 | } |
| 39 | |
| 40 | if fi.IsDir() { |
| 41 | s.logger.Warnf("%s is a directory, ignoring it.", file) |
| 42 | continue |
| 43 | } |
| 44 | |
| 45 | s.logger.Infof("reading %s at once", file) |
| 46 | |
| 47 | err = s.readFile(ctx, file, out) |
| 48 | if err != nil { |
| 49 | return err |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | return nil |
| 54 | } |
| 55 | |
| 56 | func (s *Source) StreamingAcquisition(_ context.Context, out chan pipeline.Event, t *tomb.Tomb) error { |
| 57 | s.logger.Debug("Starting live acquisition") |