Documentation
¶
Overview ¶
Copyright 2021 Molecula Corp. All rights reserved.
Package queryer provides the core query-related structs.
Index ¶
- Constants
- Variables
- func NewQualifiedSchemaAPI(qual dax.TableQualifier, schemar schemar.Schemar) *qualifiedSchemaAPI
- func NewSchemaInfoAPI(schemar schemar.Schemar) *schemaInfoAPI
- func PQLResultToQueryResult(pqlResult interface{}) (*featurebase.WireQueryResponse, error)
- type Config
- type Error
- type FeatureBaseImporter
- func (fi *FeatureBaseImporter) CreateFieldKeys(ctx context.Context, index, field string, keys ...string) (map[string]uint64, error)
- func (fi *FeatureBaseImporter) CreateIndexKeys(ctx context.Context, index string, keys ...string) (map[string]uint64, error)
- func (fi *FeatureBaseImporter) Import(ctx context.Context, req *featurebase.ImportRequest, ...) error
- func (fi *FeatureBaseImporter) ImportValue(ctx context.Context, req *featurebase.ImportValueRequest, ...) error
- type Importer
- type MDS
- type MDSTopology
- type MDSTranslator
- func (m *MDSTranslator) CreateFieldKeys(ctx context.Context, table string, field string, keys []string) (map[string]uint64, error)
- func (m *MDSTranslator) CreateIndexKeys(ctx context.Context, table string, keys []string) (map[string]uint64, error)
- func (m *MDSTranslator) FindFieldKeys(ctx context.Context, table, field string, keys []string) (map[string]uint64, error)
- func (m *MDSTranslator) FindIndexKeys(ctx context.Context, table string, keys []string) (map[string]uint64, error)
- func (m *MDSTranslator) TranslateFieldIDs(ctx context.Context, table, field string, ids map[uint64]struct{}) (map[uint64]string, error)
- func (m *MDSTranslator) TranslateFieldListIDs(ctx context.Context, index, field string, ids []uint64) ([]string, error)
- func (m *MDSTranslator) TranslateIndexIDSet(ctx context.Context, table string, ids map[uint64]struct{}) (map[uint64]string, error)
- func (m *MDSTranslator) TranslateIndexIDs(ctx context.Context, index string, ids []uint64) ([]string, error)
- type NopImporter
- func (n *NopImporter) CreateFieldKeys(ctx context.Context, index, field string, keys ...string) (map[string]uint64, error)
- func (n *NopImporter) CreateIndexKeys(ctx context.Context, index string, keys ...string) (map[string]uint64, error)
- func (n *NopImporter) Import(ctx context.Context, req *featurebase.ImportRequest, ...) error
- func (n *NopImporter) ImportValue(ctx context.Context, req *featurebase.ImportValueRequest, ...) error
- type NopMDS
- func (m *NopMDS) ComputeNodes(ctx context.Context, qtid dax.QualifiedTableID, shards ...dax.ShardNum) ([]controller.ComputeNode, error)
- func (m *NopMDS) IngestPartition(ctx context.Context, qtid dax.QualifiedTableID, partition dax.PartitionNum) (dax.Address, error)
- func (m *NopMDS) IngestShard(ctx context.Context, qtid dax.QualifiedTableID, shard dax.ShardNum) (dax.Address, error)
- func (m *NopMDS) TranslateNodes(ctx context.Context, qtid dax.QualifiedTableID, partitions ...dax.PartitionNum) ([]controller.TranslateNode, error)
- type Queryer
- func (q *Queryer) QueryPQL(ctx context.Context, qual dax.TableQualifier, table dax.TableName, pql string) (*featurebase.WireQueryResponse, error)
- func (q *Queryer) QuerySQL(ctx context.Context, qual dax.TableQualifier, sql string) (*featurebase.WireQueryResponse, error)
- func (q *Queryer) SetMDS(mds MDS) error
- func (q *Queryer) Start() error
- type Topologer
- type Translator
Constants ¶
const ( FieldTypeSet = "set" FieldTypeInt = "int" FieldTypeTime = "time" FieldTypeMutex = "mutex" FieldTypeBool = "bool" FieldTypeDecimal = "decimal" FieldTypeTimestamp = "timestamp" )
Field types.
const FragmentNotFound = Error("fragment not found")
const ViewNotFound = Error("view not found")
Variables ¶
var ErrFieldNotFound error = dax.NewErrFieldDoesNotExist("")
Functions ¶
func NewQualifiedSchemaAPI ¶
func NewQualifiedSchemaAPI(qual dax.TableQualifier, schemar schemar.Schemar) *qualifiedSchemaAPI
func NewSchemaInfoAPI ¶
func PQLResultToQueryResult ¶
func PQLResultToQueryResult(pqlResult interface{}) (*featurebase.WireQueryResponse, error)
Types ¶
type Config ¶
Config defines the configuration parameters for Queryer. At the moment, it's being used to serve two different purposes. This first is to provide the config parameters for the toml (i.e. human-friendly) file used at server startup. The second is as the Config for the Queryer type. If this gets more complex, it might make sense to split this into two different config structs. We initially did that with something called "Injections", but that separation was a bit premature.
type FeatureBaseImporter ¶
type FeatureBaseImporter struct {
// contains filtered or unexported fields
}
FeatureBaseImporter is an implementation of the Importer interface which uses a pointer to a featurebase.API to make the underlying calls. This assumes those calls need to be Qcx aware, so this takes that into account.
func NewFeatureBaseImporter ¶
func NewFeatureBaseImporter(api *featurebase.API) *FeatureBaseImporter
func (*FeatureBaseImporter) CreateFieldKeys ¶
func (*FeatureBaseImporter) CreateIndexKeys ¶
func (*FeatureBaseImporter) Import ¶
func (fi *FeatureBaseImporter) Import(ctx context.Context, req *featurebase.ImportRequest, opts ...featurebase.ImportOption) error
func (*FeatureBaseImporter) ImportValue ¶
func (fi *FeatureBaseImporter) ImportValue(ctx context.Context, req *featurebase.ImportValueRequest, opts ...featurebase.ImportOption) error
type Importer ¶
type Importer interface {
CreateIndexKeys(ctx context.Context, index string, keys ...string) (map[string]uint64, error)
CreateFieldKeys(ctx context.Context, index, field string, keys ...string) (map[string]uint64, error)
Import(ctx context.Context, req *featurebase.ImportRequest, opts ...featurebase.ImportOption) error
ImportValue(ctx context.Context, req *featurebase.ImportValueRequest, opts ...featurebase.ImportOption) error
}
type MDS ¶
type MDS interface {
// Controller-related methods.
ComputeNodes(ctx context.Context, qtid dax.QualifiedTableID, shards ...dax.ShardNum) ([]controller.ComputeNode, error)
IngestPartition(ctx context.Context, qtid dax.QualifiedTableID, partition dax.PartitionNum) (dax.Address, error)
IngestShard(ctx context.Context, qtid dax.QualifiedTableID, shard dax.ShardNum) (dax.Address, error)
TranslateNodes(ctx context.Context, qtid dax.QualifiedTableID, partitions ...dax.PartitionNum) ([]controller.TranslateNode, error)
// Schemar-related methods.
schemar.Schemar
}
type MDSTopology ¶
type MDSTopology struct {
// contains filtered or unexported fields
}
func (*MDSTopology) ComputeNodes ¶
func (m *MDSTopology) ComputeNodes(ctx context.Context, index string, shards []uint64) ([]controller.ComputeNode, error)
type MDSTranslator ¶
type MDSTranslator struct {
// contains filtered or unexported fields
}
func NewMDSTranslator ¶
func NewMDSTranslator(mds MDS) *MDSTranslator
func (*MDSTranslator) CreateFieldKeys ¶
func (*MDSTranslator) CreateIndexKeys ¶
func (*MDSTranslator) FindFieldKeys ¶
func (*MDSTranslator) FindIndexKeys ¶
func (*MDSTranslator) TranslateFieldIDs ¶
func (*MDSTranslator) TranslateFieldListIDs ¶
func (*MDSTranslator) TranslateIndexIDSet ¶
func (*MDSTranslator) TranslateIndexIDs ¶
type NopImporter ¶
type NopImporter struct{}
NopImporter is a no-op implementation of the Importer interface.
func NewNopImporter ¶
func NewNopImporter() *NopImporter
func (*NopImporter) CreateFieldKeys ¶
func (*NopImporter) CreateIndexKeys ¶
func (*NopImporter) Import ¶
func (n *NopImporter) Import(ctx context.Context, req *featurebase.ImportRequest, opts ...featurebase.ImportOption) error
func (*NopImporter) ImportValue ¶
func (n *NopImporter) ImportValue(ctx context.Context, req *featurebase.ImportValueRequest, opts ...featurebase.ImportOption) error
type NopMDS ¶
type NopMDS struct {
schemar.NopSchemar
}
NopMDS is a no-op implementation of the MDS interface.
func (*NopMDS) ComputeNodes ¶
func (m *NopMDS) ComputeNodes(ctx context.Context, qtid dax.QualifiedTableID, shards ...dax.ShardNum) ([]controller.ComputeNode, error)
func (*NopMDS) IngestPartition ¶
func (m *NopMDS) IngestPartition(ctx context.Context, qtid dax.QualifiedTableID, partition dax.PartitionNum) (dax.Address, error)
func (*NopMDS) IngestShard ¶
func (*NopMDS) TranslateNodes ¶
func (m *NopMDS) TranslateNodes(ctx context.Context, qtid dax.QualifiedTableID, partitions ...dax.PartitionNum) ([]controller.TranslateNode, error)
type Queryer ¶
type Queryer struct {
// contains filtered or unexported fields
}
Queryer represents the query layer in a Molecula implementation. The idea is that the externally-facing Molecula API would proxy query requests to a pool of "Queryer" nodes, which handle incoming query requests.
func (*Queryer) QueryPQL ¶
func (q *Queryer) QueryPQL(ctx context.Context, qual dax.TableQualifier, table dax.TableName, pql string) (*featurebase.WireQueryResponse, error)
func (*Queryer) QuerySQL ¶
func (q *Queryer) QuerySQL(ctx context.Context, qual dax.TableQualifier, sql string) (*featurebase.WireQueryResponse, error)
type Topologer ¶
type Topologer interface {
ComputeNodes(ctx context.Context, index string, shards []uint64) ([]controller.ComputeNode, error)
}
type Translator ¶
type Translator interface {
CreateIndexKeys(ctx context.Context, index string, keys []string) (map[string]uint64, error)
CreateFieldKeys(ctx context.Context, index string, field string, keys []string) (map[string]uint64, error)
FindIndexKeys(ctx context.Context, index string, keys []string) (map[string]uint64, error)
FindFieldKeys(ctx context.Context, index, field string, keys []string) (map[string]uint64, error)
// TODO(jaffee) the naming here is a cluster. TranslateIndexIDs takes a list, but TranslateFieldIDs takes a set, both have alternate methods that take the other thing. :facepalm:
TranslateIndexIDs(ctx context.Context, index string, ids []uint64) ([]string, error)
TranslateIndexIDSet(ctx context.Context, index string, ids map[uint64]struct{}) (map[uint64]string, error)
TranslateFieldIDs(ctx context.Context, index, field string, ids map[uint64]struct{}) (map[uint64]string, error)
TranslateFieldListIDs(ctx context.Context, index, field string, ids []uint64) ([]string, error)
}
TODO(jaffee) we need version info in here ASAP. whenever schema or topo changes, version gets bumped and nodes know to reject queries and update their info from the MDS instead of querying it every time.