possum

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MPL-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandleClosed = errors.New("possum Handle closed")

Functions

This section is empty.

Types

type FileInfo

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

func (FileInfo) IsDir

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (f FileInfo) Mode() fs.FileMode

func (FileInfo) Name

func (f FileInfo) Name() string

func (FileInfo) Size

func (f FileInfo) Size() int64

func (FileInfo) Sys

func (f FileInfo) Sys() any

type Handle

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

func Open

func Open(dir string) (handle *Handle, err error)

func (*Handle) CleanupSnapshots

func (me *Handle) CleanupSnapshots() error

func (*Handle) Close

func (me *Handle) Close() error

func (*Handle) DeletePrefix added in v0.2.0

func (me *Handle) DeletePrefix(prefix []byte) error

func (*Handle) ListKeys

func (me *Handle) ListKeys(prefix string) (keys []string, err error)

func (*Handle) MovePrefix added in v0.2.0

func (me *Handle) MovePrefix(from, to []byte) error

func (*Handle) NewReader

func (me *Handle) NewReader() (r Reader, err error)

func (*Handle) NewWriter

func (me *Handle) NewWriter() (w *Writer, err error)

func (*Handle) PutBuf

func (me *Handle) PutBuf(key string, buf []byte) error

func (*Handle) SetInstanceLimits

func (me *Handle) SetInstanceLimits(limits Limits) error

func (*Handle) SingleDelete

func (me *Handle) SingleDelete(key string) (fi generics.Option[FileInfo], err error)

func (*Handle) SingleReadAt

func (me *Handle) SingleReadAt(key string, off int64, p []byte) (n int, err error)

func (*Handle) SingleStat

func (me *Handle) SingleStat(key string) (fi FileInfo, ok bool)

type Item

type Item = possumC.Item

type Limits

type Limits = possumC.Limits

type Rc added in v0.2.0

type Rc[T any] struct {
	// contains filtered or unexported fields
}

func NewRc added in v0.2.0

func NewRc[T any](t T, dropValue func(T)) (rc *Rc[T])

func (*Rc[T]) Clone added in v0.2.0

func (me *Rc[T]) Clone() (cloned *Rc[T])

func (*Rc[T]) Deref added in v0.2.0

func (me *Rc[T]) Deref() T

Return the value. TODO: Should we allow modifying the value? In Rust we'd get a reference, but in Go we're more than likely working with a pointer resource, but it would be possible to do synchronization external to Rc to make it useful as a value type.

func (*Rc[T]) Drop added in v0.2.0

func (me *Rc[T]) Drop()

It's a logical error to do this more than once. Figure your shit out.

func (*Rc[T]) Init added in v0.2.0

func (me *Rc[T]) Init(t T, dropValue func(T))

func (*Rc[T]) ValueDropped added in v0.2.0

func (me *Rc[T]) ValueDropped() *chansync.SetOnce

The return is set when the inner value is dropped.

type Reader

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

func (Reader) Add

func (r Reader) Add(key string) (v Value, err error)

func (Reader) Begin

func (r Reader) Begin() error

func (Reader) Close

func (r Reader) Close() error

func (Reader) End

func (r Reader) End()

func (Reader) ListItems

func (r Reader) ListItems(prefix string) ([]Item, error)

type Value

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

func (Value) ReadAt

func (v Value) ReadAt(p []byte, off int64) (n int, err error)

func (Value) Stat

func (v Value) Stat() FileInfo

type ValueWriter

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

func (*ValueWriter) Fd

func (me *ValueWriter) Fd() uintptr

Should this be exposed?

func (*ValueWriter) NewFile

func (me *ValueWriter) NewFile(name string) (f *os.File, err error)

type Writer

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

func (*Writer) Commit

func (me *Writer) Commit() error

This consumes the Writer. You must commit a Writer after it's created or it will leak a reference to the Handle. There doesn't seem to be a way to abort it in the Go API.

func (*Writer) Rename added in v0.2.0

func (me *Writer) Rename(v Value, newKey []byte)

func (*Writer) Stage

func (me *Writer) Stage(key []byte, value *ValueWriter) error

func (*Writer) StartNewValue

func (me *Writer) StartNewValue() (vw *ValueWriter, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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