bloombits

Package bloombits implements bloom filtering on batches of data.

Generator

// Generator takes a number of bloom filters and generates the rotated bloom bits
// to be used for batched filtering.
type Generator struct {
    blooms   [types.BloomBitLength][]byte // Rotated blooms for per-bit matching
    sections uint                         // Number of sections to batch together
    nextSec  uint                         // Next section to set when adding a bloom
}

Matcher

// Matcher is a pipelined system of schedulers and logic matchers which perform
// binary AND/OR operations on the bit-streams, creating a stream of potential
// blocks to inspect for data content.
type Matcher struct {
    sectionSize uint64 // Size of the data batches to filter on

    filters    [][]bloomIndexes    // Filter the system is matching for
    schedulers map[uint]*scheduler // Retrieval schedulers for loading bloom bits

    retrievers chan chan uint       // Retriever processes waiting for bit allocations
    counters   chan chan uint       // Retriever processes waiting for task count reports
    retrievals chan chan *Retrieval // Retriever processes waiting for task allocations
    deliveries chan *Retrieval      // Retriever processes waiting for task response deliveries

    running uint32 // Atomic flag whether a session is live or not
}

MatcherSession

scheduler

Last updated

Was this helpful?