libqpu

package
v0.0.0-...-726f7ef Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attribute

func Attribute(key string, val *qpu.Value) *qpu.Attribute

Attribute ...

func AttributePredicate

func AttributePredicate(attr *qpu.Attribute, lb *qpu.Value, ub *qpu.Value) *qpu.AttributePredicate

AttributePredicate create a protos/utils/AttributePredicate object

func ConfigRequest

func ConfigRequest() *qpuapi.ConfigRequest

ConfigRequest creates a protos/qpu/ConfigRequest object

func HasAttribute

func HasAttribute(attributes map[string]*qpu.Value, attrName string) bool

HasAttribute ...

func NewASTQuery

func NewASTQuery(table string, ts *qpu.SnapshotTimePredicate, predicate []*qpu.AttributePredicate, projection []string, limit int64) *qpuapi.ASTQuery

NewASTQuery ...

func NewQuery

func NewQuery(qSQL *qpuapi.SQLQuery, qAST *qpuapi.ASTQuery) *qpuapi.Query

NewQuery ...

func NewSQLQuery

func NewSQLQuery(query string) *qpuapi.SQLQuery

NewSQLQuery ...

func ObjectState

func ObjectState(state map[string]*qpu.Value) *qpu.ObjectState

ObjectState creates a protos/qpu/State object

func QueryPredicate

func QueryPredicate() []*qpu.AttributePredicate

QueryPredicate ...

func RequestStreamAck

func RequestStreamAck(sID int64) *qpuapi.RequestStreamRecord

RequestStreamAck creates a protos/qpu/RequestStream{Ack} object

func RequestStreamRequest

func RequestStreamRequest(query *qpuapi.Query, metadata map[string]string, sync bool) *qpuapi.RequestStreamRecord

RequestStreamRequest creates a protos/qpu/RequestStream{Request} object

func ResponseStreamRecord

ResponseStreamRecord ...

func SnapshotTime

func SnapshotTime(t qpu.SnapshotTime_SnapshotTimeType, vc *qpu.Vectorclock, isClosed bool) *qpu.SnapshotTime

SnapshotTime creates a protos/utils/SnapshotTime object

func SnapshotTimePredicate

func SnapshotTimePredicate(lb *qpu.SnapshotTime, ub *qpu.SnapshotTime) *qpu.SnapshotTimePredicate

SnapshotTimePredicate create a protos/utils/SnapshotTimePredicate object

func ValueFlt

func ValueFlt(f float64) *qpu.Value

ValueFlt creates a protos/utils/Value{Flt} object

func ValueInt

func ValueInt(i int32) *qpu.Value

ValueInt creates a protos/utils/Value{Int} object

func ValueStr

func ValueStr(s string) *qpu.Value

ValueStr creates a protos/utils/Value{Str} object

func Vectorclock

func Vectorclock(vc map[string]*timestamp.Timestamp) *qpu.Vectorclock

Vectorclock creates a protos/utils/Vectorclock object

Types

type APIClient

type APIClient interface {
	Query(QueryRequest) (ResponseStream, error)
	QueryUnary(string) (*qpuextapi.QueryResp, error)
	QuerySQL(string, map[string]string, bool) (ResponseStream, error)
	QuerySubscribe(string) (qpuapi.QPUAPI_QuerySubscribeClient, context.CancelFunc, error)
	CloseConnection() error
	GetConfig() (*qpuapi.ConfigResponse, error)
}

APIClient ...

type APIProcessor

type APIProcessor interface {
	Query(QueryRequest, RequestStream) error
	QueryUnary(QueryRequest, opentracing.Span) (*qpuextapi.QueryResp, error)
	QuerySubscribe(*qpuextapi.QueryReq, qpuapi.QPUAPI_QuerySubscribeServer) error
	GetConfig(context.Context, *qpuapi.ConfigRequest) (*qpuapi.ConfigResponse, error)
}

APIProcessor ...

type ASTQuery

type ASTQuery struct {
	Q *qpuapi.ASTQuery
}

ASTQuery ...

