Added comments to the Chunk interface
Signed-off-by: Marco Pracucci <marco@pracucci.com>
This commit is contained in:
parent
0703dae7cc
commit
699f3e8f4d
|
@ -41,14 +41,28 @@ const (
|
||||||
|
|
||||||
// Chunk holds a sequence of sample pairs that can be iterated over and appended to.
|
// Chunk holds a sequence of sample pairs that can be iterated over and appended to.
|
||||||
type Chunk interface {
|
type Chunk interface {
|
||||||
|
// Bytes returns the underlying byte slice of the chunk.
|
||||||
Bytes() []byte
|
Bytes() []byte
|
||||||
|
|
||||||
|
// Encoding returns the encoding type of the chunk.
|
||||||
Encoding() Encoding
|
Encoding() Encoding
|
||||||
|
|
||||||
|
// Appender returns an appender to append samples to the chunk.
|
||||||
Appender() (Appender, error)
|
Appender() (Appender, error)
|
||||||
|
|
||||||
// The iterator passed as argument is for re-use.
|
// The iterator passed as argument is for re-use.
|
||||||
// Depending on implementation, the iterator can
|
// Depending on implementation, the iterator can
|
||||||
// be re-used or a new iterator can be allocated.
|
// be re-used or a new iterator can be allocated.
|
||||||
Iterator(Iterator) Iterator
|
Iterator(Iterator) Iterator
|
||||||
|
|
||||||
|
// NumSamples returns the number of samples in the chunk.
|
||||||
NumSamples() int
|
NumSamples() int
|
||||||
|
|
||||||
|
// Compact is called whenever a chunk is expected to be complete (no more
|
||||||
|
// samples appended) and the underlying implementation can eventually
|
||||||
|
// optimize the chunk.
|
||||||
|
// There's no strong guarantee that no samples will be appended once
|
||||||
|
// Compact() is called. Implementing this function is optional.
|
||||||
Compact()
|
Compact()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue