hippy: github.com/itsmontoya/hippy Index | Files | Directories

package hippy

import "github.com/itsmontoya/hippy"

Index

Package Files

helpers.go hippy.go opts.go tx.go

Constants

const (
    // ErrInvalidAction is returned when an invalid action occurs
    ErrInvalidAction = errors.Error("invalid action")

    // ErrInvalidKey is returned when an invalid key is provided
    ErrInvalidKey = errors.Error("invalid key")

    // ErrHashLine is returned when a hash line is parsed as a log line
    ErrHashLine = errors.Error("cannot parse hash line as log line")

    // ErrHashNotFound is returned when a hash line is not found while archiving
    ErrHashNotFound = errors.Error("hash not found")

    // ErrLineNotFound is returned when a line is not found while calling SeekNextLine
    ErrLineNotFound = errors.Error("line not found")

    // ErrIsClosed is returned when an action is attempted on a closed instance
    ErrIsClosed = errors.Error("cannot perform action on closed instance")

    // ErrIsOpen is returned when an instance is attempted to be re-opened when it's already active
    ErrIsOpen = errors.Error("cannot open an instance which is already open")

    // ErrNoChanges is returned when no changes occur and an archive is not needed
    ErrNoChanges = errors.Error("no changes occured, archive not necessary")
)
const (

    // MaxKeyLen is the maximum length for keys
    MaxKeyLen byte = 255
)

type Error Uses

type Error string

Error is a simple error type which is able to be stored as a const, rather than a global var

func (Error) Error Uses

func (e Error) Error() string

Error fulfills the interface requirements for an error

type ErrorList Uses

type ErrorList []error

ErrorList is a list of errors

func (ErrorList) Append Uses

func (e ErrorList) Append(err error) ErrorList

Append appends an error to the error list

func (ErrorList) Err Uses

func (e ErrorList) Err() error

Err returns error value of ErrorList

func (ErrorList) Error Uses

func (e ErrorList) Error() string

Error is the error interface implementation

func (*ErrorList) Push Uses

func (e *ErrorList) Push(err error)

Push adds the error to the list if it is not nil

type Hippy Uses

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

Hippy is a db

func New Uses

func New(path, name string, opts Opts, mws ...middleware.Middleware) (h *Hippy, err error)

New returns a new Hippy

func (*Hippy) Close Uses

func (h *Hippy) Close() (err error)

Close will close Hippy

func (*Hippy) Read Uses

func (h *Hippy) Read(fn func(*ReadTx) error) (err error)

Read will return a read-only transaction

func (*Hippy) ReadWrite Uses

func (h *Hippy) ReadWrite(fn func(*ReadWriteTx) error) (err error)

ReadWrite returns a read/write transaction

func (*Hippy) Write Uses

func (h *Hippy) Write(fn func(*WriteTx) error) (err error)

Write returns a write-only transaction

type Opts Uses

type Opts struct {
    CopyOnWrite bool `ini:"copyOnWrite"`
    CopyOnRead  bool `ini:"copyOnRead"`

    ArchiveOnClose bool `ini:"archiveOnClose"`
    CompactOnClose bool `ini:"compactOnClose"`

    AsyncBackend bool `ini:"asyncBackend"`
}

Opts are options for Hippy

func NewOpts Uses

func NewOpts(src interface{}) (o Opts, err error)

NewOpts returns new options for Hippy

type ReadTx Uses

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

ReadTx is a read-only transaction

func (*ReadTx) Get Uses

func (r *ReadTx) Get(k string) (b []byte, ok bool)

Get will get a body and an ok value

func (*ReadTx) Keys Uses

func (r *ReadTx) Keys() (keys []string)

Keys will list the keys for a DB

type ReadWriteTx Uses

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

ReadWriteTx is a read/write transaction

func (*ReadWriteTx) Del Uses

func (rw *ReadWriteTx) Del(k string)

Del will delete

func (*ReadWriteTx) Get Uses

func (rw *ReadWriteTx) Get(k string) (b []byte, ok bool)

Get will get a body and an ok value

func (*ReadWriteTx) Keys Uses

func (rw *ReadWriteTx) Keys() (keys []string)

Keys will list the keys for a DB

func (*ReadWriteTx) Put Uses

func (rw *ReadWriteTx) Put(k string, v []byte) (err error)

Put will put

type WriteTx Uses

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

WriteTx is a write-only transaction

func (*WriteTx) Del Uses

func (w *WriteTx) Del(k string)

Del will delete

func (*WriteTx) Put Uses

func (w *WriteTx) Put(k string, v []byte) (err error)

Put will put

Directories

PathSynopsis
tests

Package hippy imports 10 packages (graph) and is imported by 1 packages. Updated 2017-02-26. Refresh now. Tools for package owners.