block

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockTime    = BlockType(0)
	BlockInt64   = BlockType(1)
	BlockUint64  = BlockType(2)
	BlockFloat64 = BlockType(3)
	BlockBool    = BlockType(4)
	BlockString  = BlockType(5)
	BlockBytes   = BlockType(6)
	BlockInt32   = BlockType(7)
	BlockInt16   = BlockType(8)
	BlockInt8    = BlockType(9)
	BlockUint32  = BlockType(10)
	BlockUint16  = BlockType(11)
	BlockUint8   = BlockType(12)
	BlockFloat32 = BlockType(13)
	BlockInt128  = BlockType(14)
	BlockInt256  = BlockType(15)
)

Variables

View Source
var (
	BlockPool = &sync.Pool{
		New: func() interface{} { return &Block{} },
	}
)
View Source
var BlockSz = int(reflect.TypeOf(Block{}).Size())

Functions

func NopCloser

func NopCloser(w io.Writer) io.WriteCloser

NopCloser returns a WriteCloser with a no-op Close method wrapping the provided Writer w.

Types

type Allocator

type Allocator interface {
	Alloc(int) any
	Free(any)
}

type Arena

type Arena struct {
	// contains filtered or unexported fields
}

func NewArena

func NewArena() *Arena

func (*Arena) Alloc

func (a *Arena) Alloc(typ BlockType, sz int) interface{}

func (*Arena) Free

func (a *Arena) Free(typ BlockType, val interface{})

type Block

type Block struct {

	// TODO: measure performance impact of using an interface instead of direct slices
	//       this can save up to 15x storage for slice headers / pointers
	//       but adds another level of indirection on each data access
	// data interface{}
	Bytes   dedup.ByteArray // re-used for bytes and strings
	Bits    *vec.Bitset     // -> Bitset
	Int64   []int64         // re-used by Decimal64, Timestamps
	Int32   []int32         // re-used by Decimal32
	Int16   []int16
	Int8    []int8
	Uint64  []uint64
	Uint32  []uint32
	Uint16  []uint16
	Uint8   []uint8
	Float64 []float64
	Float32 []float32
	Int128  vec.Int128LLSlice // re-used by Decimal128, Int128
	Int256  vec.Int256LLSlice // re-used by Decimal256, Int256
	// contains filtered or unexported fields
}

func AllocBlock

func AllocBlock() *Block

func NewBlock

func NewBlock(typ BlockType, comp Compression, sz int) *Block

func (*Block) Cap

func (b *Block) Cap() int

func (*Block) Clear

func (b *Block) Clear()

func (Block) CompressedSize

func (b Block) CompressedSize() int

func (Block) Compression

func (b Block) Compression() Compression

func (*Block) Copy

func (b *Block) Copy(src *Block)

func (*Block) DecRef

func (b *Block) DecRef() int64

func (*Block) Decode

func (b *Block) Decode(buf []byte, sz, stored int) error

func (Block) Elem

func (b Block) Elem(idx int) interface{}

func (*Block) Encode

func (b *Block) Encode(buf *bytes.Buffer) (int, error)

func (*Block) Hashes

func (b *Block) Hashes(res []uint64) []uint64

func (*Block) HeapSize

func (b *Block) HeapSize() int

func (*Block) IncRef

func (b *Block) IncRef() int64

func (*Block) IsDirty

func (b *Block) IsDirty() bool

func (*Block) IsFloat

func (b *Block) IsFloat() bool

func (*Block) IsIgnore

func (b *Block) IsIgnore() bool

func (*Block) IsInt

func (b *Block) IsInt() bool

func (*Block) IsSint

func (b *Block) IsSint() bool

func (*Block) IsUint

func (b *Block) IsUint() bool

func (*Block) Len

func (b *Block) Len() int

func (*Block) Less

func (b *Block) Less(i, j int) bool

func (*Block) MaxStoredSize

func (b *Block) MaxStoredSize() int

Estimate the upper bound of the space required to store a serialization of this block. The true size may be smaller due to efficient type-based compression and generic subsequent block compression.

This size hint is used to properly dimension the encoer/decoder buffers as is required by LZ4 and to avoid memcopy during write.

func (*Block) MinMax

func (b *Block) MinMax() (interface{}, interface{})

func (Block) RangeSlice

func (b Block) RangeSlice(start, end int) interface{}

func (Block) RawSlice

func (b Block) RawSlice() interface{}

func (*Block) Release

func (b *Block) Release()

func (*Block) SetCompression

func (b *Block) SetCompression(c Compression)

func (*Block) SetDirty

func (b *Block) SetDirty()

func (*Block) Swap

func (b *Block) Swap(i, j int)

func (Block) Type

func (b Block) Type() BlockType

type BlockType

type BlockType byte

Note: uses 5 bit encoding (max 32 values)

func (BlockType) IsValid

func (t BlockType) IsValid() bool

func (BlockType) String

func (t BlockType) String() string

type Compression

type Compression byte
const (
	NoCompression Compression = iota
	SnappyCompression
	LZ4Compression
)

func (Compression) HeaderSize

func (c Compression) HeaderSize(n int) int

func (Compression) String

func (c Compression) String() string

type Filter

type Filter byte
const (
	NoFilter Filter = iota
	BloomFilter
)

func (Filter) String

func (f Filter) String() string

type SnappyWriter

type SnappyWriter struct {
	// contains filtered or unexported fields
}

func NewSnappyWriter

func NewSnappyWriter(w io.Writer) *SnappyWriter

func (*SnappyWriter) Close

func (s *SnappyWriter) Close() error

func (*SnappyWriter) Reset

func (s *SnappyWriter) Reset(w io.Writer) error

func (*SnappyWriter) Write

func (s *SnappyWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL