diff --git a/client.go b/client.go deleted file mode 100644 index 43929b952..000000000 --- a/client.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2021 Molecula Corp. All rights reserved. -package pilosa - -import ( - "context" - - pnet "github.com/molecula/featurebase/v3/net" -) - -// Bit represents the intersection of a row and a column. It can be specified by -// integer ids or string keys. -type Bit struct { - RowID uint64 - ColumnID uint64 - RowKey string - ColumnKey string - Timestamp int64 -} - -// FieldValue represents the value for a column within a -// range-encoded field. -type FieldValue struct { - ColumnID uint64 - ColumnKey string - Value int64 -} - -// InternalQueryClient is the internal interface for querying a node. -type InternalQueryClient interface { - SchemaNode(ctx context.Context, uri *pnet.URI, views bool) ([]*IndexInfo, error) - - QueryNode(ctx context.Context, uri *pnet.URI, index string, queryRequest *QueryRequest) (*QueryResponse, error) - - // Trasnlate keys on the particular node. The parameter writable informs TranslateStore if we can generate a new ID if any of keys does not exist. - TranslateKeysNode(ctx context.Context, uri *pnet.URI, index, field string, keys []string, writable bool) ([]uint64, error) - TranslateIDsNode(ctx context.Context, uri *pnet.URI, index, field string, id []uint64) ([]string, error) - - FindIndexKeysNode(ctx context.Context, uri *pnet.URI, index string, keys ...string) (map[string]uint64, error) - FindFieldKeysNode(ctx context.Context, uri *pnet.URI, index string, field string, keys ...string) (map[string]uint64, error) - - CreateIndexKeysNode(ctx context.Context, uri *pnet.URI, index string, keys ...string) (map[string]uint64, error) - CreateFieldKeysNode(ctx context.Context, uri *pnet.URI, index string, field string, keys ...string) (map[string]uint64, error) - - MatchFieldKeysNode(ctx context.Context, uri *pnet.URI, index string, field string, like string) ([]uint64, error) -} - -type nopInternalQueryClient struct{} - -func (nopInternalQueryClient) SchemaNode(ctx context.Context, uri *pnet.URI, views bool) ([]*IndexInfo, error) { - return nil, nil -} - -func (n nopInternalQueryClient) QueryNode(ctx context.Context, uri *pnet.URI, index string, queryRequest *QueryRequest) (*QueryResponse, error) { - return nil, nil -} - -func (n nopInternalQueryClient) TranslateKeysNode(ctx context.Context, uri *pnet.URI, index, field string, keys []string, writable bool) ([]uint64, error) { - return nil, nil -} - -func (n nopInternalQueryClient) TranslateIDsNode(ctx context.Context, uri *pnet.URI, index, field string, ids []uint64) ([]string, error) { - return nil, nil -} - -func (n nopInternalQueryClient) FindIndexKeysNode(ctx context.Context, uri *pnet.URI, index string, keys ...string) (map[string]uint64, error) { - return nil, nil -} - -func (n nopInternalQueryClient) FindFieldKeysNode(ctx context.Context, uri *pnet.URI, index string, field string, keys ...string) (map[string]uint64, error) { - return nil, nil -} - -func (n nopInternalQueryClient) CreateIndexKeysNode(ctx context.Context, uri *pnet.URI, index string, keys ...string) (map[string]uint64, error) { - return nil, nil -} - -func (n nopInternalQueryClient) CreateFieldKeysNode(ctx context.Context, uri *pnet.URI, index string, field string, keys ...string) (map[string]uint64, error) { - return nil, nil -} - -func (n nopInternalQueryClient) MatchFieldKeysNode(ctx context.Context, uri *pnet.URI, index string, field string, like string) ([]uint64, error) { - return nil, nil -} - -func newNopInternalQueryClient() nopInternalQueryClient { - return nopInternalQueryClient{} -} - -var _ InternalQueryClient = newNopInternalQueryClient() diff --git a/executor.go b/executor.go index b79b448b7..1736ce94a 100644 --- a/executor.go +++ b/executor.go @@ -55,7 +55,7 @@ type executor struct { workCounter uint64 // Client used for remote requests. - client InternalQueryClient + client *InternalClient // Maximum number of Set() or Clear() commands per request. MaxWritesPerRequest int @@ -74,7 +74,7 @@ type executor struct { // executorOption is a functional option type for pilosa.Executor type executorOption func(e *executor) error -func optExecutorInternalQueryClient(c InternalQueryClient) executorOption { +func optExecutorInternalQueryClient(c *InternalClient) executorOption { return func(e *executor) error { e.client = c return nil @@ -116,7 +116,6 @@ func emptyResult(c *pql.Call) interface{} { // newExecutor returns a new instance of Executor. func newExecutor(opts ...executorOption) *executor { e := &executor{ - client: newNopInternalQueryClient(), workerPoolSize: 2, } for _, opt := range opts { diff --git a/internal_client.go b/internal_client.go index 735d84386..f225474e8 100644 --- a/internal_client.go +++ b/internal_client.go @@ -1938,6 +1938,16 @@ func (c *InternalClient) handleResponse(req *http.Request, eo *executeOpts, resp return resp, nil } +// Bit represents the intersection of a row and a column. It can be specified by +// integer ids or string keys. +type Bit struct { + RowID uint64 + ColumnID uint64 + RowKey string + ColumnKey string + Timestamp int64 +} + // Bits is a slice of Bit. type Bits []Bit @@ -2047,6 +2057,14 @@ func (p Bits) GroupByShard() map[uint64][]Bit { return m } +// FieldValue represents the value for a column within a +// range-encoded field. +type FieldValue struct { + ColumnID uint64 + ColumnKey string + Value int64 +} + // FieldValues represents a slice of field values. type FieldValues []FieldValue