Documentation ¶
Index ¶
- Constants
- Variables
- func GetHTTPClient(t *tls.Config) *http.Client
- func GetOpenTranslateReaderFunc(client *http.Client) pilosa.OpenTranslateReaderFunc
- func GetOpenTranslateReaderWithLockerFunc(client *http.Client, locker sync.Locker) pilosa.OpenTranslateReaderFunc
- func NewStatikHandler(h *Handler) statikHandler
- func OptHandlerAPI(api *pilosa.API) handlerOption
- func OptHandlerAllowedOrigins(origins []string) handlerOption
- func OptHandlerCloseTimeout(d time.Duration) handlerOption
- func OptHandlerFileSystem(fs pilosa.FileSystem) handlerOption
- func OptHandlerListener(ln net.Listener) handlerOption
- func OptHandlerLogger(logger logger.Logger) handlerOption
- func OptHandlerMiddleware(middleware func(http.Handler) http.Handler) handlerOption
- type Bits
- func (p Bits) ColumnIDs() []uint64
- func (p Bits) ColumnKeys() []string
- func (p Bits) GroupByShard() map[uint64][]pilosa.Bit
- func (p Bits) HasColumnKeys() bool
- func (p Bits) HasRowKeys() bool
- func (p Bits) Len() int
- func (p Bits) Less(i, j int) bool
- func (p Bits) RowIDs() []uint64
- func (p Bits) RowKeys() []string
- func (p Bits) Swap(i, j int)
- func (p Bits) Timestamps() []int64
- type BitsByPos
- type Error
- type FieldValues
- func (p FieldValues) ColumnIDs() []uint64
- func (p FieldValues) ColumnKeys() []string
- func (p FieldValues) GroupByShard() map[uint64][]pilosa.FieldValue
- func (p FieldValues) HasColumnKeys() bool
- func (p FieldValues) Len() int
- func (p FieldValues) Less(i, j int) bool
- func (p FieldValues) Swap(i, j int)
- func (p FieldValues) Values() []int64
- type Handler
- type InternalClient
- func (c *InternalClient) BlockData(ctx context.Context, uri *pilosa.URI, index, field, view string, shard uint64, ...) ([]uint64, []uint64, error)
- func (c *InternalClient) ColumnAttrDiff(ctx context.Context, uri *pilosa.URI, index string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error)
- func (c *InternalClient) CreateField(ctx context.Context, index, field string) error
- func (c *InternalClient) CreateFieldKeysNode(ctx context.Context, uri *pilosa.URI, index string, field string, ...) (transMap map[string]uint64, err error)
- func (c *InternalClient) CreateFieldWithOptions(ctx context.Context, index, field string, opt pilosa.FieldOptions) error
- func (c *InternalClient) CreateIndex(ctx context.Context, index string, opt pilosa.IndexOptions) error
- func (c *InternalClient) CreateIndexKeysNode(ctx context.Context, uri *pilosa.URI, index string, keys ...string) (transMap map[string]uint64, err error)
- func (c *InternalClient) EnsureField(ctx context.Context, indexName string, fieldName string) error
- func (c *InternalClient) EnsureFieldWithOptions(ctx context.Context, indexName string, fieldName string, ...) error
- func (c *InternalClient) EnsureIndex(ctx context.Context, name string, options pilosa.IndexOptions) error
- func (c *InternalClient) ExportCSV(ctx context.Context, index, field string, shard uint64, w io.Writer) error
- func (c *InternalClient) FindFieldKeysNode(ctx context.Context, uri *pilosa.URI, index string, field string, ...) (transMap map[string]uint64, err error)
- func (c *InternalClient) FindIndexKeysNode(ctx context.Context, uri *pilosa.URI, index string, keys ...string) (transMap map[string]uint64, err error)
- func (c *InternalClient) FinishTransaction(ctx context.Context, id string) (*pilosa.Transaction, error)
- func (c *InternalClient) FragmentBlocks(ctx context.Context, uri *pilosa.URI, index, field, view string, shard uint64) ([]pilosa.FragmentBlock, error)
- func (c *InternalClient) FragmentNodes(ctx context.Context, index string, shard uint64) ([]*pilosa.Node, error)
- func (c *InternalClient) GetNodeUsage(ctx context.Context, uri *pilosa.URI) (map[string]pilosa.NodeUsage, error)
- func (c *InternalClient) GetPastQueries(ctx context.Context, uri *pilosa.URI) ([]pilosa.PastQueryStatus, error)
- func (c *InternalClient) GetTransaction(ctx context.Context, id string) (*pilosa.Transaction, error)
- func (c *InternalClient) Import(ctx context.Context, index, field string, shard uint64, bits []pilosa.Bit, ...) error
- func (c *InternalClient) ImportColumnAttrs(ctx context.Context, uri *pilosa.URI, index string, ...) error
- func (c *InternalClient) ImportFieldKeys(ctx context.Context, uri *pilosa.URI, index, field string, remote bool, ...) error
- func (c *InternalClient) ImportIndexKeys(ctx context.Context, uri *pilosa.URI, index string, partitionID int, ...) error
- func (c *InternalClient) ImportK(ctx context.Context, index, field string, bits []pilosa.Bit, ...) error
- func (c *InternalClient) ImportRoaring(ctx context.Context, uri *pilosa.URI, index, field string, shard uint64, ...) error
- func (c *InternalClient) ImportValue(ctx context.Context, index, field string, shard uint64, ...) error
- func (c *InternalClient) ImportValue2(ctx context.Context, req *pilosa.ImportValueRequest, ...) error
- func (c *InternalClient) ImportValueK(ctx context.Context, index, field string, vals []pilosa.FieldValue, ...) error
- func (c *InternalClient) MaxShardByIndex(ctx context.Context) (map[string]uint64, error)
- func (c *InternalClient) Nodes(ctx context.Context) ([]*pilosa.Node, error)
- func (c *InternalClient) PostSchema(ctx context.Context, uri *pilosa.URI, s *pilosa.Schema, remote bool) error
- func (c *InternalClient) Query(ctx context.Context, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error)
- func (c *InternalClient) QueryNode(ctx context.Context, uri *pilosa.URI, index string, ...) (*pilosa.QueryResponse, error)
- func (c *InternalClient) RetrieveShardFromURI(ctx context.Context, index, field, view string, shard uint64, uri pilosa.URI) (io.ReadCloser, error)
- func (c *InternalClient) RetrieveTranslatePartitionFromURI(ctx context.Context, index string, partition int, uri pilosa.URI) (io.ReadCloser, error)
- func (c *InternalClient) RowAttrDiff(ctx context.Context, uri *pilosa.URI, index, field string, ...) (map[uint64]map[string]interface{}, error)
- func (c *InternalClient) Schema(ctx context.Context) ([]*pilosa.IndexInfo, error)
- func (c *InternalClient) SendMessage(ctx context.Context, uri *pilosa.URI, msg []byte) error
- func (c *InternalClient) StartTransaction(ctx context.Context, id string, timeout time.Duration, exclusive bool) (*pilosa.Transaction, error)
- func (c *InternalClient) Transactions(ctx context.Context) (map[string]*pilosa.Transaction, error)
- func (c *InternalClient) TranslateIDsNode(ctx context.Context, uri *pilosa.URI, index, field string, ids []uint64) ([]string, error)
- func (c *InternalClient) TranslateKeysNode(ctx context.Context, uri *pilosa.URI, index, field string, keys []string, ...) ([]uint64, error)
- type TransactionResponse
- type TranslateEntryReader
Constants ¶
const ( QueryResultTypeRow uint32 = iota QueryResultTypePairs QueryResultTypeUint64 )
QueryResult types.
Variables ¶
var DoPerQueryProfiling = false
Functions ¶
func GetOpenTranslateReaderWithLockerFunc ¶ added in v2.2.0
func NewStatikHandler ¶ added in v2.2.0
func NewStatikHandler(h *Handler) statikHandler
NewStatikHandler returns a new instance of statikHandler
func OptHandlerAPI ¶
func OptHandlerAPI(api *pilosa.API) handlerOption
func OptHandlerAllowedOrigins ¶
func OptHandlerAllowedOrigins(origins []string) handlerOption
func OptHandlerCloseTimeout ¶
OptHandlerCloseTimeout controls how long to wait for the http Server to shutdown cleanly before forcibly destroying it. Default is 30 seconds.
func OptHandlerFileSystem ¶ added in v2.2.0
func OptHandlerFileSystem(fs pilosa.FileSystem) handlerOption
func OptHandlerListener ¶
func OptHandlerLogger ¶
Types ¶
type Bits ¶
type Bits []pilosa.Bit
Bits is a slice of Bit.
func (Bits) ColumnKeys ¶
ColumnKeys returns a slice of all the column keys.
func (Bits) GroupByShard ¶
GroupByShard returns a map of bits by shard.
func (Bits) HasColumnKeys ¶
HasColumnKeys returns true if any values use a column key.
func (Bits) HasRowKeys ¶
HasRowKeys returns true if any values use a row key.
func (Bits) Timestamps ¶
Timestamps returns a slice of all the timestamps.
type Error ¶
type Error struct { // Human-readable message. Message string `json:"message"` }
Error defines a standard application error.
type FieldValues ¶
type FieldValues []pilosa.FieldValue
FieldValues represents a slice of field values.
func (FieldValues) ColumnIDs ¶
func (p FieldValues) ColumnIDs() []uint64
ColumnIDs returns a slice of all the column IDs.
func (FieldValues) ColumnKeys ¶
func (p FieldValues) ColumnKeys() []string
ColumnKeys returns a slice of all the column keys.
func (FieldValues) GroupByShard ¶
func (p FieldValues) GroupByShard() map[uint64][]pilosa.FieldValue
GroupByShard returns a map of field values by shard.
func (FieldValues) HasColumnKeys ¶
func (p FieldValues) HasColumnKeys() bool
HasColumnKeys returns true if any values use a column key.
func (FieldValues) Len ¶
func (p FieldValues) Len() int
func (FieldValues) Less ¶
func (p FieldValues) Less(i, j int) bool
func (FieldValues) Swap ¶
func (p FieldValues) Swap(i, j int)
func (FieldValues) Values ¶
func (p FieldValues) Values() []int64
Values returns a slice of all the values.
type Handler ¶
Handler represents an HTTP handler.
func NewHandler ¶
NewHandler returns a new instance of Handler with a default logger.
type InternalClient ¶
type InternalClient struct {
// contains filtered or unexported fields
}
InternalClient represents a client to the Pilosa cluster.
func NewInternalClient ¶
func NewInternalClient(host string, remoteClient *http.Client) (*InternalClient, error)
NewInternalClient returns a new instance of InternalClient to connect to host.
func NewInternalClientFromURI ¶
func NewInternalClientFromURI(defaultURI *pilosa.URI, remoteClient *http.Client) *InternalClient
func (*InternalClient) BlockData ¶
func (c *InternalClient) BlockData(ctx context.Context, uri *pilosa.URI, index, field, view string, shard uint64, block int) ([]uint64, []uint64, error)
BlockData returns row/column id pairs for a block.
func (*InternalClient) ColumnAttrDiff ¶
func (c *InternalClient) ColumnAttrDiff(ctx context.Context, uri *pilosa.URI, index string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error)
ColumnAttrDiff returns data from differing blocks on a remote host.
func (*InternalClient) CreateField ¶
func (c *InternalClient) CreateField(ctx context.Context, index, field string) error
func (*InternalClient) CreateFieldKeysNode ¶ added in v2.1.8
func (*InternalClient) CreateFieldWithOptions ¶
func (c *InternalClient) CreateFieldWithOptions(ctx context.Context, index, field string, opt pilosa.FieldOptions) error
CreateField creates a new field on the server.
func (*InternalClient) CreateIndex ¶
func (c *InternalClient) CreateIndex(ctx context.Context, index string, opt pilosa.IndexOptions) error
CreateIndex creates a new index on the server.
func (*InternalClient) CreateIndexKeysNode ¶ added in v2.1.8
func (*InternalClient) EnsureField ¶
func (*InternalClient) EnsureFieldWithOptions ¶
func (*InternalClient) EnsureIndex ¶
func (c *InternalClient) EnsureIndex(ctx context.Context, name string, options pilosa.IndexOptions) error
func (*InternalClient) ExportCSV ¶
func (c *InternalClient) ExportCSV(ctx context.Context, index, field string, shard uint64, w io.Writer) error
ExportCSV bulk exports data for a single shard from a host to CSV format.
func (*InternalClient) FindFieldKeysNode ¶ added in v2.1.8
func (*InternalClient) FindIndexKeysNode ¶ added in v2.1.8
func (*InternalClient) FinishTransaction ¶
func (c *InternalClient) FinishTransaction(ctx context.Context, id string) (*pilosa.Transaction, error)
func (*InternalClient) FragmentBlocks ¶
func (c *InternalClient) FragmentBlocks(ctx context.Context, uri *pilosa.URI, index, field, view string, shard uint64) ([]pilosa.FragmentBlock, error)
FragmentBlocks returns a list of block checksums for a fragment on a host. Only returns blocks which contain data.
func (*InternalClient) FragmentNodes ¶
func (c *InternalClient) FragmentNodes(ctx context.Context, index string, shard uint64) ([]*pilosa.Node, error)
FragmentNodes returns a list of nodes that own a shard.
func (*InternalClient) GetNodeUsage ¶ added in v2.3.0
func (c *InternalClient) GetNodeUsage(ctx context.Context, uri *pilosa.URI) (map[string]pilosa.NodeUsage, error)
GetNodeUsage retrieves the size-on-disk information for the specified node.
func (*InternalClient) GetPastQueries ¶ added in v2.4.0
func (c *InternalClient) GetPastQueries(ctx context.Context, uri *pilosa.URI) ([]pilosa.PastQueryStatus, error)
GetPastQueries retrieves the query history log for the specified node.
func (*InternalClient) GetTransaction ¶
func (c *InternalClient) GetTransaction(ctx context.Context, id string) (*pilosa.Transaction, error)
func (*InternalClient) Import ¶
func (c *InternalClient) Import(ctx context.Context, index, field string, shard uint64, bits []pilosa.Bit, opts ...pilosa.ImportOption) error
Import bulk imports bits for a single shard to a host.
func (*InternalClient) ImportColumnAttrs ¶
func (c *InternalClient) ImportColumnAttrs(ctx context.Context, uri *pilosa.URI, index string, req *pilosa.ImportColumnAttrsRequest) error
ImportColumnAttrs does bulk import of column attrs
func (*InternalClient) ImportFieldKeys ¶ added in v2.2.0
func (*InternalClient) ImportIndexKeys ¶ added in v2.2.0
func (*InternalClient) ImportK ¶
func (c *InternalClient) ImportK(ctx context.Context, index, field string, bits []pilosa.Bit, opts ...pilosa.ImportOption) error
ImportK bulk imports bits specified by string keys to a host.
func (*InternalClient) ImportRoaring ¶
func (c *InternalClient) ImportRoaring(ctx context.Context, uri *pilosa.URI, index, field string, shard uint64, remote bool, req *pilosa.ImportRoaringRequest) error
ImportRoaring does fast import of raw bits in roaring format (pilosa or official format, see API.ImportRoaring).
func (*InternalClient) ImportValue ¶
func (c *InternalClient) ImportValue(ctx context.Context, index, field string, shard uint64, vals []pilosa.FieldValue, opts ...pilosa.ImportOption) error
ImportValue bulk imports field values for a single shard to a host.
func (*InternalClient) ImportValue2 ¶
func (c *InternalClient) ImportValue2(ctx context.Context, req *pilosa.ImportValueRequest, options *pilosa.ImportOptions) error
ImportValue2 is a simplified ImportValue method which just uses the ImportValueRequest instead of splitting up ImportValue and ImportValueK... it also supports importing float values. The idea being that (assuming it works) this will become the default (and be renamed) for 2.0, and we can deprecate the other methods.
func (*InternalClient) ImportValueK ¶
func (c *InternalClient) ImportValueK(ctx context.Context, index, field string, vals []pilosa.FieldValue, opts ...pilosa.ImportOption) error
ImportValueK bulk imports keyed field values to a host.
func (*InternalClient) MaxShardByIndex ¶
MaxShardByIndex returns the number of shards on a server by index.
func (*InternalClient) Nodes ¶
func (c *InternalClient) Nodes(ctx context.Context) ([]*pilosa.Node, error)
Nodes returns a list of all nodes.
func (*InternalClient) PostSchema ¶
func (c *InternalClient) PostSchema(ctx context.Context, uri *pilosa.URI, s *pilosa.Schema, remote bool) error
func (*InternalClient) Query ¶
func (c *InternalClient) Query(ctx context.Context, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error)
Query executes query against the index.
func (*InternalClient) QueryNode ¶
func (c *InternalClient) QueryNode(ctx context.Context, uri *pilosa.URI, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error)
QueryNode executes query against the index, sending the request to the node specified.
func (*InternalClient) RetrieveShardFromURI ¶
func (c *InternalClient) RetrieveShardFromURI(ctx context.Context, index, field, view string, shard uint64, uri pilosa.URI) (io.ReadCloser, error)
RetrieveShardFromURI returns a ReadCloser which contains the data of the specified shard from the specified node. Caller *must* close the returned ReadCloser or risk leaking goroutines/tcp connections.
func (*InternalClient) RetrieveTranslatePartitionFromURI ¶
func (c *InternalClient) RetrieveTranslatePartitionFromURI(ctx context.Context, index string, partition int, uri pilosa.URI) (io.ReadCloser, error)
RetrieveTranslatePartitionFromURI returns a ReadCloser which contains the data of the specified translate partition from the specified node. Caller *must* close the returned ReadCloser or risk leaking goroutines/tcp connections.
func (*InternalClient) RowAttrDiff ¶
func (c *InternalClient) RowAttrDiff(ctx context.Context, uri *pilosa.URI, index, field string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error)
RowAttrDiff returns data from differing blocks on a remote host.
func (*InternalClient) Schema ¶
func (c *InternalClient) Schema(ctx context.Context) ([]*pilosa.IndexInfo, error)
Schema returns all index and field schema information.
func (*InternalClient) SendMessage ¶
func (c *InternalClient) SendMessage(ctx context.Context, uri *pilosa.URI, msg []byte) error
SendMessage posts a message synchronously.
func (*InternalClient) StartTransaction ¶
func (*InternalClient) Transactions ¶
func (c *InternalClient) Transactions(ctx context.Context) (map[string]*pilosa.Transaction, error)
func (*InternalClient) TranslateIDsNode ¶
func (c *InternalClient) TranslateIDsNode(ctx context.Context, uri *pilosa.URI, index, field string, ids []uint64) ([]string, error)
TranslateIDsNode sends an id translation request to a specific node.
func (*InternalClient) TranslateKeysNode ¶
func (c *InternalClient) TranslateKeysNode(ctx context.Context, uri *pilosa.URI, index, field string, keys []string, writable bool) ([]uint64, error)
TranslateKeysNode function is mainly called to translate keys from coordinator node. If coordinator node returns 404 error the function wraps it with pilosa.ErrTranslatingKeyNotFound.
type TransactionResponse ¶
type TransactionResponse struct { Transaction *pilosa.Transaction `json:"transaction,omitempty"` Error string `json:"error,omitempty"` }
type TranslateEntryReader ¶
type TranslateEntryReader struct { // Lookup of offsets for each index & field. // Must be set before calling Open(). Offsets pilosa.TranslateOffsetMap // URL to stream entries from. // Must be set before calling Open(). URL string HTTPClient *http.Client Logger logger.Logger // contains filtered or unexported fields }
TranslateEntryReader represents an implementation of pilosa.TranslateEntryReader. It consolidates all index & field translate entries into a single reader.
func NewTranslateEntryReader ¶
func NewTranslateEntryReader(ctx context.Context, client *http.Client) *TranslateEntryReader
NewTranslateEntryReader returns a new instance of TranslateEntryReader.
func (*TranslateEntryReader) Close ¶
func (r *TranslateEntryReader) Close() error
Close stops the reader.
func (*TranslateEntryReader) Open ¶
func (r *TranslateEntryReader) Open() error
Open initiates the reader.
func (*TranslateEntryReader) ReadEntry ¶
func (r *TranslateEntryReader) ReadEntry(entry *pilosa.TranslateEntry) error
ReadEntry reads the next entry from the stream into entry. Returns io.EOF at the end of the stream.