Versions in this module Expand all Collapse all v1 v1.4.1 Sep 2, 2020 Changes in this version + const CacheTypeLRU + const CacheTypeNone + const CacheTypeRanked + const ClusterStateDegraded + const ClusterStateNormal + const ClusterStateResizing + const ClusterStateStarting + const DefaultCacheSize + const DefaultCacheType + const DefaultFieldType + const FieldTypeBool + const FieldTypeInt + const FieldTypeMutex + const FieldTypeSet + const FieldTypeTime + const HashBlockSize + const LogEntryTypeInsertColumn + const LogEntryTypeInsertRow + const ShardWidth + const TimeFormat + var BuildTime = "not recorded" + var Enterprise = "0" + var EnterpriseEnabled = false + var ErrBSIGroupExists = errors.New("bsigroup already exists") + var ErrBSIGroupNameRequired = errors.New("bsigroup name required") + var ErrBSIGroupNotFound = errors.New("bsigroup not found") + var ErrBSIGroupValueTooHigh = errors.New("bsigroup value too high") + var ErrBSIGroupValueTooLow = errors.New("bsigroup value too low") + var ErrClusterDoesNotOwnShard = errors.New("node does not own shard") + var ErrExpectedFieldListArgument = errors.New("expected field list argument") + var ErrFieldExists = errors.New("field already exists") + var ErrFieldNotFound = errors.New("field not found") + var ErrFieldRequired = errors.New("field required") + var ErrFieldsArgumentRequired = errors.New("fields argument required") + var ErrFragmentNotFound = errors.New("fragment not found") + var ErrHostRequired = errors.New("host required") + var ErrIndexExists = errors.New("index already exists") + var ErrIndexNotFound = errors.New("index not found") + var ErrIndexRequired = errors.New("index required") + var ErrInvalidBSIGroupRange = errors.New("invalid bsigroup range") + var ErrInvalidBSIGroupType = errors.New("invalid bsigroup type") + var ErrInvalidBSIGroupValueType = errors.New("invalid bsigroup value type") + var ErrInvalidBetweenValue = errors.New("invalid value for between operation") + var ErrInvalidCacheType = errors.New("invalid cache type") + var ErrInvalidRangeOperation = errors.New("invalid range operation") + var ErrInvalidTimeQuantum = errors.New("invalid time quantum") + var ErrInvalidView = errors.New("invalid view") + var ErrLabel = errors.New("invalid row or column label, must match [A-Za-z0-9_-]") + var ErrName = errors.New("invalid index or field name, must match [a-z0-9_-]") + var ErrNodeIDNotExists = errors.New("node with provided ID does not exist") + var ErrNodeNotCoordinator = errors.New("node is not the coordinator") + var ErrNotImplemented = errors.New("not implemented") + var ErrQueryCancelled = errors.New("query cancelled") + var ErrQueryRequired = errors.New("query required") + var ErrQueryTimeout = errors.New("query timeout") + var ErrReplicationNotSupported = errors.New("pilosa: replication not supported") + var ErrResizeNotRunning = errors.New("no resize job currently running") + var ErrTooManyWrites = errors.New("too many write commands") + var ErrTranslateReadTargetUndersized = errors.New("pilosa: translate read target is undersized") + var ErrTranslateStoreClosed = errors.New("pilosa: translate store closed") + var ErrTranslateStoreReadOnly = errors.New(...) + var ErrTranslateStoreReaderClosed = errors.New("pilosa: translate store reader closed") + var NopBroadcaster broadcaster = &nopBroadcaster + var Version = "v0.0.0" + func DecodeAttrs(v []byte) (map[string]interface{}, error) + func EncodeAttrs(attr map[string]interface{}) ([]byte, error) + func MarshalInternalMessage(m Message, s Serializer) ([]byte, error) + func NewRankCache(maxEntries uint32) *rankCache + func OptAPIServer(s *Server) apiOption + type API struct + Serializer Serializer + func NewAPI(opts ...apiOption) (*API, error) + func (api *API) AvailableShardsByIndex(ctx context.Context) map[string]*roaring.Bitmap + func (api *API) ClusterMessage(ctx context.Context, reqBody io.Reader) error + func (api *API) CreateField(ctx context.Context, indexName string, fieldName string, opts ...FieldOption) (*Field, error) + func (api *API) CreateIndex(ctx context.Context, indexName string, options IndexOptions) (*Index, error) + func (api *API) DeleteAvailableShard(_ context.Context, indexName, fieldName string, shardID uint64) error + func (api *API) DeleteField(ctx context.Context, indexName string, fieldName string) error + func (api *API) DeleteIndex(ctx context.Context, indexName string) error + func (api *API) DeleteView(ctx context.Context, indexName string, fieldName string, viewName string) error + func (api *API) ExportCSV(ctx context.Context, indexName string, fieldName string, shard uint64, ...) error + func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field, error) + func (api *API) FieldAttrDiff(ctx context.Context, indexName string, fieldName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) + func (api *API) FragmentBlockData(ctx context.Context, body io.Reader) ([]byte, error) + func (api *API) FragmentBlocks(ctx context.Context, indexName, fieldName, viewName string, shard uint64) ([]FragmentBlock, error) + func (api *API) FragmentData(ctx context.Context, indexName, fieldName, viewName string, shard uint64) (io.WriterTo, error) + func (api *API) GetTranslateData(ctx context.Context, offset int64) (io.ReadCloser, error) + func (api *API) Hosts(ctx context.Context) []*Node + func (api *API) Import(ctx context.Context, req *ImportRequest, opts ...ImportOption) error + func (api *API) ImportRoaring(ctx context.Context, indexName, fieldName string, shard uint64, remote bool, ...) (err error) + func (api *API) ImportValue(ctx context.Context, req *ImportValueRequest, opts ...ImportOption) error + func (api *API) Index(ctx context.Context, indexName string) (*Index, error) + func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) + func (api *API) Info() serverInfo + func (api *API) LongQueryTime() time.Duration + func (api *API) MaxShards(ctx context.Context) map[string]uint64 + func (api *API) Node() *Node + func (api *API) Query(ctx context.Context, req *QueryRequest) (QueryResponse, error) + func (api *API) RecalculateCaches(ctx context.Context) error + func (api *API) RemoveNode(id string) (*Node, error) + func (api *API) ResizeAbort() error + func (api *API) Schema(ctx context.Context) []*IndexInfo + func (api *API) SetCoordinator(ctx context.Context, id string) (oldNode, newNode *Node, err error) + func (api *API) ShardNodes(ctx context.Context, indexName string, shard uint64) ([]*Node, error) + func (api *API) State() string + func (api *API) StatsWithTags(tags []string) stats.StatsClient + func (api *API) TranslateKeys(body io.Reader) ([]byte, error) + func (api *API) Version() string + func (api *API) Views(ctx context.Context, indexName string, fieldName string) ([]*view, error) + type AttrBlock struct + Checksum []byte + ID uint64 + type AttrStore interface + Attrs func(id uint64) (m map[string]interface{}, err error) + BlockData func(i uint64) (map[uint64]map[string]interface{}, error) + Blocks func() ([]AttrBlock, error) + Close func() error + Open func() error + Path func() string + SetAttrs func(id uint64, m map[string]interface{}) error + SetBulkAttrs func(m map[uint64]map[string]interface{}) error + type BadRequestError struct + func NewBadRequestError(err error) BadRequestError + type Bit struct + ColumnID uint64 + ColumnKey string + RowID uint64 + RowKey string + Timestamp int64 + type BlockDataRequest struct + Block uint64 + Field string + Index string + Shard uint64 + View string + type BlockDataResponse struct + ColumnIDs []uint64 + RowIDs []uint64 + type ClusterStatus struct + ClusterID string + Nodes []*Node + State string + type CmdIO struct + Stderr io.Writer + Stdin io.Reader + Stdout io.Writer + func NewCmdIO(stdin io.Reader, stdout, stderr io.Writer) *CmdIO + type ColumnAttrSet struct + Attrs map[string]interface{} + ID uint64 + Key string + type ConflictError struct + type CreateFieldMessage struct + Field string + Index string + Meta *FieldOptions + type CreateIndexMessage struct + Index string + Meta *IndexOptions + type CreateShardMessage struct + Field string + Index string + Shard uint64 + type CreateViewMessage struct + Field string + Index string + View string + type DeleteAvailableShardMessage struct + Field string + Index string + ShardID uint64 + type DeleteFieldMessage struct + Field string + Index string + type DeleteIndexMessage struct + Index string + type DeleteViewMessage struct + Field string + Index string + View string + type Field struct + Stats stats.StatsClient + func NewField(path, index, name string, opts FieldOption) (*Field, error) + func (f *Field) AddRemoteAvailableShards(b *roaring.Bitmap) error + func (f *Field) AvailableShards() *roaring.Bitmap + func (f *Field) CacheSize() uint32 + func (f *Field) ClearBit(rowID, colID uint64) (changed bool, err error) + func (f *Field) Close() error + func (f *Field) Import(rowIDs, columnIDs []uint64, timestamps []*time.Time, opts ...ImportOption) error + func (f *Field) Index() string + func (f *Field) Max(filter *Row, name string) (max, count int64, err error) + func (f *Field) Min(filter *Row, name string) (min, count int64, err error) + func (f *Field) Name() string + func (f *Field) Open() error + func (f *Field) Options() FieldOptions + func (f *Field) Path() string + func (f *Field) Range(name string, op pql.Token, predicate int64) (*Row, error) + func (f *Field) RemoveAvailableShard(v uint64) error + func (f *Field) Row(rowID uint64) (*Row, error) + func (f *Field) RowAttrStore() AttrStore + func (f *Field) RowTime(rowID uint64, time time.Time, quantum string) (*Row, error) + func (f *Field) SetBit(rowID, colID uint64, t *time.Time) (changed bool, err error) + func (f *Field) SetCacheSize(v uint32) error + func (f *Field) SetValue(columnID uint64, value int64) (changed bool, err error) + func (f *Field) Sum(filter *Row, name string) (sum, count int64, err error) + func (f *Field) TimeQuantum() TimeQuantum + func (f *Field) Type() string + func (f *Field) Value(columnID uint64) (value int64, exists bool, err error) + type FieldInfo struct + Name string + Options FieldOptions + Views []*ViewInfo + type FieldOption func(fo *FieldOptions) error + func OptFieldKeys() FieldOption + func OptFieldTypeBool() FieldOption + func OptFieldTypeDefault() FieldOption + func OptFieldTypeInt(min, max int64) FieldOption + func OptFieldTypeMutex(cacheType string, cacheSize uint32) FieldOption + func OptFieldTypeSet(cacheType string, cacheSize uint32) FieldOption + func OptFieldTypeTime(timeQuantum TimeQuantum, opt ...bool) FieldOption + type FieldOptions struct + CacheSize uint32 + CacheType string + Keys bool + Max int64 + Min int64 + NoStandardView bool + TimeQuantum TimeQuantum + Type string + func (o *FieldOptions) MarshalJSON() ([]byte, error) + type FieldRow struct + Field string + RowID uint64 + RowKey string + func (fr FieldRow) MarshalJSON() ([]byte, error) + func (fr FieldRow) String() string + type FieldStatus struct + AvailableShards *roaring.Bitmap + Name string + type FieldValue struct + ColumnID uint64 + ColumnKey string + Value int64 + type FragmentBlock struct + Checksum []byte + ID int + type GCNotifier interface + AfterGC func() <-chan struct{} + Close func() + var NopGCNotifier GCNotifier = &nopGCNotifier{} + type GroupCount struct + Count uint64 + Group []FieldRow + func (g GroupCount) Compare(o GroupCount) int + type Handler interface + Close func() error + Serve func() error + var NopHandler Handler = nopHandler{} + type Hasher interface + Hash func(key uint64, n int) int + type Holder struct + Logger logger.Logger + NewAttrStore func(string) AttrStore + NewPrimaryTranslateStore func(interface{}) TranslateStore + Path string + Stats stats.StatsClient + func NewHolder() *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) Field(index, name string) *Field + func (h *Holder) HasData() (bool, error) + func (h *Holder) Index(name string) *Index + func (h *Holder) IndexPath(name string) string + func (h *Holder) Indexes() []*Index + func (h *Holder) Open() error + func (h *Holder) Schema() []*IndexInfo + type ImportOption func(*ImportOptions) error + func OptImportOptionsClear(c bool) ImportOption + func OptImportOptionsIgnoreKeyCheck(b bool) ImportOption + type ImportOptions struct + Clear bool + IgnoreKeyCheck bool + type ImportRequest struct + ColumnIDs []uint64 + ColumnKeys []string + Field string + Index string + RowIDs []uint64 + RowKeys []string + Shard uint64 + Timestamps []int64 + type ImportResponse struct + Err string + type ImportRoaringRequest struct + Clear bool + Views map[string][]byte + type ImportValueRequest struct + ColumnIDs []uint64 + ColumnKeys []string + Field string + Index string + Shard uint64 + Values []int64 + type Index struct + Stats stats.StatsClient + func NewIndex(path, name string) (*Index, error) + func (i *Index) AvailableShards() *roaring.Bitmap + func (i *Index) Close() error + func (i *Index) ColumnAttrStore() AttrStore + func (i *Index) CreateField(name string, opts ...FieldOption) (*Field, error) + func (i *Index) CreateFieldIfNotExists(name string, opts ...FieldOption) (*Field, error) + func (i *Index) DeleteField(name string) error + func (i *Index) Field(name string) *Field + func (i *Index) Fields() []*Field + func (i *Index) Keys() bool + func (i *Index) Name() string + func (i *Index) Open() error + func (i *Index) Options() IndexOptions + func (i *Index) Path() string + type IndexInfo struct + Fields []*FieldInfo + Name string + Options IndexOptions + type IndexOptions struct + Keys bool + TrackExistence bool + type IndexStatus struct + Fields []*FieldStatus + Name string + type InternalClient interface + BlockData func(ctx context.Context, uri *URI, index, field, view string, shard uint64, ...) ([]uint64, []uint64, error) + ColumnAttrDiff func(ctx context.Context, uri *URI, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) + CreateField func(ctx context.Context, index, field string) error + CreateFieldWithOptions func(ctx context.Context, index, field string, opt FieldOptions) error + CreateIndex func(ctx context.Context, index string, opt IndexOptions) error + EnsureField func(ctx context.Context, indexName string, fieldName string) error + EnsureFieldWithOptions func(ctx context.Context, index, field string, opt FieldOptions) error + EnsureIndex func(ctx context.Context, name string, options IndexOptions) error + ExportCSV func(ctx context.Context, index, field string, shard uint64, w io.Writer) error + FragmentBlocks func(ctx context.Context, uri *URI, index, field, view string, shard uint64) ([]FragmentBlock, error) + FragmentNodes func(ctx context.Context, index string, shard uint64) ([]*Node, error) + Import func(ctx context.Context, index, field string, shard uint64, bits []Bit, ...) error + ImportK func(ctx context.Context, index, field string, bits []Bit, opts ...ImportOption) error + ImportRoaring func(ctx context.Context, uri *URI, index, field string, shard uint64, remote bool, ...) error + ImportValue func(ctx context.Context, index, field string, shard uint64, vals []FieldValue, ...) error + ImportValueK func(ctx context.Context, index, field string, vals []FieldValue, ...) error + MaxShardByIndex func(ctx context.Context) (map[string]uint64, error) + Nodes func(ctx context.Context) ([]*Node, error) + Query func(ctx context.Context, index string, queryRequest *QueryRequest) (*QueryResponse, error) + QueryNode func(ctx context.Context, uri *URI, index string, queryRequest *QueryRequest) (*QueryResponse, error) + RetrieveShardFromURI func(ctx context.Context, index, field, view string, shard uint64, uri URI) (io.ReadCloser, error) + RowAttrDiff func(ctx context.Context, uri *URI, index, field string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) + Schema func(ctx context.Context) ([]*IndexInfo, error) + SendMessage func(ctx context.Context, uri *URI, msg []byte) error + type InternalQueryClient interface + QueryNode func(ctx context.Context, uri *URI, index string, queryRequest *QueryRequest) (*QueryResponse, error) + type LogEntry struct + Field []byte + IDs []uint64 + Index []byte + Keys [][]byte + Length uint64 + Type uint8 + func (e *LogEntry) ReadFrom(r io.Reader) (_ int64, err error) + func (e *LogEntry) WriteTo(w io.Writer) (_ int64, err error) + type Message interface + type Node struct + ID string + IsCoordinator bool + State string + URI URI + func (n Node) String() string + type NodeEvent struct + Event NodeEventType + Node *Node + type NodeEventType int + const NodeJoin + const NodeLeave + const NodeUpdate + type NodeStateMessage struct + NodeID string + State string + type NodeStatus struct + Indexes []*IndexStatus + Node *Node + Schema *Schema + type Nodes []*Node + func (a Nodes) Clone() []*Node + func (a Nodes) Contains(n *Node) bool + func (a Nodes) ContainsID(id string) bool + func (a Nodes) Filter(n *Node) []*Node + func (a Nodes) FilterID(id string) []*Node + func (a Nodes) FilterURI(uri URI) []*Node + func (a Nodes) IDs() []string + func (a Nodes) URIs() []URI + type NotFoundError struct + type Pair struct + Count uint64 + ID uint64 + Key string + type Pairs []Pair + func (p *Pairs) Pop() interface{} + func (p *Pairs) Push(x interface{}) + func (p Pairs) Add(other []Pair) []Pair + func (p Pairs) Keys() []uint64 + func (p Pairs) Len() int + func (p Pairs) Less(i, j int) bool + func (p Pairs) String() string + func (p Pairs) Swap(i, j int) + type QueryRequest struct + ColumnAttrs bool + ExcludeColumns bool + ExcludeRowAttrs bool + Index string + Query string + Remote bool + Shards []uint64 + type QueryResponse struct + ColumnAttrSets []*ColumnAttrSet + Err error + Results []interface{} + func (resp *QueryResponse) MarshalJSON() ([]byte, error) + type RecalculateCaches struct + type ResizeInstruction struct + ClusterStatus *ClusterStatus + Coordinator *Node + JobID int64 + Node *Node + NodeStatus *NodeStatus + Sources []*ResizeSource + type ResizeInstructionComplete struct + Error string + JobID int64 + Node *Node + type ResizeSource struct + Field string + Index string + Node *Node + Shard uint64 + View string + type Row struct + Attrs map[string]interface{} + Keys []string + func NewRow(columns ...uint64) *Row + func (r *Row) Columns() []uint64 + func (r *Row) Count() uint64 + func (r *Row) Difference(other *Row) *Row + func (r *Row) Intersect(other *Row) *Row + func (r *Row) MarshalJSON() ([]byte, error) + func (r *Row) Merge(other *Row) + func (r *Row) Segments() []rowSegment + func (r *Row) SetBit(i uint64) (changed bool) + func (r *Row) Union(other *Row) *Row + func (r *Row) Xor(other *Row) *Row + type RowIDs []uint64 + type RowIdentifiers struct + Keys []string + Rows []uint64 + type Schema struct + Indexes []*IndexInfo + type Serializer interface + Marshal func(Message) ([]byte, error) + Unmarshal func([]byte, Message) error + type Server struct + func NewServer(opts ...ServerOption) (*Server, error) + func (s *Server) Close() error + func (s *Server) Holder() *Holder + func (s *Server) NodeID() string + func (s *Server) Open() error + func (s *Server) SendAsync(m Message) error + func (s *Server) SendSync(m Message) error + func (s *Server) SendTo(to *Node, m Message) error + func (s *Server) SyncData() error + type ServerOption func(s *Server) error + func OptServerAntiEntropyInterval(interval time.Duration) ServerOption + func OptServerAttrStoreFunc(af func(string) AttrStore) ServerOption + func OptServerClusterDisabled(disabled bool, hosts []string) ServerOption + func OptServerClusterHasher(h Hasher) ServerOption + func OptServerDataDir(dir string) ServerOption + func OptServerDiagnosticsInterval(dur time.Duration) ServerOption + func OptServerGCNotifier(gcn GCNotifier) ServerOption + func OptServerInternalClient(c InternalClient) ServerOption + func OptServerIsCoordinator(is bool) ServerOption + func OptServerLogger(l logger.Logger) ServerOption + func OptServerLongQueryTime(dur time.Duration) ServerOption + func OptServerMaxWritesPerRequest(n int) ServerOption + func OptServerMetricInterval(dur time.Duration) ServerOption + func OptServerNodeID(nodeID string) ServerOption + func OptServerPrimaryTranslateStore(store TranslateStore) ServerOption + func OptServerPrimaryTranslateStoreFunc(tf func(interface{}) TranslateStore) ServerOption + func OptServerReplicaN(n int) ServerOption + func OptServerSerializer(ser Serializer) ServerOption + func OptServerStatsClient(sc stats.StatsClient) ServerOption + func OptServerSystemInfo(si SystemInfo) ServerOption + func OptServerTranslateFileMapSize(mapSize int) ServerOption + func OptServerURI(uri *URI) ServerOption + type SetCoordinatorMessage struct + New *Node + type SystemInfo interface + CPUArch func() string + Family func() (string, error) + KernelVersion func() (string, error) + MemFree func() (uint64, error) + MemTotal func() (uint64, error) + MemUsed func() (uint64, error) + OSVersion func() (string, error) + Platform func() (string, error) + Uptime func() (uint64, error) + type TimeQuantum string + func (q *TimeQuantum) Set(value string) error + func (q TimeQuantum) HasDay() bool + func (q TimeQuantum) HasHour() bool + func (q TimeQuantum) HasMonth() bool + func (q TimeQuantum) HasYear() bool + func (q TimeQuantum) String() string + func (q TimeQuantum) Type() string + func (q TimeQuantum) Valid() bool + type Topology struct + func (t *Topology) ContainsID(id string) bool + type TranslateFile struct + Path string + PrimaryTranslateStore TranslateStore + func NewTranslateFile(opts ...TranslateFileOption) *TranslateFile + func (s *TranslateFile) Close() (err error) + func (s *TranslateFile) Closing() <-chan struct{} + func (s *TranslateFile) Open() (err error) + func (s *TranslateFile) Reader(ctx context.Context, offset int64) (io.ReadCloser, error) + func (s *TranslateFile) SetPrimaryStore(id string, ts TranslateStore) + func (s *TranslateFile) TranslateColumnToString(index string, value uint64) (string, error) + func (s *TranslateFile) TranslateColumnsToUint64(index string, values []string) ([]uint64, error) + func (s *TranslateFile) TranslateRowToString(index, field string, id uint64) (string, error) + func (s *TranslateFile) TranslateRowsToUint64(index, field string, values []string) ([]uint64, error) + func (s *TranslateFile) WriteNotify() <-chan struct{} + type TranslateFileOption func(f *TranslateFile) error + func OptTranslateFileLogger(l logger.Logger) TranslateFileOption + func OptTranslateFileMapSize(mapSize int) TranslateFileOption + type TranslateKeysRequest struct + Field string + Index string + Keys []string + type TranslateKeysResponse struct + IDs []uint64 + type TranslateStore interface + Reader func(ctx context.Context, off int64) (io.ReadCloser, error) + TranslateColumnToString func(index string, values uint64) (string, error) + TranslateColumnsToUint64 func(index string, values []string) ([]uint64, error) + TranslateRowToString func(index, field string, values uint64) (string, error) + TranslateRowsToUint64 func(index, field string, values []string) ([]uint64, error) + type URI struct + Host string + Port uint16 + Scheme string + func AddressWithDefaults(addr string) (*URI, error) + func NewURIFromAddress(address string) (*URI, error) + func NewURIFromHostPort(host string, port uint16) (*URI, error) + func (u *URI) HostPort() string + func (u *URI) MarshalJSON() ([]byte, error) + func (u *URI) Path(path string) string + func (u *URI) Set(value string) error + func (u *URI) SetPort(port uint16) + func (u *URI) UnmarshalJSON(b []byte) error + func (u URI) String() string + func (u URI) Type() string + type URIs []URI + func (u URIs) HostPortStrings() []string + type UpdateCoordinatorMessage struct + New *Node + type ValCount struct + Count int64 + Val int64 + type ViewInfo struct + Name string