Documentation ¶
Index ¶
- Constants
- Variables
- func ReadLogLen(path string) (int, error)
- func SpliceDatabase[B tapedb.Base, S tapedb.State, F tapedb.Factory[B, S]](f F, path string, opts ...SpliceOption) error
- func WriteMeta(w io.Writer, meta Meta) error
- func WriteMetaFile(path string, meta Meta) error
- type CreateOption
- type Database
- func (db *Database[B, S]) Apply(change tapedb.Change, payloads ...Payload) error
- func (db *Database[B, S]) Base() B
- func (db *Database[B, S]) Close() error
- func (db *Database[B, S]) Key() []byte
- func (db *Database[B, S]) LogLen() int
- func (db *Database[B, S]) Meta() Meta
- func (db *Database[B, S]) OpenPayload(id string) (io.ReadCloser, error)
- func (db *Database[B, S]) SetMeta(meta Meta) error
- func (db *Database[B, S]) StatPayload(id string) (fs.FileInfo, error)
- func (db *Database[B, S]) State() S
- type Deck
- func (d *Deck[B, S, F]) Close() error
- func (d *Deck[B, S, F]) Create(f F, path string, opts ...CreateOption) error
- func (d *Deck[B, S, F]) Delete(path string) error
- func (d *Deck[B, S, F]) Len() int
- func (d *Deck[B, S, F]) LogLen(path string) (int, error)
- func (d *Deck[B, S, F]) Meta(path string) (Meta, error)
- func (d *Deck[B, S, F]) Open(f F, path string, opts []OpenOption) (*Database[B, S], func(), error)
- func (d *Deck[B, S, F]) SetMeta(path string, meta Meta) error
- func (d *Deck[B, S, F]) Splice(f F, path string, opts ...SpliceOption) error
- func (d *Deck[B, S, F]) WithOpen(f F, path string, opts []OpenOption, fn func(*Database[B, S]) error) error
- type KeyFunc
- type Meta
- func (m Meta) Get(key string) string
- func (m Meta) GetBytes(key string, defaultValue []byte) []byte
- func (m Meta) GetUInt64(key string, defaultValue uint64) uint64
- func (m Meta) Has(key string) bool
- func (m Meta) Set(key, value string)
- func (m Meta) SetBytes(key string, value []byte)
- func (m Meta) SetUInt64(key string, value uint64)
- func (m Meta) WriteTo(w io.Writer) (int64, error)
- type OpenOption
- type Payload
- type PayloadContainer
- type RebaseChangeSelectFunc
- type SpliceOption
- func WithRebaseChangeCount(value int) SpliceOption
- func WithRebaseChangeSelectFunc(value RebaseChangeSelectFunc) SpliceOption
- func WithSourceKey(value []byte) SpliceOption
- func WithSourceKeyFunc(value KeyFunc) SpliceOption
- func WithTargetKey(value []byte) SpliceOption
- func WithTargetKeyFunc(value KeyFunc) SpliceOption
Constants ¶
View Source
const ( FileNameMeta = "meta" FileNameBase = "base" FileNameLog = "log" FileNameNewMeta = "meta.new" FileNameNewBase = "base.new" FileNameNewLog = "log.new" FilePrefixPayload = "payload-" )
View Source
const ( MetaHeaderCryptSettings = "Crypt-Settings" DefaultCryptSettings = "$argon2id$v=19$m=65536,t=2,p=4$" )
View Source
const (
MetaFieldNonce = "Nonce"
)
Variables ¶
View Source
var ( ErrMissing = errors.New("missing") ErrExisting = errors.New("existing") ErrInvalidKey = errors.New("invalid key") )
View Source
var ( ErrPayloadIDAlreadyExists = errors.New("payload id already exists") ErrPayloadMissing = errors.New("payload missing") )
View Source
var NonceFn crypto.NonceFunc = crypto.RandomNonceFn()
Functions ¶
func ReadLogLen ¶
func SpliceDatabase ¶
func WriteMetaFile ¶
Types ¶
type CreateOption ¶
type CreateOption func(*createOptions)
func WithCreateKey ¶
func WithCreateKey(value []byte) CreateOption
func WithCreateKeyFunc ¶
func WithCreateKeyFunc(value KeyFunc) CreateOption
func WithDirectoryMode ¶
func WithDirectoryMode(value fs.FileMode) CreateOption
func WithFileMode ¶
func WithFileMode(value fs.FileMode) CreateOption
func WithMeta ¶
func WithMeta(value Meta) CreateOption
type Database ¶
func CreateDatabase ¶
func OpenDatabase ¶
func (*Database[B, S]) OpenPayload ¶
func (db *Database[B, S]) OpenPayload(id string) (io.ReadCloser, error)
func (*Database[B, S]) StatPayload ¶
type Deck ¶
type Deck[
B tapedb.Base,
S tapedb.State,
F tapedb.Factory[B, S],
] struct {
// contains filtered or unexported fields
}
func (*Deck[B, S, F]) Create ¶
func (d *Deck[B, S, F]) Create(f F, path string, opts ...CreateOption) error
func (*Deck[B, S, F]) Open ¶
func (d *Deck[B, S, F]) Open(f F, path string, opts []OpenOption) (*Database[B, S], func(), error)
type OpenOption ¶
type OpenOption func(*openOptions)
func WithOpenKey ¶
func WithOpenKey(value []byte) OpenOption
func WithOpenKeyFunc ¶
func WithOpenKeyFunc(value KeyFunc) OpenOption
type PayloadContainer ¶
type PayloadContainer interface {
PayloadIDs() []string
}
type RebaseChangeSelectFunc ¶
func CountRebaseChangeSelectFunc ¶
func CountRebaseChangeSelectFunc(count int) RebaseChangeSelectFunc
func StaticRebaseChangeSelectFunc ¶
func StaticRebaseChangeSelectFunc(value bool) RebaseChangeSelectFunc
type SpliceOption ¶
type SpliceOption func(*spliceOptions)
func WithRebaseChangeCount ¶
func WithRebaseChangeCount(value int) SpliceOption
func WithRebaseChangeSelectFunc ¶
func WithRebaseChangeSelectFunc(value RebaseChangeSelectFunc) SpliceOption
func WithSourceKey ¶
func WithSourceKey(value []byte) SpliceOption
func WithSourceKeyFunc ¶
func WithSourceKeyFunc(value KeyFunc) SpliceOption
func WithTargetKey ¶
func WithTargetKey(value []byte) SpliceOption
func WithTargetKeyFunc ¶
func WithTargetKeyFunc(value KeyFunc) SpliceOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.