Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When writter is nil, we should not ingest events #104

Open
atlas-comstock opened this issue Jun 17, 2022 · 1 comment
Open

When writter is nil, we should not ingest events #104

atlas-comstock opened this issue Jun 17, 2022 · 1 comment

Comments

@atlas-comstock
Copy link
Collaborator

// 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
Copy link
Collaborator

How about having a Writer scoped Flusher?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants