{"modulePath":"github.com/ozontech/seq-db","version":"v0.82.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package node\n\n## Functions\n\n```go\nfunc NewAnd(left, right Node) *nodeAnd\n```\n\n```go\nfunc NewNAnd(negative, regular Node) *nodeNAnd\n```\n\n```go\nfunc NewNot(child Node, minID, maxID LID) *nodeNot\n```\n\n```go\nfunc NewOr(left, right Node) *nodeOr\n```\n\n```go\nfunc NewRange(minVal, maxVal LID) *nodeRange\n```\n\n```go\nfunc OrMulti(batches []LIDBatch, asc bool) (result LIDBatch, residuals []LIDBatch)\n```\nOrMulti unions multiple batches in the given LID order and returns result and unprocessed parts for each input batch.\n\n```go\nfunc TreeFold[V any](op func(V, V) V, def V, values []V) V\n```\n\n## Types\n\n```go\ntype BatchedNode interface {\n\tfmt.Stringer\n\t// NextBatch returns next batch. Returns empty batch when exhausted.\n\tNextBatch() LIDBatch\n\t// NextBatchGeq returns next batch (LIDs \u003e= minLID). Returns empty batch when exhausted.\n\tNextBatchGeq(nextID LID) LIDBatch\n}\n```\n\n```go\nfunc EmptyBatched() BatchedNode\n```\n\n```go\nfunc NewAndBatched(left, right BatchedNode, asc bool) BatchedNode\n```\nNewAndBatched returns a BatchedNode that intersects two batched iterators. asc is the LID traversal order for NextBatch / NextBatchGeq (true = low to high).\n\n```go\nfunc NewBatcherNode(source Node, asc bool) BatchedNode\n```\n\n```go\nfunc NewNAndBatched(neg, reg BatchedNode, asc bool) BatchedNode\n```\nNewNAndBatched returns a BatchedNode that computes AND NOT of two batched iterators. asc is the LID traversal order for NextBatch / NextBatchGeq (true = low to high).\n\n```go\nfunc NewOrBatched(left, right BatchedNode, asc bool) BatchedNode\n```\nNewOrBatched returns a BatchedNode that unions two batched iterators. asc is the LID traversal order for NextBatch / NextBatchGeq (true = low to high).\n\n```go\nfunc NewOrBatchedMulti(children []BatchedNode, asc bool) BatchedNode\n```\n\n```go\nfunc NewStaticBatched(data []uint32, asc bool) BatchedNode\n```\nNewStaticBatched returns a BatchedNode over sorted LID data.\n\n```go\ntype Iter interface {\n\tNext() (uint32, bool)\n\tNextGeq(geq uint32) (uint32, bool)\n}\n```\n\n```go\ntype LID struct {\n\t// contains filtered or unexported fields\n}\n```\nLID is an encoded representation of LID and order flag made specifically for fast compare operations.\n\nFor asc LID order the value is stored as is and mask is zero. For desc LID order the value is inverted as follows: \"MaxUint32 - LID\" formula using XOR mask. Terminal LID value is 0 instead of MaxUint32 in desc order, but 0 is XORed to MaxUint32. Which means, null value will always have lid field set to 0xFFFFFFFF (math.MaxUint32) regardless of order flag.\n\n```go\nfunc Max(left, right LID) LID\n```\n\n```go\nfunc Min(left, right LID) LID\n```\n\n```go\nfunc NewAscLID(lid uint32) LID\n```\nNewAscLID returns LIDs for asc LID order.\n\n```go\nfunc NewAscZeroLID() LID\n```\n\n```go\nfunc NewDescLID(lid uint32) LID\n```\nNewDescLID returns LIDs for desc LID order.\n\n```go\nfunc NewDescZeroLID() LID\n```\n\n```go\nfunc NewLID(lid uint32, asc bool) LID\n```\n\n```go\nfunc NullLID() LID\n```\n\n```go\nfunc (c LID) Eq(other LID) bool\n```\n\n```go\nfunc (c LID) Inc() LID\n```\n\n```go\nfunc (c LID) IsNull() bool\n```\n\n```go\nfunc (c LID) Less(other LID) bool\n```\nLess compares two values. It also does an implicit null check, since we store math.MaxUint32 for null values. Which means if we call x.Less(y), then we know for sure that x is not null. Therefore, this Less call can work as both \"null check + less\" combo.\n\n```go\nfunc (c LID) LessOrEq(other LID) bool\n```\n\n```go\nfunc (c LID) String() string\n```\n\n```go\nfunc (c LID) ToSeqLID() seq.LID\n```\n\n```go\nfunc (c LID) Unpack() uint32\n```\n\n```go\ntype LIDBatch interface {\n\tLen() int\n\tIsEmpty() bool\n\t// Min returns minimum (first) value. Panics if batch is empty.\n\tMin() uint32\n\t// Max returns max (last) value. Panics if batch is empty.\n\tMax() uint32\n\tManyIter(asc bool) ManyIter\n\t// Iter iterates lids in ascending way.\n\tIter() Iter\n\t// ReverseIter iterates lids in descending way.\n\tReverseIter() Iter\n\t// Narrow returns a batch containing only LIDs from minLID to maxLID (inclusive both).\n\tNarrow(minLID, maxLID uint32) LIDBatch\n}\n```\nLIDBatch is batch of lids. It's immutable and can not be modified. Lids are always sorted in ascending way for every underlying implementation.\n\n```go\nfunc And(left, right LIDBatch, asc bool) (result, leftResidual, rightResidual LIDBatch)\n```\nAnd intersects two batches in the given LID order and returns result and unprocessed parts (either left or right will be empty). For AND operation left and right residuals are equal to provided left or right batch, it's safe.\n\n```go\nfunc AndNot(reg, neg LIDBatch, asc bool) (result, regResidual, negResidual LIDBatch)\n```\nAndNot finds \"AND NOT\" result for two batches and returns result and unprocessed parts.\n\n```go\nfunc EmptyBatch() LIDBatch\n```\n\n```go\nfunc NewBitmapBatch(b *roaring.Bitmap) LIDBatch\n```\n\n```go\nfunc NewBitmapBatchFromLids(lids []uint32) LIDBatch\n```\n\n```go\nfunc NewSliceBatch(lids []uint32) LIDBatch\n```\n\n```go\nfunc Or(left, right LIDBatch, asc bool) (result, leftResidual, rightResidual LIDBatch)\n```\nOr unions two batches in the given LID order and returns result and unprocessed parts (either left or right will be empty).\n\n```go\ntype LIDsIter interface {\n\tNextBatch(lids, offsets []uint32) (outLids, outOffsets []uint32, isFirstLID bool)\n}\n```\n\n```go\ntype ManyIter interface {\n\tCopyLIDs(dst []LID, tmp []uint32) int\n\t// CopyRawLIDs copies raw lids (exactly as they stored)\n\tCopyRawLIDs(dst []uint32) int\n}\n```\n\n```go\ntype Node interface {\n\tfmt.Stringer // for testing\n\tNext() LID\n\t// NextGeq returns next greater or equal (GEQ) lid\n\tNextGeq(nextID LID) LID\n}\n```\n\n```go\nfunc BuildORTree(nodes []Node) Node\n```\n\n```go\nfunc MakeStaticNodes(data [][]uint32) []Node\n```\nMakeStaticNodes is currently used only for tests\n\n```go\nfunc NewStatic(data []uint32, asc bool) Node\n```\n\n```go\ntype Sourced interface {\n\tfmt.Stringer // for testing\n\t// aggregation need source\n\tNextSourced() (id LID, source uint32)\n\tNextSourcedGeq(nextLID LID) (id LID, source uint32)\n\t// Release releases resources held by the sourced node (e.g. pooled buffers).\n\tRelease()\n}\n```\n\n```go\nfunc BuildORTreeAgg(nodes []Node) Sourced\n```\n\n```go\nfunc NewColumnAgg(postings LIDsIter, minLID, maxLID uint32, asc bool) Sourced\n```\n\n```go\nfunc NewNodeOrAgg(left, right Sourced) Sourced\n```\n\n```go\nfunc NewSourcedNodeWrapper(d Node, source int) Sourced\n```\n\n```go\nfunc WrapWithSource(nodes []Node) []Sourced\n```\n\n","path":"github.com/ozontech/seq-db/node","name":"node","synopsis":"","isRedistributable":true}