func (ASTQuery) GetLimit

func (q ASTQuery) GetLimit() int64

GetLimit ...

func (ASTQuery) GetOrderBy

func (q ASTQuery) GetOrderBy() *qpuapi.OrderBy

GetOrderBy ...

func (ASTQuery) GetPredicate

func (q ASTQuery) GetPredicate() []*qpu.AttributePredicate

GetPredicate ...

func (ASTQuery) GetPredicateContains

func (q ASTQuery) GetPredicateContains() ([]string, []string)

GetPredicateContains ...

func (ASTQuery) GetProjection

func (q ASTQuery) GetProjection() []string

GetProjection ...

func (ASTQuery) GetTable

func (q ASTQuery) GetTable() string

GetTable ...

func (ASTQuery) GetTsPredicate

func (q ASTQuery) GetTsPredicate() *qpu.SnapshotTimePredicate

GetTsPredicate ...

type AdjacentQPU

type AdjacentQPU struct {
	APIClient           APIClient
	OutputSchema        []string
	MeasureDataTransfer bool
}

AdjacentQPU ...

type AggregationType

type AggregationType int

AggregationType ...

const (
	// Sum ...
	Sum AggregationType = iota
)

type DatastoreAttributeType

type DatastoreAttributeType int

DatastoreAttributeType ...

const (
	// STR ...
	STR DatastoreAttributeType = iota
	// INT ...
	INT DatastoreAttributeType = iota
	// FLT ...
	FLT DatastoreAttributeType = iota
)

type DatastoreType

type DatastoreType int

DatastoreType ...

const (
	// MYSQL is the enum value for a MySQL storage tier
	MYSQL DatastoreType = iota
	// S3 is the enum value for a S3 storage tier
	S3 DatastoreType = iota
	// MOCK is the enum value for a mocked storage tier
	MOCK DatastoreType = iota
)

type DownstreamQueryConf

type DownstreamQueryConf struct {
	IsNull    []string
	IsNotNull []string
}

DownstreamQueryConf ...

type LogOperation

type LogOperation struct {
	Op   *qpu.LogOperation
	InTs time.Time
}

LogOperation ...

func LogOperationDelta

func LogOperationDelta(recordID, table string, ts *qpu.Vectorclock,
	attributesOld map[string]*qpu.Value,
	attributesNew map[string]*qpu.Value,
) LogOperation

LogOperationDelta ...

func LogOperationState

func LogOperationState(recordID, table string, ts *qpu.Vectorclock,
	atttributes map[string]*qpu.Value) LogOperation

LogOperationState creates a protos/utils/LogOperation object

func (LogOperation) GetAttributes

func (op LogOperation) GetAttributes() map[string]*qpu.Value

GetAttributes ...

func (LogOperation) GetAttributesOld

func (op LogOperation) GetAttributesOld() map[string]*qpu.Value

GetAttributesOld ...

func (LogOperation) GetObjectID

func (op LogOperation) GetObjectID() string

GetObjectID ...

func (LogOperation) GetTable

func (op LogOperation) GetTable() string

GetTable ...

func (LogOperation) GetTimestamp

func (op LogOperation) GetTimestamp() *qpu.Vectorclock

GetTimestamp ...

func (LogOperation) HasOldState

func (op LogOperation) HasOldState() bool

HasOldState ...

func (LogOperation) IsDelta

func (op LogOperation) IsDelta() bool

IsDelta ...

type OperatorType

type OperatorType int

OperatorType ...

const (
	// DBDriver ...
	DBDriver OperatorType = iota
	// Aggregation ...
	Aggregation OperatorType = iota
	// Join ...
	Join OperatorType = iota
	// Index ...
	Index OperatorType = iota
	// InMemIndex ...
	InMemIndex OperatorType = iota
	// Cache ...
	Cache OperatorType = iota
	// Router ...
	Router OperatorType = iota
)

type QPU

type QPU struct {
	Class        QPUClass
	Config       *QPUConfig
	InputSchema  Schema
	AdjacentQPUs []*AdjacentQPU
	State        QPUState
}

