Documentation ¶
Index ¶
- func CheckClusterState(m *Command, state string, n int) bool
- func CheckGroupBy(t *testing.T, expected, results []pilosa.GroupCount)
- func CompareTransactions(t *testing.T, trns1, trns2 *pilosa.Transaction)
- func Do(t testing.TB, method, urlStr string, body string) *httpResponse
- func MustMarshalJSON(v interface{}) []byte
- func MustNewHTTPRequest(method, urlStr string, body io.Reader) *gohttp.Request
- func NewBufferLogger() *bufferLogger
- func OptAllowedOrigins(origins []string) server.CommandOption
- func OptTxSrc(src string) server.CommandOption
- func RetryUntil(timeout time.Duration, fn func() error) (err error)
- func TestField_SetCacheSize(t *testing.T)
- type Cluster
- func (c *Cluster) AwaitCoordinatorState(expectedState string, timeout time.Duration) error
- func (c *Cluster) AwaitState(expectedState string, timeout time.Duration) (err error)
- func (c *Cluster) Close() error
- func (c *Cluster) CloseAndRemove(n int) error
- func (c *Cluster) CreateField(t testing.TB, index string, iopts pilosa.IndexOptions, field string, ...) *pilosa.Field
- func (c *Cluster) ExceptionalState(expectedState string) error
- func (c *Cluster) GetHolder(n int) *Holder
- func (c *Cluster) GetNode(n int) *Command
- func (c *Cluster) ImportBits(t testing.TB, index, field string, rowcols [][2]uint64)
- func (c *Cluster) ImportIDKey(t testing.TB, index, field string, pairs []KeyID)
- func (c *Cluster) ImportIntID(t testing.TB, index, field string, pairs []IntID)
- func (c *Cluster) ImportIntKey(t testing.TB, index, field string, pairs []IntKey)
- func (c *Cluster) ImportKeyKey(t testing.TB, index, field string, valAndRecKeys [][2]string)
- func (c *Cluster) ImportTimeQuantumKey(t testing.TB, index, field string, entries []TimeQuantumKey)
- func (c *Cluster) Len() int
- func (c *Cluster) Query(t testing.TB, index, query string) pilosa.QueryResponse
- func (c *Cluster) QueryGRPC(t testing.TB, index, query string) *proto.TableResponse
- func (c *Cluster) QueryHTTP(t testing.TB, index, query string) (string, error)
- func (c *Cluster) Start() error
- type Command
- func (m *Command) Client() *http.InternalClient
- func (m *Command) Close() error
- func (m *Command) GossipAddress() string
- func (m *Command) ID() string
- func (m *Command) MustCreateField(tb testing.TB, index, field string, opts ...pilosa.FieldOption) *pilosa.Field
- func (m *Command) MustCreateIndex(tb testing.TB, name string, opts pilosa.IndexOptions) *pilosa.Index
- func (m *Command) Query(t testing.TB, index, rawQuery, query string) (string, error)
- func (m *Command) QueryAPI(tb testing.TB, req *pilosa.QueryRequest) pilosa.QueryResponse
- func (m *Command) QueryExpect(t *testing.T, index, rawQuery, query string, expected string)
- func (m *Command) QueryProtobuf(indexName string, query string) (*pilosa.QueryResponse, error)
- func (m *Command) Queryf(t *testing.T, index, rawQuery, query string, params ...interface{}) (string, error)
- func (m *Command) RecalculateCaches(t *testing.T) error
- func (m *Command) Reopen() error
- func (m *Command) SoftOpen() error
- func (m *Command) URL() string
- type Field
- type Holder
- func (h *Holder) ClearBit(index, field string, rowID, columnID uint64)
- func (h *Holder) Close() error
- func (h *Holder) MustCreateIndexIfNotExists(index string, opt pilosa.IndexOptions) *Index
- func (h *Holder) MustSetBits(index, field string, rowID uint64, columnIDs ...uint64)
- func (h *Holder) Range(index, field string, op pql.Token, predicate int64) *pilosa.Row
- func (h *Holder) ReadRow(index, field string, rowID uint64) *pilosa.Row
- func (h *Holder) Reopen() error
- func (h *Holder) Row(index, field string, rowID uint64) *pilosa.Row
- func (h *Holder) RowAttrStore(index, field string) pilosa.AttrStore
- func (h *Holder) RowTime(index, field string, rowID uint64, t time.Time, quantum string) *pilosa.Row
- func (h *Holder) SetBit(index, field string, rowID, columnID uint64)
- func (h *Holder) SetBitTime(index, field string, rowID, columnID uint64, t *time.Time)
- func (h *Holder) SetValue(index, field string, columnID uint64, value int64) *Index
- func (h *Holder) Value(index, field string, columnID uint64) (int64, bool)
- type Index
- type IntID
- type IntKey
- type KeyID
- type ModHasher
- type TimeQuantumKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckClusterState ¶ added in v2.1.2
CheckClusterState polls a given cluster for its state until it receives a matching state. It polls up to n times before returning.
func CheckGroupBy ¶
func CompareTransactions ¶
CompareTransactions errors describing how the transactions differ (if at all). The deadlines need only be close (within deadlineSkew).
func MustMarshalJSON ¶
func MustMarshalJSON(v interface{}) []byte
MustMarshalJSON marshals v to JSON. Panic on error.
func MustNewHTTPRequest ¶
MustNewHTTPRequest creates a new HTTP request. Panic on error.
func NewBufferLogger ¶
func NewBufferLogger() *bufferLogger
NewBufferLogger returns a new instance of BufferLogger.
func OptAllowedOrigins ¶
func OptAllowedOrigins(origins []string) server.CommandOption
func OptTxSrc ¶ added in v2.8.0
func OptTxSrc(src string) server.CommandOption
func RetryUntil ¶
RetryUntil repeatedly executes fn until it returns nil or timeout occurs.
func TestField_SetCacheSize ¶
Ensure field can set its cache
Types ¶
type Cluster ¶
type Cluster struct {
Nodes []*Command
}
Cluster represents a Pilosa cluster (multiple Command instances)
func MustNewCluster ¶
MustNewCluster creates a new cluster. If opts contains only one slice of command options, those options are used with every node. If it is empty, default options are used. Otherwise, it must contain size slices of command options, which are used with corresponding nodes.
func MustRunCluster ¶
MustRunCluster creates and starts a new cluster. The opts parameter is slightly magical; see MustNewCluster.
func (*Cluster) AwaitCoordinatorState ¶ added in v2.1.2
AwaitState waits for the cluster coordinator (assumed to be the first node) to reach a specified state.
func (*Cluster) AwaitState ¶ added in v2.1.2
AwaitState waits for the whole cluster to reach a specified state.
func (*Cluster) CloseAndRemove ¶ added in v2.2.0
func (*Cluster) CreateField ¶
func (c *Cluster) CreateField(t testing.TB, index string, iopts pilosa.IndexOptions, field string, fopts ...pilosa.FieldOption) *pilosa.Field
CreateField creates the index (if necessary) and field specified.
func (*Cluster) ExceptionalState ¶ added in v2.1.2
ExceptionalState returns an error if any node in the cluster is not in the expected state.
func (*Cluster) ImportBits ¶
func (*Cluster) ImportIDKey ¶ added in v2.7.0
ImportIDKey imports data into an unkeyed set field in a keyed index.
func (*Cluster) ImportIntID ¶ added in v2.8.0
ImportIntID imports data into an int field in an unkeyed index.
func (*Cluster) ImportIntKey ¶ added in v2.7.0
ImportIntKey imports int data into an index which uses string keys.
func (*Cluster) ImportKeyKey ¶ added in v2.7.0
ImportKeyKey imports data into an index where both the index and the field are using string keys.
func (*Cluster) ImportTimeQuantumKey ¶ added in v2.8.0
func (c *Cluster) ImportTimeQuantumKey(t testing.TB, index, field string, entries []TimeQuantumKey)
ImportTimeQuantumKey imports data into an index where the index is keyd and the field is a time-quantum
func (*Cluster) Query ¶
Query executes an API.Query through one of the cluster's node's API. It fails the test if there is an error.
func (*Cluster) QueryGRPC ¶ added in v2.7.0
QueryGRPC executes a PQL query through the GRPC endpoint. It fails the test if there is an error.
type Command ¶
////////////////////////////////////////////////////////////////////////////////// Command represents a test wrapper for server.Command.
func NewCommandNode ¶
NewCommandNode returns a new instance of Command with clustering enabled.
func RunCommand ¶
RunCommand returns a new, running Main. Panic on error.
func (*Command) Client ¶
func (m *Command) Client() *http.InternalClient
Client returns a client to connect to the program.
func (*Command) GossipAddress ¶
GossipAddress returns the address on which gossip is listening after a Main has been setup. Useful to pass as a seed to other nodes when creating and testing clusters.
func (*Command) MustCreateField ¶
func (m *Command) MustCreateField(tb testing.TB, index, field string, opts ...pilosa.FieldOption) *pilosa.Field
MustCreateField uses this command's API to create the field. The index must already exist - it fails the test if there is an error.
func (*Command) MustCreateIndex ¶
func (m *Command) MustCreateIndex(tb testing.TB, name string, opts pilosa.IndexOptions) *pilosa.Index
MustCreateIndex uses this command's API to create an index and fails the test if there is an error.
func (*Command) QueryAPI ¶
QueryAPI uses this command's API to execute the given query request, failing if Query returns a non-nil error, otherwise returning the QueryResponse.
func (*Command) QueryExpect ¶ added in v2.1.2
QueryExpect executes a query against the program through the HTTP API, and confirms that it got an expected response.
func (*Command) QueryProtobuf ¶
func (*Command) Queryf ¶ added in v2.1.2
func (m *Command) Queryf(t *testing.T, index, rawQuery, query string, params ...interface{}) (string, error)
Queryf is like Query, but with a format string.
func (*Command) RecalculateCaches ¶
RecalculateCaches is deprecated. Use MustRecalculateCaches.
type Holder ¶
type Holder struct {
*pilosa.Holder
}
Holder is a test wrapper for pilosa.Holder.
func MustOpenHolder ¶
MustOpenHolder creates and opens a holder at a temporary path. Panic on error.
func (*Holder) MustCreateIndexIfNotExists ¶
MustCreateIndexIfNotExists returns a given index. Panic on error.
func (*Holder) MustSetBits ¶
MustSetBits sets columns on a row. Panic on error. This function does not accept a timestamp or quantum.
func (*Holder) ReadRow ¶
ReadRow returns a Row for a given field. If the field does not exist, it panics rather than creating the field.
func (*Holder) Reopen ¶
Reopen instantiates and opens a new holder. Note that the holder must be Closed first.
func (*Holder) RowAttrStore ¶
func (*Holder) SetBitTime ¶
SetBitTime sets a bit with timestamp on the given field.
type Index ¶
type Index struct {
*pilosa.Index
}
Index represents a test wrapper for pilosa.Index.
func MustOpenIndex ¶
MustOpenIndex returns a new, opened index at a temporary path. Panic on error.
func (*Index) CreateField ¶
CreateField creates a field with the given options.
func (*Index) CreateFieldIfNotExists ¶
CreateFieldIfNotExists creates a field with the given options if it doesn't exist.
type KeyID ¶ added in v2.7.0
KeyID represents a key and an ID for importing data into an index and field where one uses string keys and the other does not.
type TimeQuantumKey ¶ added in v2.8.0
TimeQuantumKey is a string key and a string+key value