rbolt

package
v0.0.0-...-35f693f Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const Version = 20230609

Variables

View Source
var (
	RespOK              = gserv.NewMsgpResponse(nil).Cached()
	RespNotFound        = gserv.NewError(http.StatusNotFound, "Not Found")
	RespAlreadyUnlocked = gserv.NewError(http.StatusLocked, "Already Unlocked")
)

Functions

func ForEach

func ForEach[T any](ctx context.Context, c *Client, db, bucket string, fn func(key string, v T) error) error

func ForEachTx

func ForEachTx[T any](tx *Tx, bucket string, fn func(key string, v T) error) error

func Get

func Get[T any](ctx context.Context, c *Client, db, bucket, key string) (v T, err error)

Types

type Client

type Client struct {
	RetryCount int
	RetrySleep time.Duration
	AuthKey    string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(addr, auth string) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, db, bucket, key string) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, db, bucket, key string, v any) (err error)

func (*Client) NextIndex

func (c *Client) NextIndex(ctx context.Context, db, bucket string) (id uint64, err error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, db, bucket, key string, v any) error

func (*Client) SetNextIndex

func (c *Client) SetNextIndex(ctx context.Context, db, bucket string, id uint64) (err error)

func (*Client) Update

func (c *Client) Update(ctx context.Context, db string, fn func(tx *Tx) error) error

type Server

type Server struct {
	MaxUnusedLock time.Duration
	AuthKey       string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(dbPath string, dbOpts *mbbolt.Options) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run(ctx context.Context, addr string) error

type Tx

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

func (*Tx) Delete

func (tx *Tx) Delete(bucket, key string) (err error)

func (*Tx) Get

func (tx *Tx) Get(bucket, key string, v any) (err error)

func (*Tx) NextIndex

func (tx *Tx) NextIndex(bucket string) (id uint64, err error)

func (*Tx) Put

func (tx *Tx) Put(bucket, key string, v any) (err error)

func (*Tx) SetNextIndex

func (tx *Tx) SetNextIndex(bucket string, id uint64) (err error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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