Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Added BitIterator interface
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed Jun 23, 2017
1 parent 9470942 commit cee1d49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (c *Client) Schema() (*Schema, error) {
}

// ImportFrame imports bits from the given CSV iterator
func (c *Client) ImportFrame(frame *Frame, bitIterator *CSVBitIterator, batchSize uint) error {
func (c *Client) ImportFrame(frame *Frame, bitIterator BitIterator, batchSize uint) error {
const sliceWidth = 1048576
linesLeft := true
bitGroup := map[uint64][]Bit{}
Expand Down
7 changes: 4 additions & 3 deletions imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ type Bit struct {
Timestamp int64
}

// BitIteratorCallback gets called for each bit in a stream.
// return false to pause iteration.
type BitIteratorCallback func(bit Bit) bool
// BitIterator structs return bits one by one.
type BitIterator interface {
NextBit() (Bit, error)
}

// CSVBitIterator reads bits from a Reader.
// Each line should contain a single bit in the following form:
Expand Down

0 comments on commit cee1d49

Please sign in to comment.