filedb

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrError      = errors.New("")
	ErrTimeout    = fmt.Errorf("%wtimeout", ErrError)
	ErrBreak      = fmt.Errorf("%woperation break", ErrError)
	ErrRead       = fmt.Errorf("%wread failed", ErrError)
	ErrWrite      = fmt.Errorf("%wwrite failed", ErrError)
	ErrNotExist   = fmt.Errorf("%wfile does not exist", ErrError)
	ErrLocked     = fmt.Errorf("%wfile locked", ErrError)
	ErrNoSecurity = fmt.Errorf("%wsecurity not configured", ErrError)
	ErrInvalidKey = fmt.Errorf("%winvalid key size", ErrError)
	ErrEncrypt    = fmt.Errorf("%wencryption failed", ErrError)
	ErrDecrypt    = fmt.Errorf("%wdecryption failed", ErrError)
)

Functions

This section is empty.

Types

type Buffer

type Buffer = types.NDict

type Collection added in v0.1.1

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

func NewCollection added in v0.1.1

func NewCollection(path string) (*Collection, error)

func (*Collection) Child added in v0.1.1

func (dbc *Collection) Child(key string) *Collection

create child collection relative to parent collection

func (*Collection) Copy added in v0.1.1

func (dbc *Collection) Copy(srckey, dstkey string) error

func (*Collection) GetChilds added in v0.1.1

func (dbc *Collection) GetChilds() ([]*Collection, error)

func (*Collection) Index added in v0.3.1

func (dbc *Collection) Index(key string) *Index

func (*Collection) InitAES128 added in v0.1.1

func (dbc *Collection) InitAES128(secret string) error

func (*Collection) InitAES256 added in v0.1.1

func (dbc *Collection) InitAES256(secret string) error

func (*Collection) IsExist added in v0.1.1

func (dbc *Collection) IsExist() bool

func (*Collection) KeyPath added in v0.1.1

func (dbc *Collection) KeyPath(key string) string

convert relative file or collection key to absolute path

func (*Collection) ListChilds added in v0.1.1

func (dbc *Collection) ListChilds() ([]string, error)

func (*Collection) ListIndexes added in v0.3.1

func (dbc *Collection) ListIndexes() ([]string, error)

func (*Collection) Move added in v0.1.1

func (dbc *Collection) Move(srckey, dstkey string) error

func (*Collection) Purge added in v0.1.1

func (dbc *Collection) Purge(key string) error

func (*Collection) Query added in v0.1.1

func (dbc *Collection) Query() *Query

func (*Collection) String added in v0.1.1

func (dbc *Collection) String() string

type FileEngine

type FileEngine struct {

	// timeout for operations like read/write
	OpTimeout float64
	// polling interval for blocked operations
	OpPolling float64
	// permission for new dir creation
	DirPerm uint32
	// permission for new file creation
	FilePerm uint32
	// contains filtered or unexported fields
}

func NewFileEngine

func NewFileEngine() *FileEngine

create new file engine

func (*FileEngine) Cancel

func (dbe *FileEngine) Cancel()

cancel blocking operations

func (*FileEngine) FileExist

func (dbe *FileEngine) FileExist(fpath string) bool

check if file exists and is regular file

func (*FileEngine) PurgeFile

func (dbe *FileEngine) PurgeFile(fpath string) error

delete file

func (*FileEngine) ReadFile

func (dbe *FileEngine) ReadFile(fpath string) ([]byte, error)

read file content with shared locking

func (*FileEngine) TouchFile added in v0.3.1

func (dbe *FileEngine) TouchFile(fpath string) error

create file if not exist

func (*FileEngine) UpdateOptions

func (dbe *FileEngine) UpdateOptions(opts Options)

update file engine options

func (*FileEngine) WriteFile

func (dbe *FileEngine) WriteFile(fpath string, data []byte) error

write content to file with exclusive locking

type Index added in v0.3.1

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

func (*Index) Check added in v0.3.1

func (indx *Index) Check(key string) bool

func (*Index) Clear added in v0.3.1

func (indx *Index) Clear(key string) error

func (*Index) ClearAll added in v0.3.1

func (indx *Index) ClearAll(key string) error

func (*Index) List added in v0.3.1

func (indx *Index) List() ([]string, error)

func (*Index) ListIndexes added in v0.3.1

func (indx *Index) ListIndexes() ([]string, error)

func (*Index) Mark added in v0.3.1

func (indx *Index) Mark(key string) error

func (*Index) Purge added in v0.3.1

func (indx *Index) Purge() error

type Options

type Options = types.NDict

type Query added in v0.1.1

type Query struct {
	*FileEngine
	// contains filtered or unexported fields
}

func (*Query) Delete added in v0.1.1

func (dbq *Query) Delete(key string) error

delete file

func (*Query) Get added in v0.1.1

func (dbq *Query) Get(key string) ([]byte, error)

func (*Query) GetBuffer added in v0.1.1

func (dbq *Query) GetBuffer(key string) (Buffer, error)

func (*Query) GetBufferSlice added in v0.1.1

func (dbq *Query) GetBufferSlice(key string) ([]Buffer, error)

func (*Query) GetSecure added in v0.1.1

func (dbq *Query) GetSecure(key string) ([]byte, error)

read file content with shared locking

func (*Query) GetSecureBuffer added in v0.1.1

func (dbq *Query) GetSecureBuffer(key string) (Buffer, error)

func (*Query) GetSecureBufferSlice added in v0.1.1

func (dbq *Query) GetSecureBufferSlice(key string) ([]Buffer, error)

func (*Query) IsExist added in v0.1.1

func (dbq *Query) IsExist(key string) bool

func (*Query) Keys added in v0.1.1

func (dbq *Query) Keys() ([]string, error)

func (*Query) Set added in v0.1.1

func (dbq *Query) Set(key string, value []byte) error

func (*Query) SetBuffer added in v0.1.1

func (dbq *Query) SetBuffer(key string, value Buffer) error

func (*Query) SetBufferSlice added in v0.1.1

func (dbq *Query) SetBufferSlice(key string, value []Buffer) error

func (*Query) SetSecure added in v0.1.1

func (dbq *Query) SetSecure(key string, value []byte) error

write content to file with exclusive locking

func (*Query) SetSecureBuffer added in v0.1.1

func (dbq *Query) SetSecureBuffer(key string, value Buffer) error

func (*Query) SetSecureBufferSlice added in v0.1.1

func (dbq *Query) SetSecureBufferSlice(key string, value []Buffer) error

Jump to

Keyboard shortcuts

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