v1

package
v1.0.0-alpha.19 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InsertedStatus string = "inserted"
	ReplacedStatus string = "replaced"
	UpdatedStatus  string = "updated"
	DeletedStatus  string = "deleted"
	CreatedStatus  string = "created"
	DroppedStatus  string = "dropped"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseQueryRunner

type BaseQueryRunner struct {
	// contains filtered or unexported fields
}

func NewBaseQueryRunner

func NewBaseQueryRunner(encoder metadata.Encoder, cdcMgr *cdc.Manager, txMgr *transaction.Manager) *BaseQueryRunner

func (*BaseQueryRunner) GetCollections

func (runner *BaseQueryRunner) GetCollections(db *metadata.Database, collName string) (*schema.DefaultCollection, error)

func (*BaseQueryRunner) GetDatabase

func (runner *BaseQueryRunner) GetDatabase(ctx context.Context, tx transaction.Tx, tenant *metadata.Tenant, dbName string) (*metadata.Database, error)

type CollectionQueryRunner

type CollectionQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

func (*CollectionQueryRunner) Run

func (*CollectionQueryRunner) SetCreateOrUpdateCollectionReq

func (runner *CollectionQueryRunner) SetCreateOrUpdateCollectionReq(create *api.CreateOrUpdateCollectionRequest)

func (*CollectionQueryRunner) SetDescribeCollectionReq

func (runner *CollectionQueryRunner) SetDescribeCollectionReq(describe *api.DescribeCollectionRequest)

func (*CollectionQueryRunner) SetDropCollectionReq

func (runner *CollectionQueryRunner) SetDropCollectionReq(drop *api.DropCollectionRequest)

func (*CollectionQueryRunner) SetListCollectionReq

func (runner *CollectionQueryRunner) SetListCollectionReq(list *api.ListCollectionsRequest)

type ContentType

type ContentType string
const (
	JSON ContentType = "application/json"
)

type DatabaseQueryRunner

type DatabaseQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

func (*DatabaseQueryRunner) Run

func (*DatabaseQueryRunner) SetCreateDatabaseReq

func (runner *DatabaseQueryRunner) SetCreateDatabaseReq(create *api.CreateDatabaseRequest)

func (*DatabaseQueryRunner) SetDescribeDatabaseReq

func (runner *DatabaseQueryRunner) SetDescribeDatabaseReq(describe *api.DescribeDatabaseRequest)

func (*DatabaseQueryRunner) SetDropDatabaseReq

func (runner *DatabaseQueryRunner) SetDropDatabaseReq(drop *api.DropDatabaseRequest)

func (*DatabaseQueryRunner) SetListDatabaseReq

func (runner *DatabaseQueryRunner) SetListDatabaseReq(list *api.ListDatabasesRequest)

type DeleteQueryRunner

type DeleteQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

func (*DeleteQueryRunner) Run

type InsertQueryRunner

type InsertQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

func (*InsertQueryRunner) Run

type NoopTxListener

type NoopTxListener struct{}

func (*NoopTxListener) OnPostCommit

func (l *NoopTxListener) OnPostCommit(context.Context, kv.EventListener) error

func (*NoopTxListener) OnPreCommit

func (*NoopTxListener) OnRollback

func (l *NoopTxListener) OnRollback(context.Context, kv.EventListener)

type QueryRunner

type QueryRunner interface {
	Run(ctx context.Context, tx transaction.Tx, tenant *metadata.Tenant) (*Response, context.Context, error)
}

QueryRunner is responsible for executing the current query and return the response

type QueryRunnerFactory

type QueryRunnerFactory struct {
	// contains filtered or unexported fields
}

QueryRunnerFactory is responsible for creating query runners for different queries

func NewQueryRunnerFactory

func NewQueryRunnerFactory(txMgr *transaction.Manager, encoder metadata.Encoder, cdcMgr *cdc.Manager) *QueryRunnerFactory

NewQueryRunnerFactory returns QueryRunnerFactory object

func (*QueryRunnerFactory) GetCollectionQueryRunner

func (f *QueryRunnerFactory) GetCollectionQueryRunner() *CollectionQueryRunner

func (*QueryRunnerFactory) GetDatabaseQueryRunner

func (f *QueryRunnerFactory) GetDatabaseQueryRunner() *DatabaseQueryRunner

func (*QueryRunnerFactory) GetDeleteQueryRunner

func (f *QueryRunnerFactory) GetDeleteQueryRunner(r *api.DeleteRequest) *DeleteQueryRunner

func (*QueryRunnerFactory) GetInsertQueryRunner

