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) 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, meta *RoutingMetadataContext) 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 string, 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) Initialize() bool
- func (qr *ProxyQrouter) Initialized() bool
- func (qr *ProxyQrouter) Mgr() meta.EntityMgr
- func (qr *ProxyQrouter) RecordDistributionKeyColumnValue(meta *RoutingMetadataContext, alias, colname, value string) error
- func (qr *ProxyQrouter) RecordDistributionKeyColumnValueOnRFQN(meta *RoutingMetadataContext, resolvedRelation RelationFQN, ...) error
- func (qr *ProxyQrouter) RecordDistributionKeyExprOnRFQN(meta *RoutingMetadataContext, resolvedRelation RelationFQN, colname string, ...) error
- func (qr *ProxyQrouter) Route(ctx context.Context, stmt lyx.Node, sph session.SessionParamsHolder) (routingstate.RoutingState, error)
- func (qr *ProxyQrouter) WorldShardsRoutes() []*routingstate.DataShardRoute
- type QueryRouter
- type RelationFQN
- type RelationList
- type RoutingMetadataContext
- type SpecificRelation
- type StatementRelation
Constants ¶
This section is empty.
Variables ¶
View Source
var ComplexQuery = fmt.Errorf("too complex query to parse")
View Source
var CrossShardQueryUnsupported = fmt.Errorf("cross shard query unsupported")
View Source
var ErrRuleIntersect = fmt.Errorf("sharding rule intersects with existing one")
View Source
var FailedToFindKeyRange = fmt.Errorf("failed to match key with ranges")
View Source
var FailedToMatch = fmt.Errorf("failed to match query to any sharding rule")
View Source
var InformationSchemaCombinedQuery = fmt.Errorf("combined information schema and regular relation is not supported")
View Source
var MatchShardError = fmt.Errorf("failed to match datashard")
View Source
var ParseError = fmt.Errorf("parsing stmt error")
View Source
var ShardingKeysMissing = fmt.Errorf("sharding keys are missing in query")
View Source
var SkipColumn = fmt.Errorf("skip column for routing")
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) 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, meta *RoutingMetadataContext) 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 string, 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) 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) RecordDistributionKeyColumnValue ¶
func (qr *ProxyQrouter) RecordDistributionKeyColumnValue(meta *RoutingMetadataContext, alias, colname, value string) error
func (*ProxyQrouter) RecordDistributionKeyColumnValueOnRFQN ¶
func (qr *ProxyQrouter) RecordDistributionKeyColumnValueOnRFQN(meta *RoutingMetadataContext, resolvedRelation RelationFQN, colname, value string) error
func (*ProxyQrouter) RecordDistributionKeyExprOnRFQN ¶
func (qr *ProxyQrouter) RecordDistributionKeyExprOnRFQN(meta *RoutingMetadataContext, resolvedRelation RelationFQN, colname string, expr lyx.Node) error
TODO : unit tests
func (*ProxyQrouter) Route ¶
func (qr *ProxyQrouter) Route(ctx context.Context, stmt lyx.Node, sph session.SessionParamsHolder) (routingstate.RoutingState, error)
TODO : unit tests
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 string, krs []*kr.KeyRange) (*routingstate.DataShardRoute, error) Initialized() bool Initialize() bool Mgr() meta.EntityMgr }
func NewQrouter ¶
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(params [][]byte, paramsFormatCodes []int16) *RoutingMetadataContext
func (*RoutingMetadataContext) RFQNIsCTE ¶
func (meta *RoutingMetadataContext) RFQNIsCTE(resolvedRelation RelationFQN) bool
func (*RoutingMetadataContext) RecordConstExpr ¶
func (meta *RoutingMetadataContext) RecordConstExpr(resolvedRelation RelationFQN, colname string, expr string) error
TODO : unit tests
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.