api

package
v0.0.0-...-e69cde0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldTypeSet       = "set"
	FieldTypeInt       = "int"
	FieldTypeTime      = "time"
	FieldTypeMutex     = "mutex"
	FieldTypeBool      = "bool"
	FieldTypeDecimal   = "decimal"
	FieldTypeTimestamp = "timestamp"
)
View Source
const (
	TimeUnitSeconds      = "s"
	TimeUnitMilliseconds = "ms"
	TimeUnitMicroseconds = "µs"
	TimeUnitUSeconds     = "us"
	TimeUnitNanoseconds  = "ns"
)

Constants related to timestamp.

Variables

This section is empty.

Functions

func IsValidTimeUnit

func IsValidTimeUnit(unit string) bool

IsValidTimeUnit returns true if unit is valid.

func ValToTimestamp

func ValToTimestamp(unit string, val int64) (time.Time, error)

ValToTimestamp takes a timeunit and an integer value and converts it to time.Time

Types

type ClusterNode

type ClusterNode interface{}

type ExecutionRequest

type ExecutionRequest struct {
	// the id of the request
	RequestID string
	// the id of the user
	UserID string
	// time the request started
	StartTime time.Time
	// time the request finished - zero iif it has not finished
	EndTime time.Time
	// status of the request 'running' or 'complete' now, could have other values later
	Status string
	// future: if the request is waiting, the type of wait that is occuring
	WaitType string
	// future: the cumulative wait time for this request
	WaitTime time.Duration
	// futuure: if the request is waiting, the thing it is waiting on
	WaitResource string
	// future: the cululative cpu time for this request
	CPUTime time.Duration
	// the elapsed time for this request
	ElapsedTime time.Duration
	// future: the cumulative number of physical reads for this request
	Reads int64
	// future: the cumulative number of physical writes for this request
	Writes int64
	// future: the cumulative number of logical reads for this request
	LogicalReads int64
	// future: the cumulative number of rows affected for this request
	RowCount int64
	// the query plan for this request formatted in json
	Plan string
	// the sql for this request
	SQL string
}

ExecutionRequest holds data about an (sql) execution request

func (*ExecutionRequest) Copy

Copy returns a copy of the ExecutionRequest passed

type ExecutionRequestsAPI

type ExecutionRequestsAPI interface {
	// add a request
	AddRequest(requestID string, userID string, startTime time.Time, sql string) error

	// update a request
	UpdateRequest(requestID string,
		endTime time.Time,
		status string,
		waitType string,
		waitTime time.Duration,
		waitResource string,
		cpuTime time.Duration,
		reads int64,
		writes int64,
		logicalReads int64,
		rowCount int64,
		plan string) error

	// list all the requests
	ListRequests() ([]ExecutionRequest, error)

	// get a specific request
	GetRequest(requestID string) (ExecutionRequest, error)
}

ExecutionRequestsAPI defines the API for storing, updating and querying internal state around (sql) execution requests

type Executor

type Executor interface {
}

type FieldInfo

type FieldInfo struct {
	Name        string       `json:"name"`
	CreatedAt   int64        `json:"createdAt,omitempty"`
	Owner       string       `json:"owner"`
	Options     FieldOptions `json:"options"`
	Cardinality *uint64      `json:"cardinality,omitempty"`
	Views       []*ViewInfo  `json:"views,omitempty"`
}

func FieldToFieldInfo

func FieldToFieldInfo(fld *dax.Field) *FieldInfo

type FieldOptions

type FieldOptions struct {
	Base           int64               `json:"base,omitempty"`
	BitDepth       uint64              `json:"bitDepth,omitempty"`
	Min            int64               `json:"min,omitempty"`
	Max            int64               `json:"max,omitempty"`
	Scale          int64               `json:"scale,omitempty"`
	Keys           bool                `json:"keys"`
	NoStandardView bool                `json:"noStandardView,omitempty"`
	TrackExistence bool                `json:"trackExistence,omitempty"`
	CacheSize      uint32              `json:"cacheSize,omitempty"`
	CacheType      string              `json:"cacheType,omitempty"`
	Type           string              `json:"type,omitempty"`
	TimeUnit       string              `json:"timeUnit,omitempty"`
	TimeQuantum    quantum.TimeQuantum `json:"timeQuantum,omitempty"`
	ForeignIndex   string              `json:"foreignIndex"`
	TTL            time.Duration       `json:"ttl,omitempty"`
}

type ImportRoaringShardRequest

type ImportRoaringShardRequest struct {
	// Has this request already been forwarded to all replicas? If
	// Remote=false, then the handling server is responsible for
	// ensuring this request is sent to all repliacs before returning
	// a successful response to the client.
	Remote bool
	Views  []RoaringUpdate

	// SuppressLog requests we not write to the write log. Typically
	// that would be because this request is being replayed from a
	// write log.
	SuppressLog bool
}

ImportRoaringShardRequest is the request for the shard transactional endpoint.

type Importer

