Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Jul 18, 2021
1 parent ca23789 commit 16404c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/indexer/bleve/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ func NewFlushingBatch(index bleve.Index, maxBatchSize int) *FlushingBatch {
}
}

// Index add a new index to batch
func (b *FlushingBatch) Index(id string, data interface{}) error {
if err := b.batch.Index(id, data); err != nil {
return err
}
return b.flushIfFull()
}

// Delete add a delete index to batch
func (b *FlushingBatch) Delete(id string) error {
b.batch.Delete(id)
return b.flushIfFull()
Expand All @@ -46,6 +48,7 @@ func (b *FlushingBatch) flushIfFull() error {
return b.Flush()
}

// Flush submit the batch and create a new one
func (b *FlushingBatch) Flush() error {
err := b.index.Batch(b.batch)
if err != nil {
Expand Down

0 comments on commit 16404c3

Please sign in to comment.