shmkv

package module
v0.0.0-...-235c15c Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 11 Imported by: 0

README

shmkv

share memory key-value database

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseXML

func ParseXML(fileName string, v interface{}) error

ParseXML - parse xml after read it

func ReadXML

func ReadXML(fileName string) ([]byte, error)

ReadXML - read xml & xml with BOM

Types

type BucketStat

type BucketStat struct {
	Bytes uint32
	Frees uint32
	Count uint32
}

BucketStat - bucket statistic of pool

type DB

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

DB - database based on shm segment

func NewDB

func NewDB() *DB

NewDB - new a database

func (*DB) Dump

func (db *DB) Dump() string

Dump - dump the DB info

func (*DB) Exists

func (db *DB) Exists(k string) bool

Exists - tell whether the key exist or not

func (*DB) Fini

func (db *DB) Fini()

Fini - free the database

func (*DB) Flushall

func (db *DB) Flushall()

Flushall - delete all keys

func (*DB) Get

func (db *DB) Get(k string) (string, error)

Get - get the value for key

func (*DB) GetSegment

func (db *DB) GetSegment() *sc.Segment

GetSegment - get the segment

func (*DB) Init

func (db *DB) Init(key uint32, opt *sc.SegmentOption) error

Init - init database with option

func (*DB) Resume

func (db *DB) Resume(key uint32) error

Resume - resume database from shm

func (*DB) Set

func (db *DB) Set(k, v string) error

Set - set the value for key

func (*DB) SetWithSlice

func (db *DB) SetWithSlice(x []byte) error

SetWithSlice - set the value for key with slice

func (*DB) SetWithTms

func (db *DB) SetWithTms(k, v string, tms uint64) error

SetWithTms - set the value for key with timestamp

func (*DB) Stat

func (db *DB) Stat() []BucketStat

Stat - key size free & cap

func (*DB) Used

func (db *DB) Used() uint32

Used - key size used

func (*DB) Visit

func (db *DB) Visit(cb func(string, uint16, uint32, *sc.BucketUnit) bool)

Visit - visit all keys

type DBBucketCfg

type DBBucketCfg struct {
	Bytes uint32 `xml:"bytes,attr"`
	Count uint32 `xml:"count,attr"`
}

DBBucketCfg - Bucket config in DB

type DBCfg

type DBCfg struct {
	Buckets []DBBucketCfg `xml:"bucket"`
}

DBCfg - DB config

Jump to

Keyboard shortcuts

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