type Importer interface {
	StartTransaction(ctx context.Context, id string, timeout time.Duration, exclusive bool, requestTimeout time.Duration) (*Transaction, error)
	FinishTransaction(ctx context.Context, id string) (*Transaction, error)
	CreateTableKeys(ctx context.Context, tid dax.TableID, keys ...string) (map[string]uint64, error)
	CreateFieldKeys(ctx context.Context, tid dax.TableID, fname dax.FieldName, keys ...string) (map[string]uint64, error)
	ImportRoaringBitmap(ctx context.Context, tid dax.TableID, fld *dax.Field, shard uint64, views map[string]*roaring.Bitmap, clear bool) error
	ImportRoaringShard(ctx context.Context, tid dax.TableID, shard uint64, request *ImportRoaringShardRequest) error
	EncodeImportValues(ctx context.Context, tid dax.TableID, fld *dax.Field, shard uint64, vals []int64, ids []uint64, clear bool) (path string, data []byte, err error)
	EncodeImport(ctx context.Context, tid dax.TableID, fld *dax.Field, shard uint64, vals, ids []uint64, clear bool) (path string, data []byte, err error)
	DoImport(ctx context.Context, tid dax.TableID, fld *dax.Field, shard uint64, path string, data []byte) error
}

type RoaringUpdate

type RoaringUpdate struct {
	Field string
	View  string

	// Clear is a roaring encoded bitmatrix of bits to clear. For
	// mutex or int-like fields, only the first row is looked at and
	// the bits in that row are cleared from every row.
	Clear []byte

	// Set is the roaring encoded bitmatrix of bits to set. If this is
	// a mutex or int-like field, we'll assume the first shard width
	// of containers is the exists row and we will first clear all
	// bits in those columns and then set
	Set []byte

	// ClearRecords, when true, denotes that Clear should be
	// interpreted as a single row which will be subtracted from every
	// row in this view.
	ClearRecords bool
}

RoaringUpdate represents the bits to clear and then set in a particular view.

type SchemaAPI

type SchemaAPI interface {
	CreateDatabase(context.Context, *dax.Database) error
	DropDatabase(context.Context, dax.DatabaseID) error

	DatabaseByName(ctx context.Context, dbname dax.DatabaseName) (*dax.Database, error)
	DatabaseByID(ctx context.Context, dbid dax.DatabaseID) (*dax.Database, error)
	SetDatabaseOption(ctx context.Context, dbid dax.DatabaseID, option string, value string) error
	Databases(context.Context, ...dax.DatabaseID) ([]*dax.Database, error)

	TableByName(ctx context.Context, tname dax.TableName) (*dax.Table, error)
	TableByID(ctx context.Context, tid dax.TableID) (*dax.Table, error)
	Tables(ctx context.Context) ([]*dax.Table, error)

	CreateTable(ctx context.Context, tbl *dax.Table) error
	CreateField(ctx context.Context, tname dax.TableName, fld *dax.Field) error

	DeleteTable(ctx context.Context, tname dax.TableName) error
	DeleteField(ctx context.Context, tname dax.TableName, fname dax.FieldName) error
}

type SystemAPI

type SystemAPI interface {
	ClusterName() string
	Version() string
	PlatformDescription() string
	PlatformVersion() string
	ClusterNodeCount() int
	ClusterReplicaCount() int
	ShardWidth() int
	ClusterState() string
	DataDir() string

	NodeID() string
}

type SystemLayerAPI

type SystemLayerAPI interface {
	ExecutionRequests() ExecutionRequestsAPI
}

SystemLayerAPI defines an api to allow access to internal FeatureBase state

type Transaction

type Transaction struct {
	// ID is an arbitrary string identifier. All transactions must have a unique ID.
	ID string `json:"id"`

	// Active notes whether an exclusive transaction is active, or
	// still pending (if other active transactions exist). All
	// non-exclusive transactions are always active.
	Active bool `json:"active"`

	// Exclusive is set to true for transactions which can only become active when no other
	// transactions exist.
	Exclusive bool `json:"exclusive"`

	// Timeout is the minimum idle time for which this transaction should continue to exist.
	Timeout time.Duration `json:"timeout"`

	// CreatedAt is the timestamp at which the transaction was created. This supports
	// the case of listing transactions in a useful order.
	CreatedAt time.Time `json:"createdAt"`

	// Deadline is calculated from Timeout. TODO reset deadline each time there is activity
	// on the transaction. (we can't do this until there is some method of associating a
	// request/call with a transaction)
	Deadline time.Time `json:"deadline"`

	// Stats track statistics for the transaction. Not yet used.
	Stats TransactionStats `json:"stats"`
}

Transaction contains information related to a block of work that needs to be tracked and spans multiple API calls.

type TransactionStats

type TransactionStats struct{}

type ViewInfo

type ViewInfo struct {
	Name string `json:"name"`
}

ViewInfo represents schema information for a view.

Jump to

Keyboard shortcuts

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