core

package
v0.0.0-...-75ad910 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

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

func LoadBucket

func LoadBucket(ctx context.Context, store kv.Store, name string) (*Bucket, error)

TODO: LUR

func NewBucket

func NewBucket(ctx context.Context, store kv.Store, opts *BucketOptions) (*Bucket, error)

func (*Bucket) ApplyTxn

func (b *Bucket) ApplyTxn(ctx context.Context, ops []*Operation) error

func (*Bucket) Delete

func (b *Bucket) Delete(ctx context.Context, key []byte) error

func (*Bucket) DoScript

func (b *Bucket) DoScript(
	ctx context.Context,
	w http.ResponseWriter,
	r *http.Request,
	name []byte,
) error

func (*Bucket) Get

func (b *Bucket) Get(ctx context.Context, key []byte) ([]byte, error)

func (*Bucket) Incr

func (b *Bucket) Incr(
	ctx context.Context,
	key []byte,
	increment int64,
	ttl time.Duration,
) (int64, error)

func (*Bucket) Name

func (b *Bucket) Name() string

func (*Bucket) Set

func (b *Bucket) Set(ctx context.Context, key, val []byte, ttl time.Duration) error

func (*Bucket) StoreScript

func (b *Bucket) StoreScript(ctx context.Context, name, content []byte) error

type BucketOptions

type BucketOptions struct {

	// Manage bucket policy and other keys.
	SecretKey string

	// Prevent public reads from the bucket.
	ReadKey string

	// Prevent public writes to the bucket.
	WriteKey string

	// Enable access token generation.
	SigningKey string

	// Keys not updated expire after this duration.
	DefaultTTL time.Duration
}

type OpDelete

type OpDelete struct {
	Key []byte
}

type OpSet

type OpSet struct {
	Key   []byte
	Value []byte
	TTL   time.Duration
}

type OpType

type OpType uint8
const (
	OpTypeSet OpType
	OpTypeDelete
)

type Operation

type Operation struct {
	Data any
	Type OpType
}

Jump to

Keyboard shortcuts

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