Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidSyncDescSchema = errors.New("invalid sync desc schema") ErrInvalidSyncDescTable = errors.New("invalid sync desc table") )
SyncDesc errors
var (
ErrRuleConflict = errors.New("Rule conflicts")
)
Sync errors
Functions ¶
This section is empty.
Types ¶
type DefaultSyncConfig ¶
type DefaultSyncConfig struct {
Databases map[string]*defaultDatabaseConfig `json:"databases"`
}
DefaultSyncConfig is a default sync config
func NewDefaultSyncConfig ¶
func NewDefaultSyncConfig() *DefaultSyncConfig
NewDefaultSyncConfig creates a new DefaultSyncConfig
func (*DefaultSyncConfig) ParseJSON ¶
func (c *DefaultSyncConfig) ParseJSON(data []byte) ([]*SyncDesc, error)
ParseJSON parses the json data to SyncDesc slice to create DefaultSyncRule
func (*DefaultSyncConfig) ToSyncDescs ¶
func (c *DefaultSyncConfig) ToSyncDescs() ([]*SyncDesc, error)
ToSyncDescs convert self to SyncDesc slice
type DefaultSyncRule ¶
type DefaultSyncRule struct {
// contains filtered or unexported fields
}
DefaultSyncRule implements the rule of sync
func NewDefaultSyncRule ¶
func NewDefaultSyncRule() *DefaultSyncRule
NewDefaultSyncRule creates a new NewDefaultSyncRule
func NewDefaultSyncRuleFromJSON ¶
func NewDefaultSyncRuleFromJSON(data []byte) (*DefaultSyncRule, error)
NewDefaultSyncRuleFromJSON creates a new DefaultSyncRule from json data
func NewDefaultSyncRuleWithRules ¶
func NewDefaultSyncRuleWithRules(rs []*SyncDesc) (*DefaultSyncRule, error)
NewDefaultSyncRuleWithRules creates a new DefaultSyncRule with rules
func (*DefaultSyncRule) CanSyncTable ¶
func (r *DefaultSyncRule) CanSyncTable(schema, table string) *SyncDesc
CanSyncTable implements ISyncRule CanSyncTable
func (*DefaultSyncRule) NewRule ¶
func (r *DefaultSyncRule) NewRule(desc *SyncDesc) error
NewRule implements ISyncRule NewRule
type ISyncRule ¶
type ISyncRule interface { // schema and table, returns rewrite schema and table name CanSyncTable(string, string) *SyncDesc // insert new schema rule NewRule(*SyncDesc) error }
ISyncRule defines a rule which database and table can be synchronized Sync rule must be thread safe, it will be used in binlog parse thread and user worker threads. So NewRule must not be invoked once the worker is running