added support for both pilosa and standard roaring uploads

This commit is contained in:
Todd Gruben 2018-08-09 11:17:23 -05:00 committed by Travis Turner
parent cc80e0b0e4
commit 1d99da1f28
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9
2 changed files with 8 additions and 1 deletions

View file

@ -557,6 +557,7 @@ func (c *InternalClient) ImportRoaringBytes(ctx context.Context, node *pilosa.No
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("invalid status: %d", resp.StatusCode)
}
io.Copy(ioutil.Discard, resp.Body)
return nil
}

View file

@ -3409,8 +3409,14 @@ func readStandardHeader(buf []byte) (size uint32, containerTyper func(index uint
}
func UnmarshalStandardRoaring(data []byte) (*Bitmap, error) {
b := NewBitmap()
fileMagic := uint32(binary.LittleEndian.Uint16(data[0:2]))
if fileMagic == magicNumber { //if pilosa roaring
err := b.UnmarshalBinary(data)
return b, err
}
keyN, containerTyper, header, pos, err, haveRuns := readStandardHeader(data)
if err != nil {
return nil, err