Documentation ¶
Overview ¶
Package pilosa implements the core of the Pilosa distributed bitmap index. It contains all the domain objects, interfaces, and logic that defines pilosa.
Index ¶
- Constants
- Variables
- func EncodeIndexes(a []*Index) []*internal.Index
- func IsInverseView(name string) bool
- func IsValidCacheType(v string) bool
- func IsValidView(name string) bool
- func MarshalImportPayload(index, frame string, slice uint64, bits []Bit) ([]byte, error)
- func MarshalMessage(m proto.Message) ([]byte, error)
- func NewRouter(handler *Handler) *mux.Router
- func Pos(rowID, columnID uint64) uint64
- func UnionStringSlice(a, b []string) []string
- func UnmarshalMessage(buf []byte) (proto.Message, error)
- func ValidateLabel(label string) error
- func ValidateName(name string) error
- func ViewByTimeUnit(name string, t time.Time, unit rune) string
- func ViewsByTime(name string, t time.Time, q TimeQuantum) []string
- func ViewsByTimeRange(name string, start, end time.Time, q TimeQuantum) []string
- type AttrBlock
- type AttrBlocks
- type AttrStore
- func (s *AttrStore) Attrs(id uint64) (m map[string]interface{}, err error)
- func (s *AttrStore) BlockData(i uint64) (map[uint64]map[string]interface{}, error)
- func (s *AttrStore) Blocks() ([]AttrBlock, error)
- func (s *AttrStore) Close() error
- func (s *AttrStore) Open() error
- func (s *AttrStore) Path() string
- func (s *AttrStore) SetAttrs(id uint64, m map[string]interface{}) error
- func (s *AttrStore) SetBulkAttrs(m map[uint64]map[string]interface{}) error
- type Bit
- type Bitmap
- func (b *Bitmap) Bits() []uint64
- func (b *Bitmap) ClearBit(i uint64) (changed bool)
- func (b *Bitmap) Count() uint64
- func (b *Bitmap) DecrementCount(i uint64)
- func (b *Bitmap) Difference(other *Bitmap) *Bitmap
- func (b *Bitmap) IncrementCount(i uint64)
- func (b *Bitmap) Intersect(other *Bitmap) *Bitmap
- func (b *Bitmap) IntersectionCount(other *Bitmap) uint64
- func (b *Bitmap) InvalidateCount()
- func (b *Bitmap) MarshalJSON() ([]byte, error)
- func (b *Bitmap) Merge(other *Bitmap)
- func (b *Bitmap) SetBit(i uint64) (changed bool)
- func (b *Bitmap) Union(other *Bitmap) *Bitmap
- type BitmapCache
- type BitmapPair
- type BitmapPairs
- type BitmapSegment
- func (s *BitmapSegment) Bits() []uint64
- func (s *BitmapSegment) ClearBit(i uint64) (changed bool)
- func (s *BitmapSegment) Count() uint64
- func (s *BitmapSegment) Difference(other *BitmapSegment) *BitmapSegment
- func (s *BitmapSegment) Intersect(other *BitmapSegment) *BitmapSegment
- func (s *BitmapSegment) IntersectionCount(other *BitmapSegment) uint64
- func (s *BitmapSegment) InvalidateCount()
- func (s *BitmapSegment) Merge(other *BitmapSegment)
- func (s *BitmapSegment) SetBit(i uint64) (changed bool)
- func (s *BitmapSegment) Union(other *BitmapSegment) *BitmapSegment
- type Bits
- type BitsByPos
- type BroadcastHandler
- type BroadcastReceiver
- type Broadcaster
- type BufIterator
- type Cache
- type Client
- func (c *Client) BackupSlice(ctx context.Context, index, frame, view string, slice uint64) (io.ReadCloser, error)
- func (c *Client) BackupTo(ctx context.Context, w io.Writer, index, frame, view string) error
- func (c *Client) BlockData(ctx context.Context, index, frame, view string, slice uint64, block int) ([]uint64, []uint64, error)
- func (c *Client) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error)
- func (c *Client) CreateFrame(ctx context.Context, index, frame string, opt FrameOptions) error
- func (c *Client) CreateIndex(ctx context.Context, index string, opt IndexOptions) error
- func (c *Client) ExecutePQL(ctx context.Context, index, query string) (interface{}, error)
- func (c *Client) ExecuteQuery(ctx context.Context, index, query string, allowRedirect bool) (result interface{}, err error)
- func (c *Client) ExportCSV(ctx context.Context, index, frame, view string, slice uint64, w io.Writer) error
- func (c *Client) FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error)
- func (c *Client) FragmentNodes(ctx context.Context, index string, slice uint64) ([]*Node, error)
- func (c *Client) FrameViews(ctx context.Context, index, frame string) ([]string, error)
- func (c *Client) Host() string
- func (c *Client) Import(ctx context.Context, index, frame string, slice uint64, bits []Bit) error
- func (c *Client) MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, error)
- func (c *Client) MaxSliceByIndex(ctx context.Context) (map[string]uint64, error)
- func (c *Client) RestoreFrame(ctx context.Context, host, index, frame string) error
- func (c *Client) RestoreFrom(ctx context.Context, r io.Reader, index, frame, view string) error
- func (c *Client) RowAttrDiff(ctx context.Context, index, frame string, blks []AttrBlock) (map[uint64]map[string]interface{}, error)
- func (c *Client) Schema(ctx context.Context) ([]*IndexInfo, error)
- type Cluster
- func (c *Cluster) FragmentNodes(index string, slice uint64) []*Node
- func (c *Cluster) NodeByHost(host string) *Node
- func (c *Cluster) NodeSetHosts() []string
- func (c *Cluster) NodeStates() map[string]string
- func (c *Cluster) OwnsFragment(host string, index string, slice uint64) bool
- func (c *Cluster) OwnsSlices(index string, maxSlice uint64, host string) []uint64
- func (c *Cluster) Partition(index string, slice uint64) int
- func (c *Cluster) PartitionNodes(partitionID int) []*Node
- func (c *Cluster) Status() *internal.ClusterStatus
- type CmdIO
- type ColumnAttrSet
- type Config
- type Duration
- type ExecOptions
- type Executor
- type ExpvarStatsClient
- func (c *ExpvarStatsClient) Count(name string, value int64, rate float64)
- func (c *ExpvarStatsClient) CountWithCustomTags(name string, value int64, rate float64, tags []string)
- func (c *ExpvarStatsClient) Gauge(name string, value float64, rate float64)
- func (c *ExpvarStatsClient) Histogram(name string, value float64, rate float64)
- func (c *ExpvarStatsClient) Set(name string, value string, rate float64)
- func (c *ExpvarStatsClient) SetLogger(logger io.Writer)
- func (c *ExpvarStatsClient) Tags() []string
- func (c *ExpvarStatsClient) Timing(name string, value time.Duration, rate float64)
- func (c *ExpvarStatsClient) WithTags(tags ...string) StatsClient
- type Fragment
- func (f *Fragment) BlockData(id int) (rowIDs, columnIDs []uint64)
- func (f *Fragment) BlockN() int
- func (f *Fragment) Blocks() []FragmentBlock
- func (f *Fragment) Cache() Cache
- func (f *Fragment) CachePath() string
- func (f *Fragment) Checksum() []byte
- func (f *Fragment) ClearBit(rowID, columnID uint64) (bool, error)
- func (f *Fragment) Close() error
- func (f *Fragment) FlushCache() error
- func (f *Fragment) ForEachBit(fn func(rowID, columnID uint64) error) error
- func (f *Fragment) Frame() string
- func (f *Fragment) Import(rowIDs, columnIDs []uint64) error
- func (f *Fragment) Index() string
- func (f *Fragment) InvalidateChecksums()
- func (f *Fragment) MergeBlock(id int, data []PairSet) (sets, clears []PairSet, err error)
- func (f *Fragment) Open() error
- func (f *Fragment) Path() string
- func (f *Fragment) ReadFrom(r io.Reader) (n int64, err error)
- func (f *Fragment) RecalculateCache()
- func (f *Fragment) Row(rowID uint64) *Bitmap
- func (f *Fragment) SetBit(rowID, columnID uint64) (changed bool, err error)
- func (f *Fragment) Slice() uint64
- func (f *Fragment) Snapshot() error
- func (f *Fragment) Top(opt TopOptions) ([]Pair, error)
- func (f *Fragment) View() string
- func (f *Fragment) WriteTo(w io.Writer) (n int64, err error)
- type FragmentBlock
- type FragmentSyncer
- type Frame
- func (f *Frame) CacheSize() uint32
- func (f *Frame) CacheType() string
- func (f *Frame) ClearBit(name string, rowID, colID uint64, t *time.Time) (changed bool, err error)
- func (f *Frame) Close() error
- func (f *Frame) CreateViewIfNotExists(name string) (*View, error)
- func (f *Frame) Import(rowIDs, columnIDs []uint64, timestamps []*time.Time) error
- func (f *Frame) Index() string
- func (f *Frame) InverseEnabled() bool
- func (f *Frame) MaxInverseSlice() uint64
- func (f *Frame) MaxSlice() uint64
- func (f *Frame) Name() string
- func (f *Frame) Open() error
- func (f *Frame) Options() FrameOptions
- func (f *Frame) Path() string
- func (f *Frame) RowAttrStore() *AttrStore
- func (f *Frame) RowLabel() string
- func (f *Frame) SetBit(name string, rowID, colID uint64, t *time.Time) (changed bool, err error)
- func (f *Frame) SetCacheSize(v uint32) error
- func (f *Frame) SetRowLabel(v string) error
- func (f *Frame) SetTimeQuantum(q TimeQuantum) error
- func (f *Frame) TimeQuantum() TimeQuantum
- func (f *Frame) View(name string) *View
- func (f *Frame) ViewPath(name string) string
- func (f *Frame) Views() []*View
- type FrameInfo
- type FrameOptions
- type Handler
- type Hasher
- type Holder
- func (h *Holder) Close() error
- func (h *Holder) CreateIndex(name string, opt IndexOptions) (*Index, error)
- func (h *Holder) CreateIndexIfNotExists(name string, opt IndexOptions) (*Index, error)
- func (h *Holder) DeleteIndex(name string) error
- func (h *Holder) Fragment(index, frame, view string, slice uint64) *Fragment
- func (h *Holder) Frame(index, name string) *Frame
- func (h *Holder) Index(name string) *Index
- func (h *Holder) IndexPath(name string) string
- func (h *Holder) Indexes() []*Index
- func (h *Holder) MaxInverseSlices() map[string]uint64
- func (h *Holder) MaxSlices() map[string]uint64
- func (h *Holder) Open() error
- func (h *Holder) Schema() []*IndexInfo
- func (h *Holder) View(index, frame, name string) *View
- type HolderSyncer
- type Index
- func (i *Index) Close() error
- func (i *Index) ColumnAttrStore() *AttrStore
- func (i *Index) ColumnLabel() string
- func (i *Index) CreateFrame(name string, opt FrameOptions) (*Frame, error)
- func (i *Index) CreateFrameIfNotExists(name string, opt FrameOptions) (*Frame, error)
- func (i *Index) DeleteFrame(name string) error
- func (i *Index) Frame(name string) *Frame
- func (i *Index) FramePath(name string) string
- func (i *Index) Frames() []*Frame
- func (i *Index) MaxInverseSlice() uint64
- func (i *Index) MaxSlice() uint64
- func (i *Index) Name() string
- func (i *Index) Open() error
- func (i *Index) Path() string
- func (i *Index) SetColumnLabel(v string) error
- func (i *Index) SetRemoteMaxInverseSlice(v uint64)
- func (i *Index) SetRemoteMaxSlice(newmax uint64)
- func (i *Index) SetTimeQuantum(q TimeQuantum) error
- func (i *Index) TimeQuantum() TimeQuantum
- type IndexInfo
- type IndexOptions
- type Iterator
- type LRUCache
- func (c *LRUCache) Add(id, n uint64)
- func (c *LRUCache) BulkAdd(id, n uint64)
- func (c *LRUCache) Get(id uint64) uint64
- func (c *LRUCache) IDs() []uint64
- func (c *LRUCache) Invalidate()
- func (c *LRUCache) Len() int
- func (c *LRUCache) Recalculate()
- func (c *LRUCache) SetStats(s StatsClient)
- func (c *LRUCache) Top() []BitmapPair
- type LimitIterator
- type MultiStatsClient
- func (a MultiStatsClient) Count(name string, value int64, rate float64)
- func (a MultiStatsClient) CountWithCustomTags(name string, value int64, rate float64, tags []string)
- func (a MultiStatsClient) Gauge(name string, value float64, rate float64)
- func (a MultiStatsClient) Histogram(name string, value float64, rate float64)
- func (a MultiStatsClient) Set(name string, value string, rate float64)
- func (a MultiStatsClient) SetLogger(logger io.Writer)
- func (a MultiStatsClient) Tags() []string
- func (a MultiStatsClient) Timing(name string, value time.Duration, rate float64)
- func (a MultiStatsClient) WithTags(tags ...string) StatsClient
- type Node
- type NodeSet
- type Nodes
- type Pair
- type PairHeap
- type PairSet
- type Pairs
- type QueryRequest
- type QueryResponse
- type RankCache
- func (c *RankCache) Add(id uint64, n uint64)
- func (c *RankCache) BulkAdd(id uint64, n uint64)
- func (c *RankCache) Get(id uint64) uint64
- func (c *RankCache) IDs() []uint64
- func (c *RankCache) Invalidate()
- func (c *RankCache) Len() int
- func (c *RankCache) ReadFrom(r io.Reader) (n int64, err error)
- func (c *RankCache) Recalculate()
- func (c *RankCache) SetStats(s StatsClient)
- func (c *RankCache) Top() []BitmapPair
- func (c *RankCache) WriteTo(w io.Writer) (n int64, err error)
- type RoaringIterator
- type Server
- func (s *Server) Addr() net.Addr
- func (s *Server) Close() error
- func (s *Server) ClusterStatus() (proto.Message, error)
- func (s *Server) HandleRemoteStatus(pb proto.Message) error
- func (s *Server) LocalStatus() (proto.Message, error)
- func (s *Server) Open() error
- func (s *Server) ReceiveMessage(pb proto.Message) error
- type SimpleCache
- type SliceIterator
- type StaticNodeSet
- type StatsClient
- type StatusHandler
- type TimeQuantum
- type TopOptions
- type View
- func (v *View) ClearBit(rowID, columnID uint64) (changed bool, err error)
- func (v *View) Close() error
- func (v *View) CreateFragmentIfNotExists(slice uint64) (*Fragment, error)
- func (v *View) Fragment(slice uint64) *Fragment
- func (v *View) FragmentPath(slice uint64) string
- func (v *View) Fragments() []*Fragment
- func (v *View) Frame() string
- func (v *View) Index() string
- func (v *View) MaxSlice() uint64
- func (v *View) Name() string
- func (v *View) Open() error
- func (v *View) Path() string
- func (v *View) SetBit(rowID, columnID uint64) (changed bool, err error)
- type ViewInfo
Constants ¶
const ( AttrTypeString = 1 AttrTypeInt = 2 AttrTypeBool = 3 AttrTypeFloat = 4 )
Attribute data type enum.
const ( MessageTypeCreateSlice = 1 MessageTypeCreateIndex = 2 MessageTypeDeleteIndex = 3 MessageTypeCreateFrame = 4 MessageTypeDeleteFrame = 5 )
Broadcast message types.
const ( // DefaultPartitionN is the default number of partitions in a cluster. DefaultPartitionN = 256 // DefaultReplicaN is the default number of replicas per partition. DefaultReplicaN = 1 )
const ( NodeStateUp = "UP" NodeStateDown = "DOWN" )
NodeState represents node state returned in /status endpoint for a node in the cluster.
const ( // DefaultHost is the default hostname to use. DefaultHost = "localhost" // DefaultPort is the default port use with the hostname. DefaultPort = "10101" // DefaultClusterType sets the node intercommunication method. DefaultClusterType = "static" // DefaultInternalPort the port the nodes intercommunicate on. DefaultInternalPort = "14000" // DefaultMetrics sets the internal metrics to no op DefaultMetrics = "nop" // DefaultMaxWritesPerRequest is the default number of writes per request. DefaultMaxWritesPerRequest = 5000 )
const ( DefaultFrame = "general" // MinThreshold is the lowest count to use in a Top-N operation when // looking for additional id/count pairs. MinThreshold = 1 )
DefaultFrame is the frame used if one is not specified.
const ( // SliceWidth is the number of column IDs in a slice. SliceWidth = 1048576 // SnapshotExt is the file extension used for an in-process snapshot. SnapshotExt = ".snapshotting" // CopyExt is the file extension used for the temp file used while copying. CopyExt = ".copying" // CacheExt is the file extension for persisted cache ids. CacheExt = ".cache" // HashBlockSize is the number of rows in a merkle hash block. HashBlockSize = 100 )
const ( DefaultRowLabel = "rowID" DefaultCacheType = CacheTypeRanked DefaultInverseEnabled = false // Default ranked frame cache DefaultCacheSize = 50000 )
Default frame settings.
const ( CacheTypeLRU = "lru" CacheTypeRanked = "ranked" )
Cache types.
const ( DefaultAntiEntropyInterval = 10 * time.Minute DefaultPollingInterval = 60 * time.Second )
Default server settings.
const ( ViewStandard = "standard" ViewInverse = "inverse" )
View layout modes.
const AttrBlockSize = 100
AttrBlockSize is the size of attribute blocks for anti-entropy.
const DefaultCacheFlushInterval = 1 * time.Minute
DefaultCacheFlushInterval is the default value for Fragment.CacheFlushInterval.
const (
DefaultColumnLabel = "columnID"
)
Default index settings.
const (
// DefaultFragmentMaxOpN is the default value for Fragment.MaxOpN.
DefaultFragmentMaxOpN = 2000
)
const (
// ThresholdFactor is used to calculate the threshold for new items entering the cache
ThresholdFactor = 1.1
)
const TimeFormat = "2006-01-02T15:04"
TimeFormat is the go-style time format used to parse string dates.
Variables ¶
var ( ErrHostRequired = errors.New("host required") ErrIndexRequired = errors.New("index required") ErrIndexExists = errors.New("index already exists") ErrIndexNotFound = errors.New("index not found") // ErrFrameRequired is returned when no frame is specified. ErrFrameRequired = errors.New("frame required") ErrFrameExists = errors.New("frame already exists") ErrFrameNotFound = errors.New("frame not found") ErrFrameInverseDisabled = errors.New("frame inverse disabled") ErrColumnRowLabelEqual = errors.New("column and row labels cannot be equal") ErrInvalidView = errors.New("invalid view") ErrInvalidCacheType = errors.New("invalid cache type") ErrName = errors.New("invalid index or frame's name, must match [a-z0-9_-]") ErrLabel = errors.New("invalid row or column label, must match [A-Za-z0-9_-]") // ErrFragmentNotFound is returned when a fragment does not exist. ErrFragmentNotFound = errors.New("fragment not found") ErrQueryRequired = errors.New("query required") ErrTooManyWrites = errors.New("too many write commands") )
System errors.
var BuildTime = "not recorded"
var ErrInvalidTimeQuantum = errors.New("invalid time quantum")
ErrInvalidTimeQuantum is returned when parsing a time quantum.
var Expvar = expvar.NewMap("index")
Expvar global expvar map.
var NopBroadcastReceiver = &nopBroadcastReceiver{}
NopBroadcastReceiver is a no-op implementation of the BroadcastReceiver.
var Version = "v0.0.0"
Functions ¶
func EncodeIndexes ¶ added in v0.4.0
EncodeIndexes converts a into its internal representation.
func IsInverseView ¶
IsInverseView returns true if the view is used for storing an inverted representation.
func IsValidCacheType ¶
IsValidCacheType returns true if v is a valid cache type.
func MarshalImportPayload ¶
MarshalImportPayload marshalls the import parameters into a protobuf byte slice.
func MarshalMessage ¶
MarshalMessage encodes the protobuf message into a byte slice.
func UnionStringSlice ¶
UnionStringSlice returns a sorted set of tags which combine a & b.
func UnmarshalMessage ¶
UnmarshalMessage decodes the byte slice into a protobuf message.
func ValidateLabel ¶
ValidateLabel ensures that the label is a valid format.
func ValidateName ¶
ValidateName ensures that the name is a valid format.
func ViewByTimeUnit ¶
ViewByTimeUnit returns the view name for time with a given quantum unit.
func ViewsByTime ¶
func ViewsByTime(name string, t time.Time, q TimeQuantum) []string
ViewsByTime returns a list of views for a given timestamp.
func ViewsByTimeRange ¶
func ViewsByTimeRange(name string, start, end time.Time, q TimeQuantum) []string
ViewsByTimeRange returns a list of views to traverse to query a time range.
Types ¶
type AttrBlocks ¶
type AttrBlocks []AttrBlock
AttrBlocks represents a list of blocks.
func (AttrBlocks) Diff ¶
func (a AttrBlocks) Diff(other []AttrBlock) []uint64
Diff returns a list of block ids that are different or are new in other. Block lists must be in sorted order.
type AttrStore ¶
type AttrStore struct {
// contains filtered or unexported fields
}
AttrStore represents a storage layer for attributes.
func NewAttrStore ¶
NewAttrStore returns a new instance of AttrStore.
type Bitmap ¶
type Bitmap struct { // Attributes associated with the bitmap. Attrs map[string]interface{} // contains filtered or unexported fields }
Bitmap represents a set of bits.
func (*Bitmap) DecrementCount ¶
DecrementCount decrements the bitmap cached counter.
func (*Bitmap) Difference ¶
Difference returns the diff of b and other.
func (*Bitmap) IncrementCount ¶
IncrementCount increments the bitmap cached counter, note this is an optimization that assumes that the caller is aware the size increased.
func (*Bitmap) IntersectionCount ¶
IntersectionCount returns the number of intersections between b and other.
func (*Bitmap) InvalidateCount ¶
func (b *Bitmap) InvalidateCount()
InvalidateCount updates the cached count in the bitmap.
func (*Bitmap) MarshalJSON ¶
MarshalJSON returns a JSON-encoded byte slice of b.
type BitmapCache ¶
BitmapCache provides an interface for caching full bitmaps.
type BitmapPair ¶
BitmapPair represents a id/count pair with an associated identifier.
type BitmapPairs ¶
type BitmapPairs []BitmapPair
BitmapPairs is a sortable list of BitmapPair objects.
func (BitmapPairs) Len ¶
func (p BitmapPairs) Len() int
func (BitmapPairs) Less ¶
func (p BitmapPairs) Less(i, j int) bool
func (BitmapPairs) Swap ¶
func (p BitmapPairs) Swap(i, j int)
type BitmapSegment ¶
type BitmapSegment struct {
// contains filtered or unexported fields
}
BitmapSegment holds a subset of a bitmap. This could point to a mmapped roaring bitmap or an in-memory bitmap. The width of the segment will always match the slice width.
func (*BitmapSegment) Bits ¶
func (s *BitmapSegment) Bits() []uint64
Bits returns a list of all bits set in the segment.
func (*BitmapSegment) ClearBit ¶
func (s *BitmapSegment) ClearBit(i uint64) (changed bool)
ClearBit clears the i-th bit of the bitmap.
func (*BitmapSegment) Count ¶
func (s *BitmapSegment) Count() uint64
Count returns the number of set bits in the bitmap.
func (*BitmapSegment) Difference ¶
func (s *BitmapSegment) Difference(other *BitmapSegment) *BitmapSegment
Difference returns the diff of s and other.
func (*BitmapSegment) Intersect ¶
func (s *BitmapSegment) Intersect(other *BitmapSegment) *BitmapSegment
Intersect returns the itersection of s and other.
func (*BitmapSegment) IntersectionCount ¶
func (s *BitmapSegment) IntersectionCount(other *BitmapSegment) uint64
IntersectionCount returns the number of intersections between s and other.
func (*BitmapSegment) InvalidateCount ¶
func (s *BitmapSegment) InvalidateCount()
InvalidateCount updates the cached count in the bitmap.
func (*BitmapSegment) Merge ¶
func (s *BitmapSegment) Merge(other *BitmapSegment)
Merge adds chunks from other to s. Chunks in s are overwritten if they exist in other.
func (*BitmapSegment) SetBit ¶
func (s *BitmapSegment) SetBit(i uint64) (changed bool)
SetBit sets the i-th bit of the bitmap.
func (*BitmapSegment) Union ¶
func (s *BitmapSegment) Union(other *BitmapSegment) *BitmapSegment
Union returns the bitwise union of s and other.
type Bits ¶
type Bits []Bit
Bits represents a slice of bits.
func (Bits) GroupBySlice ¶
GroupBySlice returns a map of bits by slice.
func (Bits) Timestamps ¶
Timestamps returns a slice of all the timestamps.
type BitsByPos ¶
type BitsByPos []Bit
BitsByPos represents a slice of bits sorted by internal position.
type BroadcastHandler ¶
BroadcastHandler is the interface for the pilosa object which knows how to handle broadcast messages. (Hint: this is implemented by pilosa.Server)
type BroadcastReceiver ¶
type BroadcastReceiver interface { // Start starts listening for broadcast messages - it should return // immediately, spawning a goroutine if necessary. Start(BroadcastHandler) error }
BroadcastReceiver is the interface for the object which will listen for and decode broadcast messages before passing them to pilosa to handle. The implementation of this could be an http server which listens for messages, gets the protobuf payload, and then passes it to BroadcastHandler.ReceiveMessage.
type Broadcaster ¶
Broadcaster is an interface for broadcasting messages.
var NopBroadcaster Broadcaster
NopBroadcaster represents a Broadcaster that doesn't do anything.
type BufIterator ¶
type BufIterator struct {
// contains filtered or unexported fields
}
BufIterator wraps an iterator to provide the ability to unread values.
func NewBufIterator ¶
func NewBufIterator(itr Iterator) *BufIterator
NewBufIterator returns a buffered iterator that wraps itr.
func (*BufIterator) Next ¶
func (itr *BufIterator) Next() (rowID, columnID uint64, eof bool)
Next returns the next pair in the row. If a value has been buffered then it is returned and the buffer is cleared.
func (*BufIterator) Peek ¶
func (itr *BufIterator) Peek() (rowID, columnID uint64, eof bool)
Peek reads the next value but leaves it on the buffer.
func (*BufIterator) Seek ¶
func (itr *BufIterator) Seek(rowID, columnID uint64)
Seek moves to the first pair equal to or greater than pseek/bseek.
func (*BufIterator) Unread ¶
func (itr *BufIterator) Unread()
Unread pushes previous pair on to the buffer. Panics if the buffer is already full.
type Cache ¶
type Cache interface { Add(id uint64, n uint64) BulkAdd(id uint64, n uint64) Get(id uint64) uint64 Len() int // Returns a list of all IDs. IDs() []uint64 // Updates the cache, if necessary. Invalidate() // Rebuilds the cache Recalculate() // Returns an ordered list of the top ranked bitmaps. Top() []BitmapPair // SetStats defines the stats client used in the cache. SetStats(s StatsClient) }
Cache represents a cache of counts.
type Client ¶
type Client struct { // The client to use for HTTP communication. // Defaults to the http.DefaultClient. HTTPClient *http.Client // contains filtered or unexported fields }
Client represents a client to the Pilosa cluster.
func (*Client) BackupSlice ¶
func (c *Client) BackupSlice(ctx context.Context, index, frame, view string, slice uint64) (io.ReadCloser, error)
BackupSlice retrieves a streaming backup from a single slice. This function tries slice owners until one succeeds.
func (*Client) BlockData ¶
func (c *Client) BlockData(ctx context.Context, index, frame, view string, slice uint64, block int) ([]uint64, []uint64, error)
BlockData returns row/column id pairs for a block.
func (*Client) ColumnAttrDiff ¶
func (c *Client) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error)
ColumnAttrDiff returns data from differing blocks on a remote host.
func (*Client) CreateFrame ¶
CreateFrame creates a new frame on the server.
func (*Client) CreateIndex ¶
CreateIndex creates a new index on the server.
func (*Client) ExecutePQL ¶
ExecutePQL executes query string against index on the server.
func (*Client) ExecuteQuery ¶
func (c *Client) ExecuteQuery(ctx context.Context, index, query string, allowRedirect bool) (result interface{}, err error)
ExecuteQuery executes query against index on the server.
func (*Client) ExportCSV ¶
func (c *Client) ExportCSV(ctx context.Context, index, frame, view string, slice uint64, w io.Writer) error
ExportCSV bulk exports data for a single slice from a host to CSV format.
func (*Client) FragmentBlocks ¶
func (c *Client) FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error)
FragmentBlocks returns a list of block checksums for a fragment on a host. Only returns blocks which contain data.
func (*Client) FragmentNodes ¶
FragmentNodes returns a list of nodes that own a slice.
func (*Client) FrameViews ¶
FrameViews returns a list of view names for a frame.
func (*Client) MaxInverseSliceByIndex ¶
MaxInverseSliceByIndex returns the number of inverse slices on a server by index.
func (*Client) MaxSliceByIndex ¶
MaxSliceByIndex returns the number of slices on a server by index.
func (*Client) RestoreFrame ¶
RestoreFrame restores an entire frame from a host in another cluster.
func (*Client) RestoreFrom ¶
RestoreFrom restores a frame from a backup file to an entire cluster.
type Cluster ¶
type Cluster struct { Nodes []*Node NodeSet NodeSet // Hashing algorithm used to assign partitions to nodes. Hasher Hasher // The number of partitions in the cluster. PartitionN int // The number of replicas a partition has. ReplicaN int // Threshold for logging long-running queries LongQueryTime time.Duration }
Cluster represents a collection of nodes.
func NewCluster ¶
func NewCluster() *Cluster
NewCluster returns a new instance of Cluster with defaults.
func (*Cluster) FragmentNodes ¶
FragmentNodes returns a list of nodes that own a fragment.
func (*Cluster) NodeByHost ¶
NodeByHost returns a node reference by host.
func (*Cluster) NodeSetHosts ¶
NodeSetHosts returns the list of host strings for NodeSet members.
func (*Cluster) NodeStates ¶
NodeStates returns a map of nodes in the cluster with each node's state (UP/DOWN) as the value.
func (*Cluster) OwnsFragment ¶
OwnsFragment returns true if a host owns a fragment.
func (*Cluster) OwnsSlices ¶
OwnsSlices find the set of slices owned by the node per Index
func (*Cluster) PartitionNodes ¶
PartitionNodes returns a list of nodes that own a partition.
func (*Cluster) Status ¶
func (c *Cluster) Status() *internal.ClusterStatus
Status returns the internal ClusterStatus representation.
type ColumnAttrSet ¶
type ColumnAttrSet struct { ID uint64 `json:"id"` Attrs map[string]interface{} `json:"attrs,omitempty"` }
ColumnAttrSet represents a set of attributes for a vertical column in an index. Can have a set of attributes attached to it.
type Config ¶
type Config struct { DataDir string `toml:"data-dir"` Host string `toml:"host"` Cluster struct { ReplicaN int `toml:"replicas"` Type string `toml:"type"` Hosts []string `toml:"hosts"` InternalHosts []string `toml:"internal-hosts"` PollingInterval Duration `toml:"polling-interval"` InternalPort string `toml:"internal-port"` GossipSeed string `toml:"gossip-seed"` LongQueryTime Duration `toml:"long-query-time"` } `toml:"cluster"` Plugins struct { Path string `toml:"path"` } `toml:"plugins"` AntiEntropy struct { Interval Duration `toml:"interval"` } `toml:"anti-entropy"` // Limits the number of mutating commands that can be in a single request to // the server. This includes SetBit, ClearBit, SetRowAttrs & SetColumnAttrs. MaxWritesPerRequest int `toml:"max-writes-per-request"` LogPath string `toml:"log-path"` Metric struct { Service string `toml:"service"` Host string `toml:"host"` PollingInterval Duration `toml:"interval"` } `toml:"metrics"` }
Config represents the configuration for the command.
type Duration ¶
Duration is a TOML wrapper type for time.Duration.
func (Duration) MarshalTOML ¶ added in v0.4.0
func (Duration) MarshalText ¶
MarshalText writes duration value in text format.
func (*Duration) UnmarshalText ¶
UnmarshalText parses a TOML value into a duration value.
type ExecOptions ¶
type ExecOptions struct {
Remote bool
}
ExecOptions represents an execution context for a single Execute() call.
type Executor ¶
type Executor struct { Holder *Holder // Local hostname & cluster configuration. Host string Cluster *Cluster // Client used for remote HTTP requests. HTTPClient *http.Client // Maximum number of SetBit() or ClearBit() commands per request. MaxWritesPerRequest int }
Executor recursively executes calls in a PQL query across all slices.
type ExpvarStatsClient ¶
type ExpvarStatsClient struct {
// contains filtered or unexported fields
}
ExpvarStatsClient writes stats out to expvars.
func NewExpvarStatsClient ¶
func NewExpvarStatsClient() *ExpvarStatsClient
NewExpvarStatsClient returns a new instance of ExpvarStatsClient. This client points at the root of the expvar index map.
func (*ExpvarStatsClient) Count ¶
func (c *ExpvarStatsClient) Count(name string, value int64, rate float64)
Count tracks the number of times something occurs.
func (*ExpvarStatsClient) CountWithCustomTags ¶ added in v0.4.0
func (c *ExpvarStatsClient) CountWithCustomTags(name string, value int64, rate float64, tags []string)
CountWithCustomTags Tracks the number of times something occurs per second with custom tags
func (*ExpvarStatsClient) Gauge ¶
func (c *ExpvarStatsClient) Gauge(name string, value float64, rate float64)
Gauge sets the value of a metric.
func (*ExpvarStatsClient) Histogram ¶
func (c *ExpvarStatsClient) Histogram(name string, value float64, rate float64)
Histogram tracks statistical distribution of a metric. This works the same as gauge for this client.
func (*ExpvarStatsClient) Set ¶
func (c *ExpvarStatsClient) Set(name string, value string, rate float64)
Set tracks number of unique elements.
func (*ExpvarStatsClient) SetLogger ¶ added in v0.4.0
func (c *ExpvarStatsClient) SetLogger(logger io.Writer)
SetLogger has no logger
func (*ExpvarStatsClient) Tags ¶
func (c *ExpvarStatsClient) Tags() []string
Tags returns a sorted list of tags on the client.
func (*ExpvarStatsClient) Timing ¶
func (c *ExpvarStatsClient) Timing(name string, value time.Duration, rate float64)
Timing tracks timing information for a metric.
func (*ExpvarStatsClient) WithTags ¶
func (c *ExpvarStatsClient) WithTags(tags ...string) StatsClient
WithTags returns a new client with additional tags appended.
type Fragment ¶
type Fragment struct { // Cache for row counts. CacheType string // passed in by frame CacheSize uint32 // Number of operations performed before performing a snapshot. // This limits the size of fragments on the heap and flushes them to disk // so that they can be mmapped and heap utilization can be kept low. MaxOpN int // Writer used for out-of-band log entries. LogOutput io.Writer // Row attribute storage. // This is set by the parent frame unless overridden for testing. RowAttrStore *AttrStore // contains filtered or unexported fields }
Fragment represents the intersection of a frame and slice in an index.
func NewFragment ¶
NewFragment returns a new instance of Fragment.
func (*Fragment) Blocks ¶
func (f *Fragment) Blocks() []FragmentBlock
Blocks returns info for all blocks containing data.
func (*Fragment) Checksum ¶
Checksum returns a checksum for the entire fragment. If two fragments have the same checksum then they have the same data.
func (*Fragment) ClearBit ¶
ClearBit clears a bit for a given column & row within the fragment. This updates both the on-disk storage and the in-cache bitmap.
func (*Fragment) FlushCache ¶
FlushCache writes the cache data to disk.
func (*Fragment) ForEachBit ¶
ForEachBit executes fn for every bit set in the fragment. Errors returned from fn are passed through.
func (*Fragment) Import ¶
Import bulk imports a set of bits and then snapshots the storage. This does not affect the fragment's cache.
func (*Fragment) InvalidateChecksums ¶
func (f *Fragment) InvalidateChecksums()
InvalidateChecksums clears all cached block checksums.
func (*Fragment) MergeBlock ¶
MergeBlock compares the block's bits and computes a diff with another set of block bits. The state of a bit is determined by consensus from all blocks being considered.
For example, if 3 blocks are compared and two have a set bit and one has a cleared bit then the bit is considered cleared. The function returns the diff per incoming block so that all can be in sync.
func (*Fragment) RecalculateCache ¶
func (f *Fragment) RecalculateCache()
RecalculateCache rebuilds the cache regardless of invalidate time delay.
func (*Fragment) SetBit ¶
SetBit sets a bit for a given column & row within the fragment. This updates both the on-disk storage and the in-cache bitmap.
func (*Fragment) Top ¶
func (f *Fragment) Top(opt TopOptions) ([]Pair, error)
Top returns the top rows from the fragment. If opt.Src is specified then only rows which intersect src are returned. If opt.FilterValues exist then the row attribute specified by field is matched.
type FragmentBlock ¶
FragmentBlock represents info about a subsection of the rows in a block. This is used for comparing data in remote blocks for active anti-entropy.
type FragmentSyncer ¶
type FragmentSyncer struct { Fragment *Fragment Host string Cluster *Cluster Closing <-chan struct{} }
FragmentSyncer syncs a local fragment to one on a remote host.
func (*FragmentSyncer) SyncFragment ¶
func (s *FragmentSyncer) SyncFragment() error
SyncFragment compares checksums for the local and remote fragments and then merges any blocks which have differences.
type Frame ¶
type Frame struct { Stats StatsClient LogOutput io.Writer // contains filtered or unexported fields }
Frame represents a container for views.
func (*Frame) CreateViewIfNotExists ¶
CreateViewIfNotExists returns the named view, creating it if necessary.
func (*Frame) InverseEnabled ¶
InverseEnabled returns true if an inverse view is available.
func (*Frame) MaxInverseSlice ¶
MaxInverseSlice returns the max inverse slice in the frame.
func (*Frame) Options ¶
func (f *Frame) Options() FrameOptions
Options returns all options for this frame.
func (*Frame) RowAttrStore ¶
RowAttrStore returns the attribute storage.
func (*Frame) SetCacheSize ¶
SetCacheSize sets the cache size for ranked fames. Persists to meta file on update. defaults to DefaultCacheSize 50000
func (*Frame) SetRowLabel ¶
SetRowLabel sets the row labels. Persists to meta file on update.
func (*Frame) SetTimeQuantum ¶
func (f *Frame) SetTimeQuantum(q TimeQuantum) error
SetTimeQuantum sets the time quantum for the frame.
func (*Frame) TimeQuantum ¶
func (f *Frame) TimeQuantum() TimeQuantum
TimeQuantum returns the time quantum for the frame.
type FrameOptions ¶
type FrameOptions struct { RowLabel string `json:"rowLabel,omitempty"` InverseEnabled bool `json:"inverseEnabled,omitempty"` CacheType string `json:"cacheType,omitempty"` CacheSize uint32 `json:"cacheSize,omitempty"` TimeQuantum TimeQuantum `json:"timeQuantum,omitempty"` }
FrameOptions represents options to set when initializing a frame.
func (*FrameOptions) Encode ¶
func (o *FrameOptions) Encode() *internal.FrameMeta
Encode converts o into its internal representation.
type Handler ¶
type Handler struct { Holder *Holder Broadcaster Broadcaster StatusHandler StatusHandler // Local hostname & cluster configuration. Host string Cluster *Cluster Router *mux.Router // The execution engine for running queries. Executor interface { Execute(context context.Context, index string, query *pql.Query, slices []uint64, opt *ExecOptions) ([]interface{}, error) } // The writer for any logging. LogOutput io.Writer }
Handler represents an HTTP handler.
func NewHandler ¶
func NewHandler() *Handler
NewHandler returns a new instance of Handler with a default logger.
type Hasher ¶
type Hasher interface { // Hashes the key into a number between [0,N). Hash(key uint64, n int) int }
Hasher represents an interface to hash integers into buckets.
type Holder ¶
type Holder struct { Broadcaster Broadcaster // Stats Stats StatsClient // Data directory path. Path string // The interval at which the cached row ids are persisted to disk. CacheFlushInterval time.Duration LogOutput io.Writer // contains filtered or unexported fields }
Holder represents a container for indexes.
func (*Holder) CreateIndex ¶
func (h *Holder) CreateIndex(name string, opt IndexOptions) (*Index, error)
CreateIndex creates an index. An error is returned if the index already exists.
func (*Holder) CreateIndexIfNotExists ¶
func (h *Holder) CreateIndexIfNotExists(name string, opt IndexOptions) (*Index, error)
CreateIndexIfNotExists returns an index by name. The index is created if it does not already exist.
func (*Holder) DeleteIndex ¶
DeleteIndex removes an index from the holder.
func (*Holder) MaxInverseSlices ¶
MaxInverseSlices returns MaxInverseSlice map for all indexes.
type HolderSyncer ¶
type HolderSyncer struct { Holder *Holder Host string Cluster *Cluster // Signals that the sync should stop. Closing <-chan struct{} }
HolderSyncer is an active anti-entropy tool that compares the local holder with a remote holder based on block checksums and resolves differences.
func (*HolderSyncer) IsClosing ¶
func (s *HolderSyncer) IsClosing() bool
IsClosing returns true if the syncer has been marked to close.
func (*HolderSyncer) SyncHolder ¶
func (s *HolderSyncer) SyncHolder() error
SyncHolder compares the holder on host with the local holder and resolves differences.
type Index ¶
type Index struct { Stats StatsClient LogOutput io.Writer // contains filtered or unexported fields }
Index represents a container for frames.
func (*Index) ColumnAttrStore ¶
ColumnAttrStore returns the storage for column attributes.
func (*Index) ColumnLabel ¶
ColumnLabel returns the column label.
func (*Index) CreateFrame ¶
func (i *Index) CreateFrame(name string, opt FrameOptions) (*Frame, error)
CreateFrame creates a frame.
func (*Index) CreateFrameIfNotExists ¶
func (i *Index) CreateFrameIfNotExists(name string, opt FrameOptions) (*Frame, error)
CreateFrameIfNotExists creates a frame with the given options if it doesn't exist.
func (*Index) DeleteFrame ¶
DeleteFrame removes a frame from the index.
func (*Index) MaxInverseSlice ¶
MaxInverseSlice returns the max inverse slice in the index according to this node.
func (*Index) SetColumnLabel ¶
SetColumnLabel sets the column label. Persists to meta file on update.
func (*Index) SetRemoteMaxInverseSlice ¶
SetRemoteMaxInverseSlice sets the remote max inverse slice value received from another node.
func (*Index) SetRemoteMaxSlice ¶
SetRemoteMaxSlice sets the remote max slice value received from another node.
func (*Index) SetTimeQuantum ¶
func (i *Index) SetTimeQuantum(q TimeQuantum) error
SetTimeQuantum sets the default time quantum for the index.
func (*Index) TimeQuantum ¶
func (i *Index) TimeQuantum() TimeQuantum
TimeQuantum returns the default time quantum for the index.
type IndexInfo ¶
IndexInfo represents schema information for an index.
func MergeSchemas ¶
MergeSchemas combines indexes and frames from a and b into one schema.
type IndexOptions ¶
type IndexOptions struct { ColumnLabel string `json:"columnLabel,omitempty"` TimeQuantum TimeQuantum `json:"timeQuantum,omitempty"` }
IndexOptions represents options to set when initializing an index.
func (*IndexOptions) Encode ¶
func (o *IndexOptions) Encode() *internal.IndexMeta
Encode converts o into its internal representation.
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache represents a least recently used Cache implemenation.
func NewLRUCache ¶
NewLRUCache returns a new instance of LRUCache.
func (*LRUCache) BulkAdd ¶
BulkAdd adds a count to the cache unsorted. You should Invalidate after completion.
func (*LRUCache) SetStats ¶ added in v0.4.0
func (c *LRUCache) SetStats(s StatsClient)
SetStats defines the stats client used in the cache.
type LimitIterator ¶
type LimitIterator struct {
// contains filtered or unexported fields
}
LimitIterator wraps an Iterator and limits it to a max column/row pair.
func NewLimitIterator ¶
func NewLimitIterator(itr Iterator, maxRowID, maxColumnID uint64) *LimitIterator
NewLimitIterator returns a new LimitIterator.
func (*LimitIterator) Next ¶
func (itr *LimitIterator) Next() (rowID, columnID uint64, eof bool)
Next returns the next row/column ID pair. If the underlying iterator returns a pair higher than the max then EOF is returned.
func (*LimitIterator) Seek ¶
func (itr *LimitIterator) Seek(rowID, columnID uint64)
Seek moves the underlying iterator to a column/row pair.
type MultiStatsClient ¶
type MultiStatsClient []StatsClient
MultiStatsClient joins multiple stats clients together.
func (MultiStatsClient) Count ¶
func (a MultiStatsClient) Count(name string, value int64, rate float64)
Count tracks the number of times something occurs per second on all clients.
func (MultiStatsClient) CountWithCustomTags ¶ added in v0.4.0
func (a MultiStatsClient) CountWithCustomTags(name string, value int64, rate float64, tags []string)
CountWithCustomTags Tracks the number of times something occurs per second with custom tags
func (MultiStatsClient) Gauge ¶
func (a MultiStatsClient) Gauge(name string, value float64, rate float64)
Gauge sets the value of a metric on all clients.
func (MultiStatsClient) Histogram ¶
func (a MultiStatsClient) Histogram(name string, value float64, rate float64)
Histogram tracks statistical distribution of a metric on all clients.
func (MultiStatsClient) Set ¶
func (a MultiStatsClient) Set(name string, value string, rate float64)
Set tracks number of unique elements on all clients.
func (MultiStatsClient) SetLogger ¶ added in v0.4.0
func (a MultiStatsClient) SetLogger(logger io.Writer)
SetLogger Sets the StatsD logger output type
func (MultiStatsClient) Tags ¶
func (a MultiStatsClient) Tags() []string
Tags returns tags from the first client.
func (MultiStatsClient) Timing ¶
func (a MultiStatsClient) Timing(name string, value time.Duration, rate float64)
Timing tracks timing information for a metric on all clients.
func (MultiStatsClient) WithTags ¶
func (a MultiStatsClient) WithTags(tags ...string) StatsClient
WithTags returns a new set of clients with the additional tags.
type Node ¶
type Node struct { Host string `json:"host"` InternalHost string `json:"internalHost"` // contains filtered or unexported fields }
Node represents a node in the cluster.
func (*Node) SetStatus ¶
func (n *Node) SetStatus(s *internal.NodeStatus)
SetStatus sets the NodeStatus.
type NodeSet ¶
type NodeSet interface { // Returns a list of all Nodes in the cluster Nodes() []*Node // Open starts any network activity implemented by the NodeSet Open() error }
NodeSet represents an interface for Node membership and inter-node communication.
type Nodes ¶
type Nodes []*Node
Nodes represents a list of nodes.
func (Nodes) ContainsHost ¶
ContainsHost returns true if host matches one of the node's host.
func (Nodes) FilterHost ¶
FilterHost returns a new list of nodes with host removed.
type PairHeap ¶
type PairHeap struct {
Pairs
}
PairHeap is a heap implementation over a group of Pairs.
type Pairs ¶
type Pairs []Pair
Pairs is a sortable slice of Pair objects.
func (*Pairs) Pop ¶
func (p *Pairs) Pop() interface{}
Pop removes the minimum element from the Pair slice.
type QueryRequest ¶
type QueryRequest struct { // Index to execute query against. Index string // The query string to parse and execute. Query string // The slices to include in the query execution. // If empty, all slices are included. Slices []uint64 // Return column attributes, if true. ColumnAttrs bool // Time granularity to use with the timestamp. Quantum TimeQuantum // If true, indicates that query is part of a larger distributed query. // If false, this request is on the originating node. Remote bool }
QueryRequest represent a request to process a query.
type QueryResponse ¶
type QueryResponse struct { // Result for each top-level query call. // Can be a Bitmap, Pairs, or uint64. Results []interface{} // Set of column attribute objects matching IDs returned in Result. ColumnAttrSets []*ColumnAttrSet // Error during parsing or execution. Err error }
QueryResponse represent a response from a processed query.
func (*QueryResponse) MarshalJSON ¶
func (resp *QueryResponse) MarshalJSON() ([]byte, error)
MarshalJSON marshals QueryResponse into a JSON-encoded byte slice
type RankCache ¶
type RankCache struct {
// contains filtered or unexported fields
}
RankCache represents a cache with sorted entries.
func NewRankCache ¶
NewRankCache returns a new instance of RankCache.
func (*RankCache) BulkAdd ¶
BulkAdd adds a count to the cache unsorted. You should Invalidate after completion.
func (*RankCache) Invalidate ¶
func (c *RankCache) Invalidate()
Invalidate recalculates the the entries by rank.
func (*RankCache) SetStats ¶ added in v0.4.0
func (c *RankCache) SetStats(s StatsClient)
SetStats defines the stats client used in the cache.
func (*RankCache) Top ¶
func (c *RankCache) Top() []BitmapPair
Top returns an ordered list of pairs.
type RoaringIterator ¶
type RoaringIterator struct {
// contains filtered or unexported fields
}
RoaringIterator converts a roaring.Iterator to output column/row pairs.
func NewRoaringIterator ¶
func NewRoaringIterator(itr *roaring.Iterator) *RoaringIterator
NewRoaringIterator returns a new iterator wrapping itr.
func (*RoaringIterator) Next ¶
func (itr *RoaringIterator) Next() (rowID, columnID uint64, eof bool)
Next returns the next column/row ID pair.
func (*RoaringIterator) Seek ¶
func (itr *RoaringIterator) Seek(bseek, pseek uint64)
Seek moves the cursor to a pair matching bseek/pseek. If the pair is not found then it moves to the next pair.
type Server ¶
type Server struct { // Data storage and HTTP interface. Holder *Holder Handler *Handler Broadcaster Broadcaster BroadcastReceiver BroadcastReceiver // Cluster configuration. // Host is replaced with actual host after opening if port is ":0". Network string Host string Cluster *Cluster // Background monitoring intervals. AntiEntropyInterval time.Duration PollingInterval time.Duration MetricInterval time.Duration // Misc options. MaxWritesPerRequest int LogOutput io.Writer // contains filtered or unexported fields }
Server represents a holder wrapped by a running HTTP server.
func (*Server) ClusterStatus ¶
ClusterStatus returns the NodeState for all nodes in the cluster.
func (*Server) HandleRemoteStatus ¶
HandleRemoteStatus receives incoming NodeState from remote nodes.
func (*Server) LocalStatus ¶
LocalStatus returns the state of the local node as well as the holder (indexes/frames) according to the local node. In a gossip implementation, memberlist.Delegate.LocalState() uses this. Server implements StatusHandler.
type SimpleCache ¶
type SimpleCache struct {
// contains filtered or unexported fields
}
SimpleCache implements BitmapCache it is meant to be a short-lived cache for cases where writes are continuing to access the same bit within a short time frame (i.e. good for write-heavy loads) A read-heavy use case would cause the cache to get bigger, potentially causing the node to run out of memory.
func (*SimpleCache) Add ¶
func (s *SimpleCache) Add(id uint64, b *Bitmap)
Add adds the bitmap to the cache, keyed on the id.
type SliceIterator ¶
type SliceIterator struct {
// contains filtered or unexported fields
}
SliceIterator iterates over a pair of row/column ID slices.
func NewSliceIterator ¶
func NewSliceIterator(rowIDs, columnIDs []uint64) *SliceIterator
NewSliceIterator returns an iterator to iterate over a set of row/column ID pairs. Both slices MUST have an equal length. Otherwise the function will panic.
func (*SliceIterator) Next ¶
func (itr *SliceIterator) Next() (rowID, columnID uint64, eof bool)
Next returns the next row/column ID pair.
func (*SliceIterator) Seek ¶
func (itr *SliceIterator) Seek(bseek, pseek uint64)
Seek moves the cursor to a given pair. If the pair is not found, the iterator seeks to the next pair.
type StaticNodeSet ¶
type StaticNodeSet struct {
// contains filtered or unexported fields
}
StaticNodeSet represents a basic NodeSet for testing.
func NewStaticNodeSet ¶
func NewStaticNodeSet() *StaticNodeSet
NewStaticNodeSet creates a statically defined NodeSet.
func (*StaticNodeSet) Join ¶
func (s *StaticNodeSet) Join(nodes []*Node) error
Join sets the NodeSet nodes to the slice of Nodes passed in.
func (*StaticNodeSet) Nodes ¶
func (s *StaticNodeSet) Nodes() []*Node
Nodes implements the NodeSet interface and returns a list of nodes in the cluster.
func (*StaticNodeSet) Open ¶
func (s *StaticNodeSet) Open() error
Open implements the NodeSet interface to start network activity, but for a static NodeSet it does nothing.
type StatsClient ¶
type StatsClient interface { // Returns a sorted list of tags on the client. Tags() []string // Returns a new client with additional tags appended. WithTags(tags ...string) StatsClient // Tracks the number of times something occurs per second. Count(name string, value int64, rate float64) // Tracks the number of times something occurs per second with custom tags CountWithCustomTags(name string, value int64, rate float64, tags []string) // Sets the value of a metric. Gauge(name string, value float64, rate float64) // Tracks statistical distribution of a metric. Histogram(name string, value float64, rate float64) // Tracks number of unique elements. Set(name string, value string, rate float64) // Tracks timing information for a metric. Timing(name string, value time.Duration, rate float64) // SetLogger Set the logger output type SetLogger(logger io.Writer) }
StatsClient represents a client to a stats server.
var NopStatsClient StatsClient
NopStatsClient represents a client that doesn't do anything.
type StatusHandler ¶
type StatusHandler interface { LocalStatus() (proto.Message, error) ClusterStatus() (proto.Message, error) HandleRemoteStatus(proto.Message) error }
StatusHandler specifies two methods which an object must implement to share state in the cluster. These are used by the GossipNodeSet to implement the LocalState and MergeRemoteState methods of memberlist.Delegate
type TimeQuantum ¶
type TimeQuantum string
TimeQuantum represents a time granularity for time-based bitmaps.
func ParseTimeQuantum ¶
func ParseTimeQuantum(v string) (TimeQuantum, error)
ParseTimeQuantum parses v into a time quantum.
func (TimeQuantum) HasDay ¶
func (q TimeQuantum) HasDay() bool
HasDay returns true if the quantum contains a 'D' unit.
func (TimeQuantum) HasHour ¶
func (q TimeQuantum) HasHour() bool
HasHour returns true if the quantum contains a 'H' unit.
func (TimeQuantum) HasMonth ¶
func (q TimeQuantum) HasMonth() bool
HasMonth returns true if the quantum contains a 'M' unit.
func (TimeQuantum) HasYear ¶
func (q TimeQuantum) HasYear() bool
HasYear returns true if the quantum contains a 'Y' unit.
func (TimeQuantum) Valid ¶
func (q TimeQuantum) Valid() bool
Valid returns true if q is a valid time quantum value.
type TopOptions ¶
type TopOptions struct { // Number of rows to return. N int // Bitmap to intersect with. Src *Bitmap // Specific rows to filter against. RowIDs []uint64 MinThreshold uint64 // Filter field name & values. FilterField string FilterValues []interface{} TanimotoThreshold uint64 }
TopOptions represents options passed into the Top() function.
type View ¶
type View struct { RowAttrStore *AttrStore LogOutput io.Writer // contains filtered or unexported fields }
View represents a container for frame data.
func (*View) CreateFragmentIfNotExists ¶
CreateFragmentIfNotExists returns a fragment in the view by slice.
func (*View) FragmentPath ¶
FragmentPath returns the path to a fragment in the view.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cmd contains all the pilosa subcommand definitions (1 per file).
|
Package cmd contains all the pilosa subcommand definitions (1 per file). |
pilosa
This is the entrypoint for the Pilosa binary.
|
This is the entrypoint for the Pilosa binary. |
package ctl contains all pilosa subcommands other than 'server'.
|
package ctl contains all pilosa subcommands other than 'server'. |
Package internal is a generated protocol buffer package.
|
Package internal is a generated protocol buffer package. |
Package pql defines the Pilosa Query Language.
|
Package pql defines the Pilosa Query Language. |
package roaring implements roaring bitmaps with support for incremental changes.
|
package roaring implements roaring bitmaps with support for incremental changes. |
Package server contains the `pilosa server` subcommand which runs Pilosa itself.
|
Package server contains the `pilosa server` subcommand which runs Pilosa itself. |
Package statik contains static assets for the Web UI.
|
Package statik contains static assets for the Web UI. |