namespace

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2018 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
}

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