func (f *QueryRunnerFactory) GetInsertQueryRunner(r *api.InsertRequest) *InsertQueryRunner

func (*QueryRunnerFactory) GetReplaceQueryRunner

func (f *QueryRunnerFactory) GetReplaceQueryRunner(r *api.ReplaceRequest) *ReplaceQueryRunner

func (*QueryRunnerFactory) GetStreamingQueryRunner

func (f *QueryRunnerFactory) GetStreamingQueryRunner(r *api.ReadRequest, streaming Streaming) *StreamingQueryRunner

GetStreamingQueryRunner returns StreamingQueryRunner

func (*QueryRunnerFactory) GetUpdateQueryRunner

func (f *QueryRunnerFactory) GetUpdateQueryRunner(r *api.UpdateRequest) *UpdateQueryRunner

type QuerySession

type QuerySession struct {
	// contains filtered or unexported fields
}

func (*QuerySession) Commit

func (s *QuerySession) Commit(versionMgr *metadata.VersionHandler, incVersion bool, err error) error

func (*QuerySession) Rollback

func (s *QuerySession) Rollback() error

func (*QuerySession) Run

func (s *QuerySession) Run(runner QueryRunner) (*Response, context.Context, error)

type ReplaceQueryRunner

type ReplaceQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

func (*ReplaceQueryRunner) Run

type ReqOptions

type ReqOptions struct {
	// contains filtered or unexported fields
}

ReqOptions are options used by queryLifecycle to execute a query

type Response

type Response struct {
	api.Response
	// contains filtered or unexported fields
}

Response is a wrapper on api.Response

type Service

type Service interface {
	RegisterHTTP(router chi.Router, inproc *inprocgrpc.Channel) error
	RegisterGRPC(grpc *grpc.Server) error
}

func GetRegisteredServices

func GetRegisteredServices(kvStore kv.KeyValueStore) []Service

type SessionManager

type SessionManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SessionManager is used to manage all the explicit query sessions. The execute method is executing the query. The method uses the txCtx to understand whether the query is already started(explicit transaction) if not then it will create a QuerySession and then will execute the query. For explicit transaction, Begin/Commit/Rollback is creating/storing/removing the QuerySession.

func NewSessionManager

func NewSessionManager(txMgr *transaction.Manager, tenantMgr *metadata.TenantManager, versionH *metadata.VersionHandler, cdc *cdc.Manager) *SessionManager

func (*SessionManager) Create

func (sessMgr *SessionManager) Create(ctx context.Context, reloadVerOutside bool, track bool) (*QuerySession, error)

Create returns the QuerySession after creating all the necessary elements that a query execution needs. It first creates or get a tenant, read the metadata version and based on that reload the tenant cache and then finally create a transaction which will be used to execute all the query in this session.

func (*SessionManager) Execute

func (sessMgr *SessionManager) Execute(ctx context.Context, req *ReqOptions) (*Response, error)

Execute is responsible to execute a query. In a way this method is managing the lifecycle of a query. For implicit transaction everything is done in this method. For explicit transaction, a session may already exist, so it only needs to run without calling Commit/Rollback.

func (*SessionManager) Get

func (sessMgr *SessionManager) Get(id string) *QuerySession

func (*SessionManager) Remove

func (sessMgr *SessionManager) Remove(id string)

type Streaming

type Streaming interface {
	api.Tigris_ReadServer
}

Streaming is a wrapper interface for passing around for streaming reads

type StreamingQueryRunner

type StreamingQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

StreamingQueryRunner is a runner used for Queries that are reads and needs to return result in streaming fashion

func (*StreamingQueryRunner) Run

Run is responsible for running/executing the query

type TxListener

type TxListener interface {
	// OnPreCommit is called before committing the transaction. This means this method is useful when an operation needs
	// to guarantee transaction atomicity. Error returned by this method will roll back the user transaction.
	OnPreCommit(context.Context, transaction.Tx, kv.EventListener) error
	// OnPostCommit is called after committing the transaction. This means the transaction is complete and any post
	// activity can happen as part of this implementation.
	OnPostCommit(context.Context, kv.EventListener) error
	// OnRollback is called when the user transaction is rolled back.
	OnRollback(context.Context, kv.EventListener)
}

TxListener allows listening to a transaction outcome and process the events that is passed in the param accordingly.

type UpdateQueryRunner

type UpdateQueryRunner struct {
	*BaseQueryRunner
	// contains filtered or unexported fields
}

func (*UpdateQueryRunner) Run

Jump to

Keyboard shortcuts

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