namespace

package
v2.1.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultNamespace = "global"

DefaultNamespace is the namespace all the store and region belong to by default.

Variables

View Source
var DefaultClassifier = defaultClassifier{}

DefaultClassifier is a classifier that classifies all regions and stores to DefaultNamespace.

Functions

func RegisterClassifier

func RegisterClassifier(name string, createFn CreateClassifierFunc)

RegisterClassifier binds a classifier creator. It should be called in init() func of a package.

Types

type Classifier

type Classifier interface {
	GetAllNamespaces() []string
	GetStoreNamespace(*core.StoreInfo) string
	GetRegionNamespace(*core.RegionInfo) string
	IsNamespaceExist(name string) bool
	AllowMerge(*core.RegionInfo, *core.RegionInfo) bool
	// Reload underlying namespaces
	ReloadNamespaces() error
}

Classifier is used to determine the namespace which the store or region belongs.

func CreateClassifier

func CreateClassifier(name string, kv *core.KV, idAlloc core.IDAllocator) (Classifier, error)

CreateClassifier creates a namespace classifier with registered creator func.

type CreateClassifierFunc

type CreateClassifierFunc func(*core.KV, core.IDAllocator) (Classifier, error)

CreateClassifierFunc is for creating namespace classifier.

Jump to

Keyboard shortcuts

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