Documentation
¶
Index ¶
- func CreateEngines(ctx context.Context, opts TestOptions, t *testing.T, ...) (disttaeEngine *TestDisttaeEngine, taeEngine *TestTxnStorage, ...)
- func EmptyBatchFromSchema(schema *catalog.Schema, sels ...int) *batch.Batch
- func EndThisStatement(ctx context.Context, txn client.TxnOperator) (err error)
- func EngineDefAddIndex(defs []engine.TableDef, idxColName string) []engine.TableDef
- func EngineTableDefBySchema(schema *catalog.Schema) ([]engine.TableDef, error)
- func GetDefaultTNShard() metadata.TNShard
- func GetDefaultTestPath(module string, t *testing.T) string
- func GetRelationReader(ctx context.Context, e *TestDisttaeEngine, txn client.TxnOperator, ...) (reader engine.Reader, err error)
- func GetTableTxnReader(ctx context.Context, e *TestDisttaeEngine, dbName, tableName string, ...) (txn client.TxnOperator, relation engine.Relation, reader engine.Reader, ...)
- func InitTxnHandle(ctx context.Context, taeDir string, opts *options.Options) *rpc.Handle
- func MakeDefaultTestPath(module string, t *testing.T) string
- func MakeTxnHeartbeatMonkeyJob(e *TestTxnStorage, opInterval time.Duration) *tasks.CancelableJob
- func MockShardService() *mockShardService
- func NewDefaultTableReader(ctx context.Context, rel engine.Relation, expr *plan.Expr, mp *mpool.MPool, ...) (engine.Reader, error)
- func PlanTableDefBySchema(schema *catalog.Schema, tableId uint64, databaseName string) plan.TableDef
- func TxnRanges(ctx context.Context, txn client.TxnOperator, relation engine.Relation, ...) (engine.RelData, error)
- func WriteToRelation(ctx context.Context, txn client.TxnOperator, relation engine.Relation, ...) (err error)
- type EnginePack
- func (p *EnginePack) Close()
- func (p *EnginePack) CreateDB(txnop client.TxnOperator, dbname string) engine.Database
- func (p *EnginePack) CreateDBAndTable(txnop client.TxnOperator, dbname string, schema *catalog.Schema) (engine.Database, engine.Relation)
- func (p *EnginePack) CreateDBAndTables(txnop client.TxnOperator, dbname string, schema ...*catalog.Schema) (engine.Database, []engine.Relation)
- func (p *EnginePack) CreateTableInDB(txnop client.TxnOperator, dbname string, schema *catalog.Schema) engine.Relation
- func (p *EnginePack) DeleteTableInDB(txnop client.TxnOperator, dbname, tblname string)
- func (p *EnginePack) StartCNTxn(opts ...client.TxnOption) client.TxnOperator
- type MockLogtailPRCServer
- type MockLogtailRPCClient
- func (c *MockLogtailRPCClient) Close() error
- func (c *MockLogtailRPCClient) CloseBackend() error
- func (c *MockLogtailRPCClient) NewStream(ctx context.Context, backend string, lock bool) (morpc.Stream, error)
- func (c *MockLogtailRPCClient) Ping(ctx context.Context, backend string) error
- func (c *MockLogtailRPCClient) Send(ctx context.Context, backend string, request morpc.Message) (*morpc.Future, error)
- type MockRPCAgent
- func (a *MockRPCAgent) Close()
- func (a *MockRPCAgent) MockLogtailPRCServerFactory(name string, address string, logtailServer *service.LogtailServer, ...) (morpc.RPCServer, error)
- func (a *MockRPCAgent) MockLogtailRPCClientFactory(ctx context.Context, sid string, serverAddr string, ownClient morpc.RPCClient) (morpc.RPCClient, morpc.Stream, error)
- type MockRPCClientStream
- type PInmemRowsStats
- type PObjectStats
- type PartitionStateStats
- type TestDisttaeEngine
- func (de *TestDisttaeEngine) Close(ctx context.Context)
- func (de *TestDisttaeEngine) CreateDatabaseAndTable(ctx context.Context, databaseName, tableName string, schema *catalog2.Schema) (database engine.Database, table engine.Relation, err error)
- func (de *TestDisttaeEngine) GetPartitionStateStats(ctx context.Context, databaseId, tableId uint64) (stats PartitionStateStats, err error)
- func (de *TestDisttaeEngine) GetTable(ctx context.Context, databaseName, tableName string) (database engine.Database, relation engine.Relation, txn client.TxnOperator, ...)
- func (de *TestDisttaeEngine) GetTxnClient() client.TxnClient
- func (de *TestDisttaeEngine) GetTxnOperator() client.TxnOperator
- func (de *TestDisttaeEngine) NewTxnOperator(ctx context.Context, commitTS timestamp.Timestamp, opts ...client.TxnOption) (client.TxnOperator, error)
- func (de *TestDisttaeEngine) Now() timestamp.Timestamp
- func (de *TestDisttaeEngine) SubscribeTable(ctx context.Context, dbID, tbID uint64, dbName, tblName string, ...) (err error)
- type TestDisttaeEngineOptions
- func WithDisttaeEngineCommitWorkspaceThreshold(v uint64) TestDisttaeEngineOptions
- func WithDisttaeEngineExtraWorkspaceThreshold(v uint64) TestDisttaeEngineOptions
- func WithDisttaeEngineInsertEntryMaxCount(v int) TestDisttaeEngineOptions
- func WithDisttaeEngineMPool(mp *mpool.MPool) TestDisttaeEngineOptions
- func WithDisttaeEngineQuota(v uint64) TestDisttaeEngineOptions
- func WithDisttaeEngineWriteWorkspaceThreshold(v uint64) TestDisttaeEngineOptions
- type TestLogtailServer
- type TestOptions
- type TestTxnStorage
- func (ts *TestTxnStorage) BindSchema(schema *catalog.Schema)
- func (ts *TestTxnStorage) Close(destroy bool) error
- func (ts *TestTxnStorage) Commit(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) CommitTNShard(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) Debug(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) GetDB() *db.DB
- func (ts *TestTxnStorage) GetDelegate() *dbutil.TestEngine
- func (ts *TestTxnStorage) GetRPCHandle() *rpc.Handle
- func (ts *TestTxnStorage) GetStatus(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) Prepare(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) Read(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) Rollback(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) RollbackTNShard(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
- func (ts *TestTxnStorage) Shard() metadata.TNShard
- func (ts *TestTxnStorage) Start() error
- func (ts *TestTxnStorage) StartTxn() (txnif.AsyncTxn, error)
- func (ts *TestTxnStorage) Write(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEngines ¶
func CreateEngines( ctx context.Context, opts TestOptions, t *testing.T, funcOpts ...TestDisttaeEngineOptions, ) ( disttaeEngine *TestDisttaeEngine, taeEngine *TestTxnStorage, rpcAgent *MockRPCAgent, mp *mpool.MPool, )
func EmptyBatchFromSchema ¶
func EndThisStatement ¶
func EndThisStatement( ctx context.Context, txn client.TxnOperator, ) (err error)
func EngineDefAddIndex ¶
func EngineTableDefBySchema ¶
func GetDefaultTNShard ¶
func GetRelationReader ¶
func GetTableTxnReader ¶
func InitTxnHandle ¶
func MakeTxnHeartbeatMonkeyJob ¶
func MakeTxnHeartbeatMonkeyJob( e *TestTxnStorage, opInterval time.Duration, ) *tasks.CancelableJob
func MockShardService ¶
func MockShardService() *mockShardService
func NewDefaultTableReader ¶
func PlanTableDefBySchema ¶
Types ¶
type EnginePack ¶
type EnginePack struct {
D *TestDisttaeEngine
T *TestTxnStorage
R *MockRPCAgent
Mp *mpool.MPool
Ctx context.Context
// contains filtered or unexported fields
}
func InitEnginePack ¶
func InitEnginePack(opts TestOptions, t *testing.T) *EnginePack
func (*EnginePack) Close ¶
func (p *EnginePack) Close()
func (*EnginePack) CreateDB ¶
func (p *EnginePack) CreateDB(txnop client.TxnOperator, dbname string) engine.Database
func (*EnginePack) CreateDBAndTable ¶
func (p *EnginePack) CreateDBAndTable(txnop client.TxnOperator, dbname string, schema *catalog.Schema) (engine.Database, engine.Relation)
func (*EnginePack) CreateDBAndTables ¶
func (p *EnginePack) CreateDBAndTables(txnop client.TxnOperator, dbname string, schema ...*catalog.Schema) (engine.Database, []engine.Relation)
func (*EnginePack) CreateTableInDB ¶
func (p *EnginePack) CreateTableInDB(txnop client.TxnOperator, dbname string, schema *catalog.Schema) engine.Relation
func (*EnginePack) DeleteTableInDB ¶
func (p *EnginePack) DeleteTableInDB(txnop client.TxnOperator, dbname, tblname string)
func (*EnginePack) StartCNTxn ¶
func (p *EnginePack) StartCNTxn(opts ...client.TxnOption) client.TxnOperator
type MockLogtailPRCServer ¶
type MockLogtailPRCServer struct {
// contains filtered or unexported fields
}
func (*MockLogtailPRCServer) Close ¶
func (s *MockLogtailPRCServer) Close() error
func (*MockLogtailPRCServer) RegisterRequestHandler ¶
func (s *MockLogtailPRCServer) RegisterRequestHandler( onMessage func(ctx context.Context, request morpc.RPCMessage, sequence uint64, cs morpc.ClientSession) error)
func (*MockLogtailPRCServer) Start ¶
func (s *MockLogtailPRCServer) Start() error
type MockLogtailRPCClient ¶
type MockLogtailRPCClient struct {
// contains filtered or unexported fields
}
func (*MockLogtailRPCClient) Close ¶
func (c *MockLogtailRPCClient) Close() error
func (*MockLogtailRPCClient) CloseBackend ¶
func (c *MockLogtailRPCClient) CloseBackend() error
type MockRPCAgent ¶
type MockRPCAgent struct {
// contains filtered or unexported fields
}
func NewMockLogtailAgent ¶
func NewMockLogtailAgent() *MockRPCAgent
func (*MockRPCAgent) Close ¶
func (a *MockRPCAgent) Close()
func (*MockRPCAgent) MockLogtailPRCServerFactory ¶
func (a *MockRPCAgent) MockLogtailPRCServerFactory( name string, address string, logtailServer *service.LogtailServer, options ...morpc.ServerOption) (morpc.RPCServer, error)
type MockRPCClientStream ¶
type MockRPCClientStream struct {
// contains filtered or unexported fields
}
func (*MockRPCClientStream) Close ¶
func (s *MockRPCClientStream) Close(closeConn bool) error
func (*MockRPCClientStream) ID ¶
func (s *MockRPCClientStream) ID() uint64
type PInmemRowsStats ¶
type PObjectStats ¶
type PartitionStateStats ¶
type PartitionStateStats struct {
DataObjectsVisible PObjectStats
DataObjectsInvisible PObjectStats
TombstoneObjectsVisible PObjectStats
TombstoneObjectsInvisible PObjectStats
InmemRows PInmemRowsStats
CheckpointCnt int
Details struct {
// 0: locations
// 1: versions
DeletedRows []*batch.Batch
CheckpointLocs [2][]string
DataObjectList struct {
Visible, Invisible []objectio.ObjectEntry
}
TombstoneObjectList struct {
Visible, Invisible []objectio.ObjectEntry
}
}
}
func (*PartitionStateStats) String ¶
func (s *PartitionStateStats) String() string
func (*PartitionStateStats) Summary ¶
func (s *PartitionStateStats) Summary() PartitionStateStats
type TestDisttaeEngine ¶
func NewTestDisttaeEngine ¶
func NewTestDisttaeEngine( ctx context.Context, fs fileservice.FileService, rpcAgent *MockRPCAgent, storage *TestTxnStorage, options ...TestDisttaeEngineOptions, ) (*TestDisttaeEngine, error)
func (*TestDisttaeEngine) Close ¶
func (de *TestDisttaeEngine) Close(ctx context.Context)
func (*TestDisttaeEngine) CreateDatabaseAndTable ¶
func (*TestDisttaeEngine) GetPartitionStateStats ¶
func (de *TestDisttaeEngine) GetPartitionStateStats( ctx context.Context, databaseId, tableId uint64, ) ( stats PartitionStateStats, err error)
func (*TestDisttaeEngine) GetTxnClient ¶
func (de *TestDisttaeEngine) GetTxnClient() client.TxnClient
func (*TestDisttaeEngine) GetTxnOperator ¶
func (de *TestDisttaeEngine) GetTxnOperator() client.TxnOperator
func (*TestDisttaeEngine) NewTxnOperator ¶
func (de *TestDisttaeEngine) NewTxnOperator( ctx context.Context, commitTS timestamp.Timestamp, opts ...client.TxnOption, ) (client.TxnOperator, error)
func (*TestDisttaeEngine) Now ¶
func (de *TestDisttaeEngine) Now() timestamp.Timestamp
func (*TestDisttaeEngine) SubscribeTable ¶
type TestDisttaeEngineOptions ¶
type TestDisttaeEngineOptions func(*TestDisttaeEngine)
func WithDisttaeEngineCommitWorkspaceThreshold ¶
func WithDisttaeEngineCommitWorkspaceThreshold(v uint64) TestDisttaeEngineOptions
func WithDisttaeEngineExtraWorkspaceThreshold ¶
func WithDisttaeEngineExtraWorkspaceThreshold(v uint64) TestDisttaeEngineOptions
func WithDisttaeEngineInsertEntryMaxCount ¶
func WithDisttaeEngineInsertEntryMaxCount(v int) TestDisttaeEngineOptions
func WithDisttaeEngineMPool ¶
func WithDisttaeEngineMPool(mp *mpool.MPool) TestDisttaeEngineOptions
func WithDisttaeEngineQuota ¶
func WithDisttaeEngineQuota(v uint64) TestDisttaeEngineOptions
func WithDisttaeEngineWriteWorkspaceThreshold ¶
func WithDisttaeEngineWriteWorkspaceThreshold(v uint64) TestDisttaeEngineOptions
type TestLogtailServer ¶
type TestLogtailServer struct {
*service.LogtailServer
}
func NewMockLogtailServer ¶
func NewMockLogtailServer( ctx context.Context, tae *db.DB, cfg *options.LogtailServerCfg, rt runtime.Runtime, rpcServerFactory func(string, string, *service.LogtailServer, ...morpc.ServerOption) (morpc.RPCServer, error)) (*TestLogtailServer, error)
type TestOptions ¶
type TestOptions struct {
TaeEngineOptions *options.Options
Timeout time.Duration
DisttaeOptions []TestDisttaeEngineOptions
}
type TestTxnStorage ¶
type TestTxnStorage struct {
// contains filtered or unexported fields
}
func NewTestTAEEngine ¶
func NewTestTAEEngine( ctx context.Context, taeDir string, t *testing.T, rpcAgent *MockRPCAgent, opts *options.Options) (*TestTxnStorage, error)
func (*TestTxnStorage) BindSchema ¶
func (ts *TestTxnStorage) BindSchema(schema *catalog.Schema)
func (*TestTxnStorage) Close ¶
func (ts *TestTxnStorage) Close(destroy bool) error
func (*TestTxnStorage) Commit ¶
func (ts *TestTxnStorage) Commit(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) CommitTNShard ¶
func (ts *TestTxnStorage) CommitTNShard(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) Debug ¶
func (ts *TestTxnStorage) Debug(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) GetDB ¶
func (ts *TestTxnStorage) GetDB() *db.DB
func (*TestTxnStorage) GetDelegate ¶
func (ts *TestTxnStorage) GetDelegate() *dbutil.TestEngine
func (*TestTxnStorage) GetRPCHandle ¶
func (ts *TestTxnStorage) GetRPCHandle() *rpc.Handle
func (*TestTxnStorage) GetStatus ¶
func (ts *TestTxnStorage) GetStatus(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) Prepare ¶
func (ts *TestTxnStorage) Prepare(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) Read ¶
func (ts *TestTxnStorage) Read(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) Rollback ¶
func (ts *TestTxnStorage) Rollback(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) RollbackTNShard ¶
func (ts *TestTxnStorage) RollbackTNShard(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
func (*TestTxnStorage) Shard ¶
func (ts *TestTxnStorage) Shard() metadata.TNShard
func (*TestTxnStorage) Start ¶
func (ts *TestTxnStorage) Start() error
func (*TestTxnStorage) Write ¶
func (ts *TestTxnStorage) Write(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) (err error)
Click to show internal directories.
Click to hide internal directories.