Exemple #1
0
func findIndex(f *os.File) (*sst.Reader, error) {
	// The last 8 bytes in the file is the length
	// of the SSTable spaces index.
	f.Seek(-8, 2)
	indexLen := binary.ReadInt64(f)

	return sst.NewReader(bounded.New(f, -8-indexLen, -8), indexLen)
}
Exemple #2
0
func findSpaceIndex(r io.ReadSeeker, offset, length int64) (*sst.Reader, error) {
	footerOffset := offset + length - 8

	// The last 8 bytes in the file is the length
	// of the SSTable grouping index.
	r.Seek(footerOffset, 0)
	indexLen := binary.ReadInt64(r)

	return sst.NewReader(bounded.New(r, footerOffset-indexLen, footerOffset), indexLen)
}