table

package
v2.1.0-rc.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeInt

func DecodeInt(b []byte) ([]byte, int64, error)

DecodeInt decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.

func NewTableNamespaceClassifier

func NewTableNamespaceClassifier(kv *core.KV, idAlloc core.IDAllocator) (namespace.Classifier, error)

NewTableNamespaceClassifier creates a new namespace classifier that classifies stores and regions by table range.

Types

type Key

type Key []byte

Key represents high-level Key type.

func (Key) IsMeta

func (k Key) IsMeta() bool

IsMeta returns if the key is a meta key.

func (Key) TableID

func (k Key) TableID() int64

TableID returns the table ID of the key, if the key is not table key, returns 0.

type Namespace

type Namespace struct {
	ID       uint64          `json:"ID"`
	Name     string          `json:"Name"`
	TableIDs map[int64]bool  `json:"table_ids,omitempty"`
	StoreIDs map[uint64]bool `json:"store_ids,omitempty"`
	Meta     bool            `json:"meta,omitempty"`
}

Namespace defines two things: 1. relation between a Name and several tables 2. relation between a Name and several stores It is used to bind tables with stores

func NewNamespace

func NewNamespace(id uint64, name string) *Namespace

NewNamespace creates a new namespace

func (*Namespace) AddStoreID

func (ns *Namespace) AddStoreID(storeID uint64)

AddStoreID adds a storeID to this namespace

func (*Namespace) AddTableID

func (ns *Namespace) AddTableID(tableID int64)

AddTableID adds a tableID to this namespace

func (*Namespace) GetID

func (ns *Namespace) GetID() uint64

GetID returns namespace's ID or 0

func (*Namespace) GetName

func (ns *Namespace) GetName() string

GetName returns namespace's Name or default 'global' value

Jump to

Keyboard shortcuts

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