backend

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 0 Imported by: 2

README

Backend

Backend is the Backend interface declaration for Monjura.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Transaction(func(Transaction) error) error
	ReadTransaction(func(Transaction) error) error
	Close() error
}

Backend represents a database

type Bucket

type Bucket interface {
	Transaction

	Get(key []byte) (value []byte)
	Put(key, value []byte) error
	Delete(key []byte) error
	Cursor() Cursor
	ForEach(func(key, value []byte) error) error
}

Bucket represents a bucket

type Cursor

type Cursor interface {
	Seek(seekTo []byte) (key, value []byte)
	First() (key, value []byte)
	Next() (key, value []byte)
	Prev() (key, value []byte)
	Last() (key, value []byte)
}

Cursor represents a cursor

type Initializer added in v0.1.1

type Initializer interface {
	New(filename string) (Backend, error)
}

Initializer represents a Backend initializer

type Transaction

type Transaction interface {
	GetBucket(key []byte) Bucket
	GetOrCreateBucket(key []byte) (Bucket, error)
	DeleteBucket(key []byte) error
}

Transaction represents a database transaction

Jump to

Keyboard shortcuts

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