queryer

package
v3.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Copyright 2021 Molecula Corp. All rights reserved.

Package queryer provides the core query-related structs.

Index

Constants

View Source
const (
	FieldTypeSet       = "set"
	FieldTypeInt       = "int"
	FieldTypeTime      = "time"
	FieldTypeMutex     = "mutex"
	FieldTypeBool      = "bool"
	FieldTypeDecimal   = "decimal"
	FieldTypeTimestamp = "timestamp"
)

Field types.

View Source
const FragmentNotFound = Error("fragment not found")
View Source
const ViewNotFound = Error("view not found")

Variables

View Source
var ErrFieldNotFound error = dax.NewErrFieldDoesNotExist("")

Functions

func NewQualifiedSchemaAPI

func NewQualifiedSchemaAPI(qual dax.TableQualifier, schemar schemar.Schemar) *qualifiedSchemaAPI

func NewSchemaInfoAPI

func NewSchemaInfoAPI(schemar schemar.Schemar) *schemaInfoAPI

func PQLResultToQueryResult

func PQLResultToQueryResult(pqlResult interface{}) (*featurebase.WireQueryResponse, error)

Types

type Config

type Config struct {
	MDSAddress string        `toml:"mds-address"`
	Logger     logger.Logger `toml:"-"`
}

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 Error

type Error string // TODO(jaffee) convert to standard error package

func (Error) Error

func (e Error) Error() string

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 (fi *FeatureBaseImporter) CreateFieldKeys(ctx context.Context, index, field string, keys ...string) (map[string]uint64, error)

func (*FeatureBaseImporter) CreateIndexKeys

func (fi *FeatureBaseImporter) CreateIndexKeys(ctx context.Context, index string, keys ...string) (map[string]uint64, error)

func (*FeatureBaseImporter) Import

func (*FeatureBaseImporter) ImportValue

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 (m *MDSTranslator) CreateFieldKeys(ctx context.Context, table string, field string, keys []string) (map[string]uint64, error)

func (*MDSTranslator) CreateIndexKeys

func (m *MDSTranslator) CreateIndexKeys(ctx context.Context, table string, keys []string) (map[string]uint64, error)

func (*MDSTranslator) FindFieldKeys

func (m *MDSTranslator) FindFieldKeys(ctx context.Context, table, field string, keys []string) (map[string]uint64, error)

func (*MDSTranslator) FindIndexKeys

func (m *MDSTranslator) FindIndexKeys(ctx context.Context, table string, keys []string) (map[string]uint64, error)

func (*MDSTranslator) TranslateFieldIDs

func (m *MDSTranslator) TranslateFieldIDs(ctx context.Context, table, field string, ids map[uint64]struct{}) (map[uint64]string, error)

func (*MDSTranslator) TranslateFieldListIDs

func (m *MDSTranslator) TranslateFieldListIDs(ctx context.Context, index, field string, ids []uint64) ([]string, error)

func (*MDSTranslator) TranslateIndexIDSet

func (m *MDSTranslator) TranslateIndexIDSet(ctx context.Context, table string, ids map[uint64]struct{}) (map[uint64]string, error)

func (*MDSTranslator) TranslateIndexIDs

func (m *MDSTranslator) TranslateIndexIDs(ctx context.Context, index string, ids []uint64) ([]string, error)

type NopImporter

type NopImporter struct{}

NopImporter is a no-op implementation of the Importer interface.

func NewNopImporter

func NewNopImporter() *NopImporter

func (*NopImporter) CreateFieldKeys

func (n *NopImporter) CreateFieldKeys(ctx context.Context, index, field string, keys ...string) (map[string]uint64, error)

func (*NopImporter) CreateIndexKeys

func (n *NopImporter) CreateIndexKeys(ctx context.Context, index string, keys ...string) (map[string]uint64, error)

func (*NopImporter) Import

func (*NopImporter) ImportValue

type NopMDS

type NopMDS struct {
	schemar.NopSchemar
}

NopMDS is a no-op implementation of the MDS interface.

func NewNopMDS

func NewNopMDS() *NopMDS

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 (m *NopMDS) IngestShard(ctx context.Context, qtid dax.QualifiedTableID, shard dax.ShardNum) (dax.Address, error)

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 New

func New(cfg Config) *Queryer

New returns a new instance of Queryer.

func (*Queryer) QueryPQL

func (*Queryer) QuerySQL

func (*Queryer) SetMDS

func (q *Queryer) SetMDS(mds MDS) error

func (*Queryer) Start

func (q *Queryer) Start() 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.

Directories

Path Synopsis
Package client is an HTTP client for MDS.
Package client is an HTTP client for MDS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL