storage

package
v0.0.0-...-4f831cf Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyID = ID{}
)

Functions

This section is empty.

Types

type Accessor

type Accessor interface {
	Reader
	Writer
}

type File

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

func NewFile

func NewFile(root string) (*File, error)

func (*File) Read

func (f *File) Read(id ID) ([]byte, error)

func (*File) Write

func (f *File) Write(data []byte) (id ID, err error)

type ID

type ID struct {
	Data []byte
}

func IDFromString

func IDFromString(input string) (id ID, err error)

func NewID

func NewID(data []byte) ID

func (ID) Equal

func (id ID) Equal(o ID) bool

func (ID) String

func (id ID) String() string

func (ID) ToFullString

func (id ID) ToFullString() string

func (ID) Undefined

func (id ID) Undefined() bool

type Null

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

func NewNull

func NewNull() *Null

func (*Null) Read

func (n *Null) Read(id ID) ([]byte, error)

func (*Null) Write

func (n *Null) Write(data []byte) (ID, error)

type Reader

type Reader interface {
	Read(id ID) ([]byte, error)
}

type Writer

type Writer interface {
	// Write writes the data to the storage. The function
	// returns the object ID.
	Write(data []byte) (ID, error)
}

Jump to

Keyboard shortcuts

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