filter

package
v2.0.0-...-acbaf60 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// refer to mongo/bson/bsontypes.h of mongodb kernel 4.0
	BsonInvalid    = -1
	BsonMinKey     = 0
	BsonTypeNumber = 10
	BsonTypeString = 15
	BsonTypeOid    = 35
	BsonMaxKey     = 100
)

Variables

View Source
var NsShouldBeIgnore = map[string]bool{
	"admin.":                        true,
	"local.":                        true,
	"config.":                       true,
	utils.AppDatabase + ".":         true,
	utils.APPConflictDatabase + ".": true,
	"system.views":                  false,
}

namespace should be filtered. key: ns, value: true means prefix, false means contain

View Source
var NsShouldNotBeIgnore = map[string]bool{
	"admin.$cmd": true,
}

namespace should not be filtered. NsShouldNotBeIgnore has a higher priority than NsShouldBeIgnore key: ns, value: true means prefix, false means contain

Functions

func ComputeHash

func ComputeHash(data interface{}) int64

func InitNs

func InitNs(specialNsList []string)

Types

type AutologousFilter

type AutologousFilter struct {
}

func (*AutologousFilter) Filter

func (filter *AutologousFilter) Filter(log *oplog.PartialLog) bool

func (*AutologousFilter) FilterNs

func (filter *AutologousFilter) FilterNs(namespace string) bool

type DDLFilter

type DDLFilter struct {
}

func (*DDLFilter) Filter

func (filter *DDLFilter) Filter(log *oplog.PartialLog) bool

type DocFilter

type DocFilter interface {
	FilterNs(namespace string) bool
}

DocFilter: AutologousFilter, NamespaceFilter

type DocFilterChain

type DocFilterChain []DocFilter

func NewDocFilterList

func NewDocFilterList() DocFilterChain

func (DocFilterChain) IterateFilter

func (chain DocFilterChain) IterateFilter(namespace string) bool

type GidFilter

type GidFilter struct {
	// contains filtered or unexported fields
}

func NewGidFilter

func NewGidFilter(gids []string) *GidFilter

func (*GidFilter) Filter

func (filter *GidFilter) Filter(log *oplog.PartialLog) bool

type MigrateFilter

type MigrateFilter struct {
}

func (*MigrateFilter) Filter

func (filter *MigrateFilter) Filter(log *oplog.PartialLog) bool

type NamespaceFilter

type NamespaceFilter struct {
	// contains filtered or unexported fields
}

because regexp use the default perl engine which is not support inverse match, so use two rules to match

func NewNamespaceFilter

func NewNamespaceFilter(white, black []string) *NamespaceFilter

func (*NamespaceFilter) Filter

func (filter *NamespaceFilter) Filter(log *oplog.PartialLog) bool

func (*NamespaceFilter) FilterNs

func (filter *NamespaceFilter) FilterNs(namespace string) bool

type NoopFilter

type NoopFilter struct {
}

func (*NoopFilter) Filter

func (filter *NoopFilter) Filter(log *oplog.PartialLog) bool

type OplogFilter

type OplogFilter interface {
	Filter(log *oplog.PartialLog) bool
}

OplogFilter: AutologousFilter, NamespaceFilter, GidFilter, NoopFilter, DDLFilter

type OplogFilterChain

type OplogFilterChain []OplogFilter

func (OplogFilterChain) IterateFilter

func (chain OplogFilterChain) IterateFilter(log *oplog.PartialLog) bool

type OrphanFilter

type OrphanFilter struct {
	// contains filtered or unexported fields
}

func NewOrphanFilter

func NewOrphanFilter(replset string, chunkMap sharding.DBChunkMap) *OrphanFilter

func (*OrphanFilter) Filter

func (filter *OrphanFilter) Filter(docD bson.D, namespace string) bool

Jump to

Keyboard shortcuts

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