QPU ...

type QPUClass

type QPUClass interface {
	ClientQuery(ASTQuery, string, opentracing.Span) (*qpuextapi.QueryResp, error)
	ProcessQuerySnapshot(ASTQuery, map[string]string, bool, opentracing.Span) (<-chan LogOperation, <-chan error)
	ProcessQuerySubscribe(ASTQuery, map[string]string, bool) (int, <-chan LogOperation, <-chan error)
	QuerySubscribe(ASTQuery, *qpuextapi.QueryReq) (chan LogOperation, chan bool, chan error)
	RemovePersistentQuery(string, int)
	GetConfig() *qpuapi.ConfigResponse
}

QPUClass ...

type QPUConfig

type QPUConfig struct {
	Operator     OperatorType
	State        StateType
	Port         string
	Connections  []QPUConnection
	StateBackend struct {
		Endpoint    string
		Credentials struct {
			AccessKeyID     string
			SecretAccessKey string
		}
	}
	DatastoreConfig struct {
		Type              DatastoreType
		Endpoint          string
		LogStreamEndpoint string
		DBName            string
		Credentials       struct {
			AccessKeyID     string
			SecretAccessKey string
		}
	}
	IndexConfig struct {
		Table         string
		AttributeName string
		AttributeType DatastoreAttributeType
		LBound        *qpu.Value
		UBound        *qpu.Value
	}
	AggregationConfig struct {
		AggregationFunc      AggregationType
		GroupBy              string
		AggregationAttribute string
	}
	JoinConfig struct {
		OutputTableAlias     string
		JoinedAttributeAlias string
		JoinAttribute        map[string]string
	}
	CacheConfig struct {
		Size int
		TTL  int
	}
	Evaluation struct {
		Tracing                    bool
		LogTimestamps              bool
		MeasureNotificationLatency bool
		MeasureDataTransfer        bool
	}
	ProcessingConfig struct {
		API struct {
			MaxWorkers  int
			MaxJobQueue int
		}
		Input struct {
			MaxWorkers  int
			MaxJobQueue int
		}
		GrpcServers int
	}
}

QPUConfig specifies the configuration structure of a QPU

type QPUConnection

type QPUConnection struct {
	Address             string
	MeasureDataTransfer bool
}

QPUConnection ...

type QPUService

type QPUService interface {
	Start() error
	Shutdown()
}

QPUService ...

type QPUState

type QPUState interface {
	Init(string, string, string) error
	Insert(string, map[string]interface{}, map[string]*timestamp.Timestamp) error
	Update(string, map[string]interface{}, map[string]interface{}, map[string]*timestamp.Timestamp) error
	Get(string, []string, []string, string, int64, opentracing.Span) (<-chan map[string]interface{}, error)
	GetRow(string, []string, []string, opentracing.Span) *sql.Row
	Cleanup()
}

QPUState ...

type QueryLogEntry

type QueryLogEntry struct {
	RowIDs []string
	Ts     time.Time
}

QueryLogEntry ...

type QueryRequest

type QueryRequest struct {
	Req *qpuapi.QueryRequest
}

QueryRequest ...

func NewQueryRequest

func NewQueryRequest(query *qpuapi.Query, md map[string]string, sync, measureDataTransfer bool) QueryRequest

NewQueryRequest ...

func (QueryRequest) GetMeasureDataTransfer

func (r QueryRequest) GetMeasureDataTransfer() bool

GetMeasureDataTransfer ...

func (QueryRequest) GetMetadata

func (r QueryRequest) GetMetadata() map[string]string

GetMetadata ...

func (QueryRequest) GetQueryI

func (r QueryRequest) GetQueryI() ASTQuery

GetQueryI ...

func (QueryRequest) GetSQLStr

func (r QueryRequest) GetSQLStr() string

GetSQLStr ...

func (QueryRequest) GetSync

func (r QueryRequest) GetSync() bool

GetSync ...

func (QueryRequest) QueryType

func (r QueryRequest) QueryType() QueryType

