db

package
v0.0.0-...-3d70050 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEY_HEADER    = "Key"
	LENGTH_HEADER = "Length"
)

Variables

View Source
var ErrServerClosed = errors.New("simple-db: Server closed")
View Source
var (
	ErrTimeout = fmt.Errorf("request timed out")
)

Functions

This section is empty.

Types

type Operation

type Operation string
const (
	PUT    Operation = "PUT"
	GET    Operation = "GET"
	DELETE Operation = "DELETE"
)

func (Operation) IsValid

func (op Operation) IsValid() bool

type Options

type Options struct {
	Logger       *slog.Logger
	LogLevel     slog.Level
	MemTableType memtable.Type
}

type SimpleDb

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

func NewSimpleDb

func NewSimpleDb(address string) (*SimpleDb, error)

func NewSimpleWithOptions

func NewSimpleWithOptions(address string, options Options) (*SimpleDb, error)

func (*SimpleDb) Delete

func (sdb *SimpleDb) Delete(key string) error

func (*SimpleDb) Get

func (sdb *SimpleDb) Get(key string) (string, bool)

func (*SimpleDb) Put

func (sdb *SimpleDb) Put(key, value string) error

func (*SimpleDb) Shutdown

func (sdb *SimpleDb) Shutdown(ctx context.Context) error

func (*SimpleDb) Start

func (sdb *SimpleDb) Start() error

func (*SimpleDb) Stop

func (sdb *SimpleDb) Stop() error

type SimpleDbClient

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

func NewSimpleDbClient

func NewSimpleDbClient(address string) (*SimpleDbClient, error)

func (*SimpleDbClient) Close

func (client *SimpleDbClient) Close() error

func (*SimpleDbClient) Delete

func (client *SimpleDbClient) Delete(ctx context.Context, key string) (string, error)

func (*SimpleDbClient) Get

func (client *SimpleDbClient) Get(ctx context.Context, key string) (string, error)

func (*SimpleDbClient) Put

func (client *SimpleDbClient) Put(ctx context.Context, key, value string) (string, error)

func (*SimpleDbClient) Reconnect

func (client *SimpleDbClient) Reconnect() error

Jump to

Keyboard shortcuts

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