filter

package
v7.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

Filter

filter provides a library to filter replicate on schema/table by given rules

Rules

rules like replication rules in MySQL, ref document: hhttps://dev.mysql.com/doc/refman/8.0/en/replication-rules-db-options.html https://dev.mysql.com/doc/refman/8.0/en/replication-rules-table-options.html

Priority and Key Points
  • DoDBs > IgnoreDBs
    • which rules to use?
      • If there are some DoDB rules, only use DoDB Rules
      • Otherwise if there are some IgnoreDB rules, use IgnoreDB rules
      • tables that are not filtered out or there are empty DoDBs/IgnoreDBs rules would go to filter on DoTables/IgnoreTables rules
  • DoTables > IgnoreTables
    • if there are DoTable Rules, but no one is matched, we would ignore corresponding table

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DMHeartbeatSchema is the heartbeat schema name
	DMHeartbeatSchema = "DM_HEARTBEAT"
	// DMHeartbeatTable is heartbeat table name
	DMHeartbeatTable = "HEARTBEAT"
	// InformationSchemaName is the `INFORMATION_SCHEMA` database name.
	InformationSchemaName = "INFORMATION_SCHEMA"
	// PerformanceSchemaName is the `PERFORMANCE_SCHEMA` database name.
	PerformanceSchemaName = "PERFORMANCE_SCHEMA"
	// MetricSchemaName is the `METRICS_SCHEMA` database name.
	MetricSchemaName = "METRICS_SCHEMA"
	// InspectionSchemaName is the `INSPECTION_SCHEMA` database name
	InspectionSchemaName = "INSPECTION_SCHEMA"
)

Functions

func IsSystemSchema

func IsSystemSchema(schema string) bool

IsSystemSchema checks whether schema is system schema or not. case insensitive

Types

type ActionType

type ActionType bool

ActionType is do or ignore something

const (
	Do     ActionType = true
	Ignore ActionType = false
)

builtin actiontype variable

type Filter

type Filter struct {
	selector.Selector
	// contains filtered or unexported fields
}

Filter implements table filter in the style of MySQL replication rules.

func New

func New(caseSensitive bool, rules *Rules) (*Filter, error)

New creates a filter use the rules.

func (*Filter) ApplyOn

func (f *Filter) ApplyOn(stbs []*Table) []*Table

ApplyOn applies filter rules on tables and convert schema/table name to lower case if not caseSensitive rules like https://dev.mysql.com/doc/refman/8.0/en/replication-rules-table-options.html https://dev.mysql.com/doc/refman/8.0/en/replication-rules-db-options.html Deprecated

func (*Filter) Match

func (f *Filter) Match(tb *Table) bool

Match returns true if the specified table should not be removed.

type Rules

Rules contains Filter rules.

type Table

type Table = tfilter.Table

Table represents a table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL