tables

package
v0.0.0-...-104d43a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormat  = "2006-01-02 15:04:05"
	SetTable    = 0
	DeleteTable = 1
)
View Source
const BadCommand = "Incorrect command format"
View Source
const (
	MinTimeFormat = "20060102150405"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

type Table struct {
	TableInfo
	// contains filtered or unexported fields
}

func LoadTable

func LoadTable(p string, info TableInfo) (t *Table, err error)

load a new TableKV

func (*Table) BatchDelete

func (t *Table) BatchDelete(keys [][]byte) error

batch delete key

func (*Table) BatchSet

func (t *Table) BatchSet(keys [][]byte, values [][]byte) error

batch set key and value

func (*Table) Close

func (t *Table) Close() error

close TableKV

func (*Table) Delete

func (t *Table) Delete(key []byte) error

delete key and value

func (*Table) Exists

func (t *Table) Exists(key []byte) (bool, error)

check key exists or not

func (*Table) Get

func (t *Table) Get(key []byte) ([]byte, error)

get value from key

func (*Table) Info

func (t *Table) Info() map[string]string

get table info leveldb.num-files-at-level{n} Returns the number of files at level 'n'. leveldb.stats Returns statistics of the underlying DB. leveldb.iostats Returns statistics of effective disk read and write. leveldb.writedelay Returns cumulative write delay caused by compaction. leveldb.sstables Returns sstables list for each level. leveldb.blockpool Returns block pool stats. leveldb.cachedblock Returns size of cached block. leveldb.openedtables Returns number of opened tables. leveldb.alivesnaps Returns number of alive snapshots. leveldb.aliveiters Returns number of alive iterators.

func (*Table) Scan

func (t *Table) Scan(start, end []byte, limit int) (key [][]byte, value [][]byte, err error)

scan keys from start to end

func (*Table) Set

func (t *Table) Set(key, value []byte) error

set key and value

type TableInfo

type TableInfo struct {
	Name       string
	CreateTime time.Time
	Host       string
	// contains filtered or unexported fields
}

func (*TableInfo) FromByte

func (t *TableInfo) FromByte(bs []byte) error

func (*TableInfo) GetQueueId

func (t *TableInfo) GetQueueId() uint32

func (*TableInfo) ToByte

func (t *TableInfo) ToByte() []byte

type TableManager

type TableManager struct {
	TableEvent func(info *TableInfo, eventType byte)
	// contains filtered or unexported fields
}

func NewTableManager

func NewTableManager(cfg *common.Config, tables []*TableInfo) (t *TableManager)

create new table manager

func (*TableManager) Close

func (t *TableManager) Close() (err error)

close all table

func (*TableManager) DeleteTable

func (t *TableManager) DeleteTable(name string) (err error)

delete a table

func (*TableManager) GetTable

func (t *TableManager) GetTable(name string) (table *Table, err error)

get a table

type TableServer

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

func (*TableServer) Start

func (t *TableServer) Start(host string, port int) error

Jump to

Keyboard shortcuts

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