Documentation ¶
Index ¶
- Constants
- Variables
- func BuildSecondaryIndexKeys(coll *schema.DefaultCollection, queryFilters []filter.Filter, ...) (*filter.QueryPlan, error)
- func CreateApiError(err error) error
- func CreateSearchKey(key kv.Key) (string, error)
- func IsErrConflictingTransaction(err error) bool
- func PackSearchFields(ctx context.Context, data *internal.TableData, ...) ([]byte, error)
- func UnpackSearchFields(doc map[string]any, collection *schema.DefaultCollection) (string, *internal.TableData, map[string]any, error)
- type BaseQueryRunner
- type BranchQueryRunner
- func (runner *BranchQueryRunner) Run(ctx context.Context, tx transaction.Tx, tenant *metadata.Tenant) (Response, context.Context, error)
- func (runner *BranchQueryRunner) SetCreateBranchReq(create *api.CreateBranchRequest)
- func (runner *BranchQueryRunner) SetDeleteBranchReq(deleteBranch *api.DeleteBranchRequest)
- func (runner *BranchQueryRunner) SetListBranchReq(listBranch *api.ListBranchesRequest)
- type CollectionQueryRunner
- func (runner *CollectionQueryRunner) Run(ctx context.Context, tx transaction.Tx, tenant *metadata.Tenant) (Response, context.Context, error)
- func (runner *CollectionQueryRunner) SetCreateOrUpdateCollectionReq(create *api.CreateOrUpdateCollectionRequest)
- func (runner *CollectionQueryRunner) SetDescribeCollectionReq(describe *api.DescribeCollectionRequest)
- func (runner *CollectionQueryRunner) SetDropCollectionReq(drop *api.DropCollectionRequest)
- func (runner *CollectionQueryRunner) SetListCollectionReq(list *api.ListCollectionsRequest)
- type CountQueryRunner
- type DeleteQueryRunner
- type ExplainQueryRunner
- type FilterIterator
- type FilterableSearchIterator
- type ImportQueryRunner
- type IndexRow
- type IndexerRunner
- type IndexerUpdateSet
- type InsertQueryRunner
- type Iterator
- type KeyIterator
- type NoopTxListener
- type PrimaryIndexPlanner
- func (planner *PrimaryIndexPlanner) GeneratePlan(sortPlan *filter.QueryPlan, from keys.Key) (*filter.QueryPlan, error)
- func (planner *PrimaryIndexPlanner) GenerateTablePlan(sortPlan *filter.QueryPlan, from keys.Key) (*filter.TableScanPlan, error)
- func (planner *PrimaryIndexPlanner) IsPrefixQueryWithSuffixSort(sortPlan *filter.QueryPlan) bool
- func (planner *PrimaryIndexPlanner) SortPlan(sorting *sort.Ordering) (*filter.QueryPlan, error)
- type ProgressUpdateFn
- type ProjectQueryRunner
- func (runner *ProjectQueryRunner) Run(ctx context.Context, tx transaction.Tx, tenant *metadata.Tenant) (Response, context.Context, error)
- func (runner *ProjectQueryRunner) SetCreateProjectReq(create *api.CreateProjectRequest)
- func (runner *ProjectQueryRunner) SetDeleteProjectReq(d *api.DeleteProjectRequest)
- func (runner *ProjectQueryRunner) SetDescribeDatabaseReq(describe *api.DescribeDatabaseRequest)
- func (runner *ProjectQueryRunner) SetListProjectsReq(list *api.ListProjectsRequest)
- func (runner *ProjectQueryRunner) SetUpdateProjectReq(update *api.UpdateProjectRequest)
- type QueryRunner
- type QueryRunnerFactory
- func (f *QueryRunnerFactory) GetBranchQueryRunner(accessToken *types.AccessToken) *BranchQueryRunner
- func (f *QueryRunnerFactory) GetCollectionQueryRunner(accessToken *types.AccessToken) *CollectionQueryRunner
- func (f *QueryRunnerFactory) GetCountQueryRunner(r *api.CountRequest, qm *metrics.StreamingQueryMetrics, ...) *CountQueryRunner
- func (f *QueryRunnerFactory) GetDeleteQueryRunner(r *api.DeleteRequest, qm *metrics.WriteQueryMetrics, ...) *DeleteQueryRunner
- func (f *QueryRunnerFactory) GetExplainQueryRunner(r *api.ReadRequest, _ *metrics.WriteQueryMetrics, ...) *ExplainQueryRunner
- func (f *QueryRunnerFactory) GetImportQueryRunner(r *api.ImportRequest, qm *metrics.WriteQueryMetrics, ...) *ImportQueryRunner
- func (f *QueryRunnerFactory) GetIndexRunner(r *api.BuildCollectionIndexRequest, queryMetrics *metrics.WriteQueryMetrics, ...) *IndexerRunner
- func (f *QueryRunnerFactory) GetInsertQueryRunner(r *api.InsertRequest, qm *metrics.WriteQueryMetrics, ...) *InsertQueryRunner
- func (f *QueryRunnerFactory) GetProjectQueryRunner(accessToken *types.AccessToken) *ProjectQueryRunner
- func (f *QueryRunnerFactory) GetReplaceQueryRunner(r *api.ReplaceRequest, qm *metrics.WriteQueryMetrics, ...) *ReplaceQueryRunner
- func (f *QueryRunnerFactory) GetSearchIndexRunner(r *api.BuildCollectionSearchIndexRequest, ...) *SearchIndexerRunner
- func (f *QueryRunnerFactory) GetSearchQueryRunner(r *api.SearchRequest, streaming SearchStreaming, ...) *SearchQueryRunner
- func (f *QueryRunnerFactory) GetStreamingQueryRunner(r *api.ReadRequest, streaming Streaming, qm *metrics.StreamingQueryMetrics, ...) *StreamingQueryRunner
- func (f *QueryRunnerFactory) GetUpdateQueryRunner(r *api.UpdateRequest, qm *metrics.WriteQueryMetrics, ...) *UpdateQueryRunner
- type QuerySession
- func (s *QuerySession) Commit(versionMgr *metadata.VersionHandler, incVersion bool, err error) error
- func (s *QuerySession) GetTransactionCtx() *api.TransactionCtx
- func (s *QuerySession) GetTx() transaction.Tx
- func (s *QuerySession) Rollback() error
- func (s *QuerySession) Run(runner QueryRunner) (Response, context.Context, error)
- type ReadOnlyQueryRunner
- type ReadOnlySession
- type Reader
- func (*Reader) FilteredRead(iterator Iterator, filter *filter.WrappedFilter) (Iterator, error)
- func (reader *Reader) KeyIterator(ikeys []keys.Key) (Iterator, error)
- func (reader *Reader) ScanIterator(from keys.Key, to keys.Key, reverse bool) (Iterator, error)
- func (reader *Reader) ScanTable(table []byte, reverse bool) (Iterator, error)
- func (reader *Reader) StrictlyKeysFrom(ikeys []keys.Key, from []byte) (Iterator, error)
- type ReplaceQueryRunner
- type ReqOptions
- type Response
- type Row
- type ScanIterator
- type SearchIndexer
- func (i *SearchIndexer) OnPostCommit(ctx context.Context, _ *metadata.Tenant, eventListener kv.EventListener) error
- func (*SearchIndexer) OnPreCommit(context.Context, *metadata.Tenant, transaction.Tx, kv.EventListener) error
- func (*SearchIndexer) OnRollback(context.Context, *metadata.Tenant, kv.EventListener)
- type SearchIndexerRunner
- type SearchQueryRunner
- type SearchReader
- type SearchStreaming
- type SecondaryIndexInfo
- type SecondaryIndexReaderImpl
- type SecondaryIndexer
- type SecondaryIndexerImpl
- func (q *SecondaryIndexerImpl) BuildCollection(ctx context.Context, txMgr *transaction.Manager, ...) error
- func (q *SecondaryIndexerImpl) Delete(ctx context.Context, tx transaction.Tx, td *internal.TableData, ...) error
- func (q *SecondaryIndexerImpl) DeleteIndex(ctx context.Context, tx transaction.Tx, index *schema.Index) error
- func (q *SecondaryIndexerImpl) Index(ctx context.Context, tx transaction.Tx, td *internal.TableData, ...) error
- func (q *SecondaryIndexerImpl) IndexInfo(ctx context.Context, tx transaction.Tx) (*SecondaryIndexInfo, error)
- func (q *SecondaryIndexerImpl) IndexSize(ctx context.Context, tx transaction.Tx) (int64, error)
- func (q *SecondaryIndexerImpl) ReadDocAndDelete(ctx context.Context, tx transaction.Tx, key keys.Key) (int32, error)
- func (q *SecondaryIndexerImpl) Update(ctx context.Context, tx transaction.Tx, newTd *internal.TableData, ...) error
- type Session
- type SessionManager
- func (sessMgr *SessionManager) Create(ctx context.Context, trackVerInOwnTxn bool, instantVerTracking bool, ...) (*QuerySession, error)
- func (sessMgr *SessionManager) CreateReadOnlySession(ctx context.Context) (*ReadOnlySession, error)
- func (sessMgr *SessionManager) Execute(ctx context.Context, runner QueryRunner, req ReqOptions) (Response, error)
- func (sessMgr *SessionManager) Get(ctx context.Context) (*QuerySession, error)
- func (sessMgr *SessionManager) ReadOnlyExecute(ctx context.Context, runner ReadOnlyQueryRunner, _ ReqOptions) (Response, error)
- func (sessMgr *SessionManager) Remove(ctx context.Context) error
- type SessionManagerWithMetrics
- func (m *SessionManagerWithMetrics) Create(ctx context.Context, trackVerInOwnTxn bool, instantVerTracking bool, ...) (qs *QuerySession, err error)
- func (m *SessionManagerWithMetrics) Execute(ctx context.Context, runner QueryRunner, req ReqOptions) (resp Response, err error)
- func (m *SessionManagerWithMetrics) Get(ctx context.Context) (qs *QuerySession, err error)
- func (m *SessionManagerWithMetrics) ReadOnlyExecute(ctx context.Context, runner ReadOnlyQueryRunner, req ReqOptions) (resp Response, err error)
- func (m *SessionManagerWithMetrics) Remove(ctx context.Context) (err error)
- type StreamProducer
- func (*StreamProducer) Context() context.Context
- func (*StreamProducer) RecvMsg(_ any) error
- func (c *StreamProducer) Send(r *api.ReadResponse) error
- func (*StreamProducer) SendHeader(_ metadata.MD) error
- func (*StreamProducer) SendMsg(_ any) error
- func (*StreamProducer) SetHeader(_ metadata.MD) error
- func (*StreamProducer) SetTrailer(_ metadata.MD)
- func (c *StreamProducer) Stream(req *api.ReadRequest)
- type Streaming
- type StreamingQueryRunner
- type TentativeSearchKeysToRemove
- type TxListener
- type UpdateQueryRunner
Constants ¶
const ( PRIMARY = "primary index" SECONDARY = "secondary index" )
const ( InsertedStatus string = "inserted" ReplacedStatus string = "replaced" UpdatedStatus string = "updated" DeletedStatus string = "deleted" CreatedStatus string = "created" DroppedStatus string = "dropped" OkStatus string = "success" )
const ( NamespaceLocalization = "namespace_localization" Component = "component" )
Variables ¶
var ( StubFieldName = "._tigris_array_stub" KVSubspace = "kvs" InfoSubspace = "_info" CountSubSpace = "count" SizeSubSpace = "size" )
var PrimaryKeyPos = 6
Functions ¶
func BuildSecondaryIndexKeys ¶
func CreateApiError ¶
CreateApiError helps construct API errors from internal errors.
func PackSearchFields ¶
Types ¶
type BaseQueryRunner ¶
type BaseQueryRunner struct {
// contains filtered or unexported fields
}
func NewBaseQueryRunner ¶
func NewBaseQueryRunner(encoder metadata.Encoder, cdcMgr *cdc.Manager, txMgr *transaction.Manager, searchStore search.Store, accessToken *types.AccessToken) *BaseQueryRunner
type BranchQueryRunner ¶
type BranchQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
func (*BranchQueryRunner) SetCreateBranchReq ¶
func (runner *BranchQueryRunner) SetCreateBranchReq(create *api.CreateBranchRequest)
func (*BranchQueryRunner) SetDeleteBranchReq ¶
func (runner *BranchQueryRunner) SetDeleteBranchReq(deleteBranch *api.DeleteBranchRequest)
func (*BranchQueryRunner) SetListBranchReq ¶
func (runner *BranchQueryRunner) SetListBranchReq(listBranch *api.ListBranchesRequest)
type CollectionQueryRunner ¶
type CollectionQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
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 CountQueryRunner ¶
type CountQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type DeleteQueryRunner ¶
type DeleteQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type ExplainQueryRunner ¶
type ExplainQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type FilterIterator ¶
type FilterIterator struct {
// contains filtered or unexported fields
}
FilterIterator only returns elements that match the given predicate.
func NewFilterIterator ¶
func NewFilterIterator(iterator Iterator, filter *filter.WrappedFilter) *FilterIterator
func (*FilterIterator) Interrupted ¶
func (it *FilterIterator) Interrupted() error
func (*FilterIterator) Next ¶
func (it *FilterIterator) Next(row *Row) bool
Next advances the iterator till the matching row found and then only fill the row object. In contrast to Iterator, filterable allows filtering during iterating of document. Underneath it is just using Iterator to iterate over rows to apply filter.
type FilterableSearchIterator ¶
type FilterableSearchIterator struct {
// contains filtered or unexported fields
}
func NewFilterableSearchIterator ¶
func NewFilterableSearchIterator(ctx context.Context, collection *schema.DefaultCollection, reader *pageReader, filter *filter.WrappedFilter, singlePage bool) *FilterableSearchIterator
func (*FilterableSearchIterator) Interrupted ¶
func (it *FilterableSearchIterator) Interrupted() error
func (*FilterableSearchIterator) Next ¶
func (it *FilterableSearchIterator) Next(row *Row) bool
type ImportQueryRunner ¶
type ImportQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type IndexerRunner ¶
type IndexerRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type IndexerUpdateSet ¶
type IndexerUpdateSet struct {
// contains filtered or unexported fields
}
type InsertQueryRunner ¶
type InsertQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type Iterator ¶
type Iterator interface { // Next fills the next element in the iteration. Returns true if the Iterator has more element. Next(*Row) bool // Interrupted returns an error if iterator encounters any error. Interrupted() error }
Iterator is to iterate over a single collection.
func NewSecondaryIndexReader ¶
func NewSecondaryIndexReader(ctx context.Context, tx transaction.Tx, coll *schema.DefaultCollection, filter *filter.WrappedFilter, queryPlan *filter.QueryPlan) (Iterator, error)
type KeyIterator ¶
type KeyIterator struct {
// contains filtered or unexported fields
}
func NewKeyIterator ¶
func NewKeyIterator(ctx context.Context, tx transaction.Tx, keys []keys.Key, reverse bool) (*KeyIterator, error)
func (*KeyIterator) Interrupted ¶
func (k *KeyIterator) Interrupted() error
func (*KeyIterator) Next ¶
func (k *KeyIterator) Next(row *Row) bool
type NoopTxListener ¶
type NoopTxListener struct{}
func (*NoopTxListener) OnPostCommit ¶
func (*NoopTxListener) OnPostCommit(context.Context, *metadata.Tenant, kv.EventListener) error
func (*NoopTxListener) OnPreCommit ¶
func (*NoopTxListener) OnPreCommit(context.Context, *metadata.Tenant, transaction.Tx, kv.EventListener) error
func (*NoopTxListener) OnRollback ¶
func (*NoopTxListener) OnRollback(context.Context, *metadata.Tenant, kv.EventListener)
type PrimaryIndexPlanner ¶
type PrimaryIndexPlanner struct {
// contains filtered or unexported fields
}
func NewPrimaryIndexQueryPlanner ¶
func NewPrimaryIndexQueryPlanner(coll *schema.DefaultCollection, e metadata.Encoder, f []byte, c *value.Collation) (*PrimaryIndexPlanner, error)
func (*PrimaryIndexPlanner) GeneratePlan ¶
func (*PrimaryIndexPlanner) GenerateTablePlan ¶
func (planner *PrimaryIndexPlanner) GenerateTablePlan(sortPlan *filter.QueryPlan, from keys.Key) (*filter.TableScanPlan, error)
func (*PrimaryIndexPlanner) IsPrefixQueryWithSuffixSort ¶
func (planner *PrimaryIndexPlanner) IsPrefixQueryWithSuffixSort(sortPlan *filter.QueryPlan) bool
IsPrefixQueryWithSuffixSort returns if it is prefix query with sort can be on suffix primary key field ToDo: This needs to be moved inside builder where we need to build prefix keys as well.
type ProgressUpdateFn ¶
type ProgressUpdateFn func(ctx context.Context, tx transaction.Tx) error
type ProjectQueryRunner ¶
type ProjectQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
func (*ProjectQueryRunner) SetCreateProjectReq ¶
func (runner *ProjectQueryRunner) SetCreateProjectReq(create *api.CreateProjectRequest)
func (*ProjectQueryRunner) SetDeleteProjectReq ¶
func (runner *ProjectQueryRunner) SetDeleteProjectReq(d *api.DeleteProjectRequest)
func (*ProjectQueryRunner) SetDescribeDatabaseReq ¶
func (runner *ProjectQueryRunner) SetDescribeDatabaseReq(describe *api.DescribeDatabaseRequest)
func (*ProjectQueryRunner) SetListProjectsReq ¶
func (runner *ProjectQueryRunner) SetListProjectsReq(list *api.ListProjectsRequest)
func (*ProjectQueryRunner) SetUpdateProjectReq ¶
func (runner *ProjectQueryRunner) SetUpdateProjectReq(update *api.UpdateProjectRequest)
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, cdcMgr *cdc.Manager, searchStore search.Store) *QueryRunnerFactory
NewQueryRunnerFactory returns QueryRunnerFactory object.
func (*QueryRunnerFactory) GetBranchQueryRunner ¶
func (f *QueryRunnerFactory) GetBranchQueryRunner(accessToken *types.AccessToken) *BranchQueryRunner
func (*QueryRunnerFactory) GetCollectionQueryRunner ¶
func (f *QueryRunnerFactory) GetCollectionQueryRunner(accessToken *types.AccessToken) *CollectionQueryRunner
func (*QueryRunnerFactory) GetCountQueryRunner ¶
func (f *QueryRunnerFactory) GetCountQueryRunner(r *api.CountRequest, qm *metrics.StreamingQueryMetrics, accessToken *types.AccessToken) *CountQueryRunner
func (*QueryRunnerFactory) GetDeleteQueryRunner ¶
func (f *QueryRunnerFactory) GetDeleteQueryRunner(r *api.DeleteRequest, qm *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *DeleteQueryRunner
func (*QueryRunnerFactory) GetExplainQueryRunner ¶
func (f *QueryRunnerFactory) GetExplainQueryRunner(r *api.ReadRequest, _ *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *ExplainQueryRunner
func (*QueryRunnerFactory) GetImportQueryRunner ¶
func (f *QueryRunnerFactory) GetImportQueryRunner(r *api.ImportRequest, qm *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *ImportQueryRunner
func (*QueryRunnerFactory) GetIndexRunner ¶
func (f *QueryRunnerFactory) GetIndexRunner(r *api.BuildCollectionIndexRequest, queryMetrics *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *IndexerRunner
func (*QueryRunnerFactory) GetInsertQueryRunner ¶
func (f *QueryRunnerFactory) GetInsertQueryRunner(r *api.InsertRequest, qm *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *InsertQueryRunner
func (*QueryRunnerFactory) GetProjectQueryRunner ¶
func (f *QueryRunnerFactory) GetProjectQueryRunner(accessToken *types.AccessToken) *ProjectQueryRunner
func (*QueryRunnerFactory) GetReplaceQueryRunner ¶
func (f *QueryRunnerFactory) GetReplaceQueryRunner(r *api.ReplaceRequest, qm *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *ReplaceQueryRunner
func (*QueryRunnerFactory) GetSearchIndexRunner ¶
func (f *QueryRunnerFactory) GetSearchIndexRunner(r *api.BuildCollectionSearchIndexRequest, queryMetrics *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *SearchIndexerRunner
func (*QueryRunnerFactory) GetSearchQueryRunner ¶
func (f *QueryRunnerFactory) GetSearchQueryRunner(r *api.SearchRequest, streaming SearchStreaming, qm *metrics.SearchQueryMetrics, accessToken *types.AccessToken) *SearchQueryRunner
GetSearchQueryRunner for executing Search.
func (*QueryRunnerFactory) GetStreamingQueryRunner ¶
func (f *QueryRunnerFactory) GetStreamingQueryRunner(r *api.ReadRequest, streaming Streaming, qm *metrics.StreamingQueryMetrics, accessToken *types.AccessToken) *StreamingQueryRunner
GetStreamingQueryRunner returns StreamingQueryRunner.
func (*QueryRunnerFactory) GetUpdateQueryRunner ¶
func (f *QueryRunnerFactory) GetUpdateQueryRunner(r *api.UpdateRequest, qm *metrics.WriteQueryMetrics, accessToken *types.AccessToken) *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) GetTransactionCtx ¶
func (s *QuerySession) GetTransactionCtx() *api.TransactionCtx
func (*QuerySession) GetTx ¶
func (s *QuerySession) GetTx() transaction.Tx
func (*QuerySession) Rollback ¶
func (s *QuerySession) Rollback() error
func (*QuerySession) Run ¶
func (s *QuerySession) Run(runner QueryRunner) (Response, context.Context, error)
type ReadOnlyQueryRunner ¶
type ReadOnlyQueryRunner interface {
ReadOnly(ctx context.Context, tenant *metadata.Tenant) (Response, context.Context, error)
}
ReadOnlyQueryRunner is the QueryRunner which decides inside the ReadOnly method if the query needs to be run inside a transaction or can opt to just execute the query. This interface allows caller to control the state of the transaction or can choose to execute without starting any transaction.
type ReadOnlySession ¶
type ReadOnlySession struct {
// contains filtered or unexported fields
}
func (*ReadOnlySession) Run ¶
func (s *ReadOnlySession) Run(runner ReadOnlyQueryRunner) (Response, context.Context, error)
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewDatabaseReader ¶
func NewDatabaseReader(ctx context.Context, tx transaction.Tx) *Reader
func (*Reader) FilteredRead ¶
FilteredRead returns an iterator that implicitly will be doing filtering on the iterator.
func (*Reader) KeyIterator ¶
KeyIterator returns an iterator that iterates on a key or a set of keys.
func (*Reader) ScanIterator ¶
ScanIterator only returns an iterator that has elements starting from.
type ReplaceQueryRunner ¶
type ReplaceQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
type ReqOptions ¶
type ReqOptions struct { TxCtx *api.TransactionCtx MetadataChange bool InstantVerTracking bool }
ReqOptions are options used by queryLifecycle to execute a query.
type Response ¶
type Response struct { api.Response Status string CreatedAt *internal.Timestamp UpdatedAt *internal.Timestamp DeletedAt *internal.Timestamp ModifiedCount int32 AllKeys [][]byte }
Response is a wrapper on api.Response.
type ScanIterator ¶
type ScanIterator struct {
// contains filtered or unexported fields
}
func NewScanIterator ¶
func (*ScanIterator) Interrupted ¶
func (s *ScanIterator) Interrupted() error
func (*ScanIterator) Next ¶
func (s *ScanIterator) Next(row *Row) bool
type SearchIndexer ¶
type SearchIndexer struct {
// contains filtered or unexported fields
}
func NewSearchIndexer ¶
func NewSearchIndexer(searchStore search.Store, tenantMgr *metadata.TenantManager) *SearchIndexer
func (*SearchIndexer) OnPostCommit ¶
func (i *SearchIndexer) OnPostCommit(ctx context.Context, _ *metadata.Tenant, eventListener kv.EventListener) error
func (*SearchIndexer) OnPreCommit ¶
func (*SearchIndexer) OnPreCommit(context.Context, *metadata.Tenant, transaction.Tx, kv.EventListener) error
func (*SearchIndexer) OnRollback ¶
func (*SearchIndexer) OnRollback(context.Context, *metadata.Tenant, kv.EventListener)
type SearchIndexerRunner ¶
type SearchIndexerRunner struct { *BaseQueryRunner ProgressUpdate func(context.Context) error // contains filtered or unexported fields }
type SearchQueryRunner ¶
type SearchQueryRunner struct { *BaseQueryRunner // contains filtered or unexported fields }
SearchQueryRunner is a runner used for Queries that are reads and needs to return result in streaming fashion.
func (*SearchQueryRunner) ReadOnly ¶
func (runner *SearchQueryRunner) ReadOnly(ctx context.Context, tenant *metadata.Tenant) (Response, context.Context, error)
ReadOnly on search query runner is implemented as search queries do not need to be inside a transaction; in fact, there is no need to start any transaction for search queries as they are simply forwarded to the indexing store.
type SearchReader ¶
type SearchReader struct {
// contains filtered or unexported fields
}
SearchReader is responsible for iterating on the search results. It uses pageReader internally to read page and then iterate on documents inside hits.
func NewSearchReader ¶
func NewSearchReader(ctx context.Context, store search.Store, coll *schema.DefaultCollection, query *qsearch.Query) *SearchReader
func (*SearchReader) Iterator ¶
func (reader *SearchReader) Iterator(ctx context.Context, collection *schema.DefaultCollection, filter *filter.WrappedFilter) *FilterableSearchIterator
func (*SearchReader) SinglePageIterator ¶
func (reader *SearchReader) SinglePageIterator(ctx context.Context, collection *schema.DefaultCollection, filter *filter.WrappedFilter, pageNo int32) *FilterableSearchIterator
type SearchStreaming ¶
type SearchStreaming interface { api.Tigris_SearchServer }
type SecondaryIndexInfo ¶
type SecondaryIndexReaderImpl ¶
type SecondaryIndexReaderImpl struct {
// contains filtered or unexported fields
}
func (*SecondaryIndexReaderImpl) Interrupted ¶
func (r *SecondaryIndexReaderImpl) Interrupted() error
func (*SecondaryIndexReaderImpl) Next ¶
func (r *SecondaryIndexReaderImpl) Next(row *Row) bool
type SecondaryIndexer ¶
type SecondaryIndexer interface { // Bulk build the indexes in the collection BuildCollection(ctx context.Context, txMgr *transaction.Manager, progressUpdate ProgressUpdateFn) error // Read the document from the primary store and delete it from secondary indexes ReadDocAndDelete(ctx context.Context, tx transaction.Tx, key keys.Key) (int32, error) // Delete document from the secondary index Delete(ctx context.Context, tx transaction.Tx, td *internal.TableData, primaryKey []any) error // Index new document Index(ctx context.Context, tx transaction.Tx, td *internal.TableData, primaryKey []any) error // Update an existing document in the secondary index Update(ctx context.Context, tx transaction.Tx, newTd *internal.TableData, oldTd *internal.TableData, primaryKey []any) error // Delete the KVS for an index DeleteIndex(ctx context.Context, tx transaction.Tx, index *schema.Index) error }
func NewSecondaryIndexer ¶
func NewSecondaryIndexer(coll *schema.DefaultCollection, indexWriteModeOnly bool) SecondaryIndexer
type SecondaryIndexerImpl ¶
type SecondaryIndexerImpl struct {
// contains filtered or unexported fields
}
func (*SecondaryIndexerImpl) BuildCollection ¶
func (q *SecondaryIndexerImpl) BuildCollection(ctx context.Context, txMgr *transaction.Manager, progressUpdate ProgressUpdateFn) error
func (*SecondaryIndexerImpl) Delete ¶
func (q *SecondaryIndexerImpl) Delete(ctx context.Context, tx transaction.Tx, td *internal.TableData, primaryKey []any) error
func (*SecondaryIndexerImpl) DeleteIndex ¶
func (q *SecondaryIndexerImpl) DeleteIndex(ctx context.Context, tx transaction.Tx, index *schema.Index) error
func (*SecondaryIndexerImpl) Index ¶
func (q *SecondaryIndexerImpl) Index(ctx context.Context, tx transaction.Tx, td *internal.TableData, primaryKey []any) error
func (*SecondaryIndexerImpl) IndexInfo ¶
func (q *SecondaryIndexerImpl) IndexInfo(ctx context.Context, tx transaction.Tx) (*SecondaryIndexInfo, error)
The count of the number of rows in the index is not efficient it will read through the whole index and count the number of rows. The size of the index is an estimate and will need at least 100 rows before it will start returning a number for the size.
func (*SecondaryIndexerImpl) IndexSize ¶
func (q *SecondaryIndexerImpl) IndexSize(ctx context.Context, tx transaction.Tx) (int64, error)
func (*SecondaryIndexerImpl) ReadDocAndDelete ¶
func (q *SecondaryIndexerImpl) ReadDocAndDelete(ctx context.Context, tx transaction.Tx, key keys.Key) (int32, error)
type Session ¶
type Session interface { Create(ctx context.Context, trackVerInOwnTxn bool, instantVerTracking bool, track bool) (*QuerySession, error) Get(ctx context.Context) (*QuerySession, error) Remove(ctx context.Context) error ReadOnlyExecute(ctx context.Context, runner ReadOnlyQueryRunner, req ReqOptions) (Response, error) Execute(ctx context.Context, runner QueryRunner, req ReqOptions) (Response, error) // contains filtered or unexported methods }
type SessionManager ¶
func NewSessionManager ¶
func NewSessionManager(txMgr *transaction.Manager, tenantMgr *metadata.TenantManager, listeners []TxListener, tenantTracker *metadata.CacheTracker) *SessionManager
func (*SessionManager) Create ¶
func (sessMgr *SessionManager) Create(ctx context.Context, trackVerInOwnTxn bool, instantVerTracking 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) CreateReadOnlySession ¶
func (sessMgr *SessionManager) CreateReadOnlySession(ctx context.Context) (*ReadOnlySession, error)
func (*SessionManager) Execute ¶
func (sessMgr *SessionManager) Execute(ctx context.Context, runner QueryRunner, 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(ctx context.Context) (*QuerySession, error)
func (*SessionManager) ReadOnlyExecute ¶
func (sessMgr *SessionManager) ReadOnlyExecute(ctx context.Context, runner ReadOnlyQueryRunner, _ ReqOptions) (Response, error)
type SessionManagerWithMetrics ¶
type SessionManagerWithMetrics struct {
// contains filtered or unexported fields
}
func NewSessionManagerWithMetrics ¶
func NewSessionManagerWithMetrics(txMgr *transaction.Manager, tenantMgr *metadata.TenantManager, listeners []TxListener, tenantTracker *metadata.CacheTracker) *SessionManagerWithMetrics
func (*SessionManagerWithMetrics) Create ¶
func (m *SessionManagerWithMetrics) Create(ctx context.Context, trackVerInOwnTxn bool, instantVerTracking bool, track bool) (qs *QuerySession, err error)
func (*SessionManagerWithMetrics) Execute ¶
func (m *SessionManagerWithMetrics) Execute(ctx context.Context, runner QueryRunner, req ReqOptions) (resp Response, err error)
func (*SessionManagerWithMetrics) Get ¶
func (m *SessionManagerWithMetrics) Get(ctx context.Context) (qs *QuerySession, err error)
func (*SessionManagerWithMetrics) ReadOnlyExecute ¶
func (m *SessionManagerWithMetrics) ReadOnlyExecute(ctx context.Context, runner ReadOnlyQueryRunner, req ReqOptions) (resp Response, err error)
type StreamProducer ¶
type StreamProducer struct {
// contains filtered or unexported fields
}
func NewStreamer ¶
func NewStreamer(_ context.Context, tenant *metadata2.Tenant, base *BaseQueryRunner, consumer consumer) *StreamProducer
func (*StreamProducer) Context ¶
func (*StreamProducer) Context() context.Context
func (*StreamProducer) RecvMsg ¶
func (*StreamProducer) RecvMsg(_ any) error
func (*StreamProducer) Send ¶
func (c *StreamProducer) Send(r *api.ReadResponse) error
func (*StreamProducer) SendHeader ¶
func (*StreamProducer) SendHeader(_ metadata.MD) error
func (*StreamProducer) SendMsg ¶
func (*StreamProducer) SendMsg(_ any) error
func (*StreamProducer) SetTrailer ¶
func (*StreamProducer) SetTrailer(_ metadata.MD)
func (*StreamProducer) Stream ¶
func (c *StreamProducer) Stream(req *api.ReadRequest)
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) ReadOnly ¶
func (runner *StreamingQueryRunner) ReadOnly(ctx context.Context, tenant *metadata.Tenant) (Response, context.Context, error)
ReadOnly is used by the read query runner to handle long-running reads. This method operates by starting a new transaction when needed which means a single user request may end up creating multiple read only transactions.
func (*StreamingQueryRunner) Run ¶
func (runner *StreamingQueryRunner) Run(ctx context.Context, tx transaction.Tx, tenant *metadata.Tenant) (Response, context.Context, error)
Run is responsible for running the read in the transaction started by the session manager. This doesn't do any retry if we see ErrTransactionMaxDurationReached which is expected because we do not expect caller to do long reads in an explicit transaction.
type TentativeSearchKeysToRemove ¶
type TentativeSearchKeysToRemove struct{}
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, *metadata.Tenant, 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, *metadata.Tenant, kv.EventListener) error // OnRollback is called when the user transaction is rolled back. OnRollback(context.Context, *metadata.Tenant, 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 }
Source Files ¶
- base_runner.go
- collection_runner.go
- database_runner.go
- errors.go
- import_runner.go
- indexer_runner.go
- key_generator.go
- measure.go
- mutator.go
- query_planner.go
- query_runner.go
- query_runner_factory.go
- request.go
- row_reader.go
- search_indexer.go
- search_reader.go
- search_runner.go
- secondary_index_measure.go
- secondary_index_reader.go
- secondary_indexer.go
- sessions.go
- stream_producer.go
- tx_listener.go