Documentation ¶
Index ¶
- Variables
- func ReportStmtDeparsedAttrs(ctx context.Context, pi *clientinteractor.PSQLInteractor, ...) error
- type AnyRelation
- type LocalQrouter
- func (l *LocalQrouter) AddDataShard(_ context.Context, ds *datashards.DataShard) error
- func (l *LocalQrouter) DataShardsRoutes() []*routingstate.DataShardRoute
- func (l *LocalQrouter) Initialize() bool
- func (l *LocalQrouter) Initialized() bool
- func (l *LocalQrouter) ListKeyRanges(ctx context.Context) ([]*kr.KeyRange, error)
- func (l *LocalQrouter) Route(_ context.Context, _ lyx.Node, _ session.SessionParamsHolder) (routingstate.RoutingState, error)
- type ProxyQrouter
- func (qr *ProxyQrouter) CheckTableIsRoutable(ctx context.Context, node *lyx.CreateTable) error
- func (qr *ProxyQrouter) DataShardsRoutes() []*routingstate.DataShardRoute
- func (qr *ProxyQrouter) DeparseExprShardingEntries(expr lyx.Node, meta *RoutingMetadataContext) (string, string, error)
- func (qr *ProxyQrouter) DeparseKeyWithRangesInternal(_ context.Context, key []interface{}, krs []*kr.KeyRange) (*routingstate.DataShardRoute, error)
- func (qr *ProxyQrouter) DeparseSelectStmt(ctx context.Context, selectStmt lyx.Node, meta *RoutingMetadataContext) error
- func (qr *ProxyQrouter) Explain(ctx context.Context, stmt *lyx.Explain, cli *clientinteractor.PSQLInteractor) error
- func (qr *ProxyQrouter) GetDistributionKeyOffsetType(meta *RoutingMetadataContext, resolvedRelation RelationFQN, colname string) (int, string)
- func (qr *ProxyQrouter) Initialize() bool
- func (qr *ProxyQrouter) Initialized() bool
- func (qr *ProxyQrouter) Mgr() meta.EntityMgr
- func (qr *ProxyQrouter) Route(ctx context.Context, stmt lyx.Node, sph session.SessionParamsHolder) (routingstate.RoutingState, error)
- func (qr *ProxyQrouter) SchemaCache() *cache.SchemaCache
- func (qr *ProxyQrouter) WorldShardsRoutes() []*routingstate.DataShardRoute
- type QueryRouter
- type RelationFQN
- type RelationList
- type RoutingMetadataContext
- func (meta *RoutingMetadataContext) GetRelationDistribution(ctx context.Context, mgr meta.EntityMgr, resolvedRelation RelationFQN) (*distributions.Distribution, error)
- func (meta *RoutingMetadataContext) RFQNIsCTE(resolvedRelation RelationFQN) bool
- func (meta *RoutingMetadataContext) RecordConstExpr(resolvedRelation RelationFQN, colname string, expr interface{}) error
- func (meta *RoutingMetadataContext) RecordParamRefExpr(resolvedRelation RelationFQN, colname string, ind int) error
- func (meta *RoutingMetadataContext) ResolveRelationByAlias(alias string) (RelationFQN, error)
- type SpecificRelation
- type StatementRelation
Constants ¶
This section is empty.
Variables ¶
View Source
var CatalogDistribution = distributions.Distribution{ Relations: nil, Id: distributions.REPLICATED, ColTypes: nil, }
View Source
var ErrComplexQuery = fmt.Errorf("too complex query to route")
View Source
var ErrInformationSchemaCombinedQuery = fmt.Errorf("combined information schema and regular relation is not supported")
View Source
var MatchShardError = fmt.Errorf("failed to match datashard")
Functions ¶
func ReportStmtDeparsedAttrs ¶
func ReportStmtDeparsedAttrs(ctx context.Context, pi *clientinteractor.PSQLInteractor, meta *RoutingMetadataContext) error
TODO : unit tests
Types ¶
type AnyRelation ¶
type AnyRelation struct{}
type LocalQrouter ¶
type LocalQrouter struct { QueryRouter // contains filtered or unexported fields }
func NewLocalQrouter ¶
func NewLocalQrouter(shardMapping map[string]*config.Shard) (*LocalQrouter, error)
func (*LocalQrouter) AddDataShard ¶
func (l *LocalQrouter) AddDataShard(_ context.Context, ds *datashards.DataShard) error
TODO : unit tests
func (*LocalQrouter) DataShardsRoutes ¶
func (l *LocalQrouter) DataShardsRoutes() []*routingstate.DataShardRoute
TODO : unit tests
func (*LocalQrouter) Initialize ¶
func (l *LocalQrouter) Initialize() bool
func (*LocalQrouter) Initialized ¶
func (l *LocalQrouter) Initialized() bool
func (*LocalQrouter) ListKeyRanges ¶
func (*LocalQrouter) Route ¶
func (l *LocalQrouter) Route(_ context.Context, _ lyx.Node, _ session.SessionParamsHolder) (routingstate.RoutingState, error)
TODO : unit tests
type ProxyQrouter ¶
type ProxyQrouter struct { ColumnMapping map[string]struct{} LocalTables map[string]struct{} // shards DataShardCfgs map[string]*config.Shard WorldShardCfgs map[string]*config.Shard // contains filtered or unexported fields }
func NewProxyRouter ¶
func (*ProxyQrouter) CheckTableIsRoutable ¶
func (qr *ProxyQrouter) CheckTableIsRoutable(ctx context.Context, node *lyx.CreateTable) error
CheckTableIsRoutable Given table create statement, check if it is routable with some sharding rule TODO : unit tests
func (*ProxyQrouter) DataShardsRoutes ¶
func (qr *ProxyQrouter) DataShardsRoutes() []*routingstate.DataShardRoute
TODO : unit tests
func (*ProxyQrouter) DeparseExprShardingEntries ¶
func (qr *ProxyQrouter) DeparseExprShardingEntries(expr lyx.Node, meta *RoutingMetadataContext) (string, string, error)
DeparseExprShardingEntries deparses sharding column entries(column names or aliased column names) e.g {fields:{string:{str:"a"}} fields:{string:{str:"i"}} for `WHERE a.i = 1` returns alias and column name
func (*ProxyQrouter) DeparseKeyWithRangesInternal ¶
func (qr *ProxyQrouter) DeparseKeyWithRangesInternal(_ context.Context, key []interface{}, krs []*kr.KeyRange) (*routingstate.DataShardRoute, error)
TODO : unit tests
func (*ProxyQrouter) DeparseSelectStmt ¶
func (qr *ProxyQrouter) DeparseSelectStmt(ctx context.Context, selectStmt lyx.Node, meta *RoutingMetadataContext) error
TODO : unit tests
func (*ProxyQrouter) Explain ¶
func (qr *ProxyQrouter) Explain(ctx context.Context, stmt *lyx.Explain, cli *clientinteractor.PSQLInteractor) error
TODO : unit tests
func (*ProxyQrouter) GetDistributionKeyOffsetType ¶
func (qr *ProxyQrouter) GetDistributionKeyOffsetType(meta *RoutingMetadataContext, resolvedRelation RelationFQN, colname string) (int, string)
func (*ProxyQrouter) Initialize ¶
func (qr *ProxyQrouter) Initialize() bool
func (*ProxyQrouter) Initialized ¶
func (qr *ProxyQrouter) Initialized() bool
func (*ProxyQrouter) Mgr ¶
func (qr *ProxyQrouter) Mgr() meta.EntityMgr
func (*ProxyQrouter) Route ¶
func (qr *ProxyQrouter) Route(ctx context.Context, stmt lyx.Node, sph session.SessionParamsHolder) (routingstate.RoutingState, error)
TODO : unit tests
func (*ProxyQrouter) SchemaCache ¶
func (qr *ProxyQrouter) SchemaCache() *cache.SchemaCache
func (*ProxyQrouter) WorldShardsRoutes ¶
func (qr *ProxyQrouter) WorldShardsRoutes() []*routingstate.DataShardRoute
TODO : unit tests
type QueryRouter ¶
type QueryRouter interface { Route(ctx context.Context, stmt lyx.Node, sph session.SessionParamsHolder) (routingstate.RoutingState, error) WorldShardsRoutes() []*routingstate.DataShardRoute DataShardsRoutes() []*routingstate.DataShardRoute DeparseKeyWithRangesInternal(ctx context.Context, key []interface{}, krs []*kr.KeyRange) (*routingstate.DataShardRoute, error) Initialized() bool Initialize() bool Mgr() meta.EntityMgr SchemaCache() *cache.SchemaCache }
func NewQrouter ¶
func NewQrouter(qtype config.RouterMode, shardMapping map[string]*config.Shard, mgr meta.EntityMgr, qcfg *config.QRouter, cache *cache.SchemaCache) (QueryRouter, error)
type RelationFQN ¶
func RelationFQNFromRangeRangeVar ¶
func RelationFQNFromRangeRangeVar(rv *lyx.RangeVar) RelationFQN
type RelationList ¶
type RelationList struct {
Relations []string
}
type RoutingMetadataContext ¶
type RoutingMetadataContext struct {
// contains filtered or unexported fields
}
func NewRoutingMetadataContext ¶
func NewRoutingMetadataContext() *RoutingMetadataContext
func (*RoutingMetadataContext) GetRelationDistribution ¶
func (meta *RoutingMetadataContext) GetRelationDistribution(ctx context.Context, mgr meta.EntityMgr, resolvedRelation RelationFQN) (*distributions.Distribution, error)
func (*RoutingMetadataContext) RFQNIsCTE ¶
func (meta *RoutingMetadataContext) RFQNIsCTE(resolvedRelation RelationFQN) bool
func (*RoutingMetadataContext) RecordConstExpr ¶
func (meta *RoutingMetadataContext) RecordConstExpr(resolvedRelation RelationFQN, colname string, expr interface{}) error
TODO : unit tests
func (*RoutingMetadataContext) RecordParamRefExpr ¶
func (meta *RoutingMetadataContext) RecordParamRefExpr(resolvedRelation RelationFQN, colname string, ind int) error
func (*RoutingMetadataContext) ResolveRelationByAlias ¶
func (meta *RoutingMetadataContext) ResolveRelationByAlias(alias string) (RelationFQN, error)
TODO : unit tests
type SpecificRelation ¶
type SpecificRelation struct {
Name string
}
type StatementRelation ¶
type StatementRelation interface {
// contains filtered or unexported methods
}
Click to show internal directories.
Click to hide internal directories.