rdb

package module
v0.0.0-...-6342ee2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: MIT Imports: 2 Imported by: 0

README

go-rdb

尝试用Go写个类似redis server的KV内存数据库,空余时间学习写着玩...

实现

  • 使用ART做内存索引
  • 实现数据结构
    • string
    • list
    • sortset
    • set
    • hash

Documentation

Index

Constants

View Source
const (
	Node4 = iota
	Node16
	Node48
	Node256
	Leaf

	Node4Min = 2
	Node4Max = 4

	Node16Min = Node4Max + 1
	Node16Max = 16

	Node48Min = Node16Max + 1
	Node48Max = 48

	Node256Min = Node48Max + 1
	Node256Max = 256

	MaxPrefixLen = 8
)

Variables

This section is empty.

Functions

func Get

func Get(key string) (interface{}, error)

func GetString

func GetString(key string) (string, error)

func Set

func Set(key string, value interface{}) bool

func SetString

func SetString(key string, value string) bool

Types

type ArtNode

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

func (*ArtNode) IsLeaf

func (n *ArtNode) IsLeaf() bool

func (*ArtNode) Minimum

func (n *ArtNode) Minimum() *ArtNode

type ArtTree

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

func NewTree

func NewTree() *ArtTree

func (*ArtTree) Delete

func (t *ArtTree) Delete(key []byte) bool

func (*ArtTree) Insert

func (t *ArtTree) Insert(key []byte, value interface{}) bool

func (*ArtTree) Search

func (t *ArtTree) Search(key []byte) interface{}

type InnerNode

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

func (*InnerNode) IsFull

func (n *InnerNode) IsFull() bool

type LeafNode

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

func (*LeafNode) IsMatch

func (l *LeafNode) IsMatch(key []byte) bool

type RDB

type RDB struct {
	*ArtTree
	sync.RWMutex
}

func NewRDB

func NewRDB() *RDB

Jump to

Keyboard shortcuts

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