When writter is nil, we should not ingest events
Opened this issue · 1 comments
atlas-comstock commented
// WriteBlock writes a one or multiple blocks to the underlying writer.
func (s *Flusher) WriteBlock(blocks []block.Block, schema typeof.Schema) error {
if s.writer == nil || len(blocks) == 0 {
return nil
}
// Merge the blocks based on the specified merging function
// buffer, err := s.merge(blocks, schema)
// if err != nil {
// return err
// }
// Generate the file name and write the data to the underlying writer
return s.writer.Write(s.generateFileName(blocks[0]), blocks)
}
In Flusher, we should return an error when the writer is nil, otherwise, the badgerDB data will be deleted without writing to any writter.
It would be better to keep them in badgerDB
tardunge commented
How about having a Writer scoped Flusher?