QueryType ...

type QueryType

type QueryType int

QueryType ...

const (
	// ASTQueryT ..
	ASTQueryT QueryType = iota
	// SQLQueryT ..
	SQLQueryT QueryType = iota
	// UnknownQueryT ...
	UnknownQueryT QueryType = iota
)

type RequestStream

type RequestStream struct {
	Stream qpuapi.QPUAPI_QueryServer
}

RequestStream ...

func (RequestStream) Send

func (s RequestStream) Send(seqID int64, recordType ResponseRecordType, logOp LogOperation) error

Send ...

type ResponseRecord

type ResponseRecord struct {
	Rec  *qpuapi.ResponseStreamRecord
	InTs time.Time
}

ResponseRecord ...

func (ResponseRecord) GetAttributes

func (r ResponseRecord) GetAttributes() map[string]*qpu.Value

GetAttributes ...

func (ResponseRecord) GetAttributesOld

func (r ResponseRecord) GetAttributesOld() map[string]*qpu.Value

GetAttributesOld ...

func (ResponseRecord) GetLogOp

func (r ResponseRecord) GetLogOp() LogOperation

GetLogOp ...

func (ResponseRecord) GetRecordID

func (r ResponseRecord) GetRecordID() string

GetRecordID ...

func (ResponseRecord) GetSequenceID

func (r ResponseRecord) GetSequenceID() int64

GetSequenceID ...

func (ResponseRecord) GetType

func (r ResponseRecord) GetType() (ResponseRecordType, error)

GetType ...

type ResponseRecordType

type ResponseRecordType int

ResponseRecordType ...

const (
	// State ...
	State ResponseRecordType = iota
	// Delta ...
	Delta ResponseRecordType = iota
	// EndOfStream ...
	EndOfStream ResponseRecordType = iota
)

type ResponseStream

type ResponseStream struct {
	Stream     qpuapi.QPUAPI_QueryClient
	CancelFunc context.CancelFunc
}

ResponseStream ...

func (ResponseStream) Cancel

func (str ResponseStream) Cancel()

Cancel ...

func (ResponseStream) Recv

func (str ResponseStream) Recv() (ResponseRecord, error)

Recv ...

type Schema

type Schema map[string]SchemaTable

Schema ...

func (Schema) GetValue

func (s Schema) GetValue(attributes map[string]*qpu.Value, table, attrName string) (interface{}, error)

GetValue ...

func (Schema) InterfaceToAttributes

func (s Schema) InterfaceToAttributes(table string, attributesStr map[string]interface{}) (map[string]*qpu.Value, error)

InterfaceToAttributes ...

func (Schema) InterfaceToStr

func (s Schema) InterfaceToStr(table, attributeKey string, val interface{}) ([]byte, error)

InterfaceToStr ...

func (Schema) InterfaceToString

func (s Schema) InterfaceToString(table string, attributesStr map[string]interface{}) (map[string][]byte, error)

InterfaceToString ...

func (Schema) InterfaceToValue

func (s Schema) InterfaceToValue(table, attributeKey string, val interface{}) (*qpu.Value, error)

InterfaceToValue ...

func (Schema) StrToAttributes

func (s Schema) StrToAttributes(table string, attributesStr map[string]string) (map[string]*qpu.Value, error)

StrToAttributes ...

func (Schema) StrToValue

func (s Schema) StrToValue(table, attributeKey, valueStr string) (*qpu.Value, error)

StrToValue ...

type SchemaTable

type SchemaTable struct {
	Attributes      map[string]DatastoreAttributeType
	DownstreamQuery DownstreamQueryConf
}

SchemaTable ...

type StateType

type StateType int

StateType ...

const (
	// Stateless ...
	Stateless StateType = iota
	// MaterializedView ...
	MaterializedView StateType = iota
	// CacheState ...
	CacheState StateType = iota
)

type WriteLogEntry

type WriteLogEntry struct {
	RowID string
	T0    time.Time
	T1    time.Time
}

WriteLogEntry ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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