filedb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 11 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 DB

type DB struct {
	*FileEngine

	// root file path prefix for all operations
	RootPath string
	// contains filtered or unexported fields
}

func NewDB

func NewDB(rootpath string) *DB

func (*DB) Delete

func (db *DB) Delete(key string) error

delete file

func (*DB) Get

func (db *DB) Get(key string) ([]byte, error)

func (*DB) GetBuffer

func (db *DB) GetBuffer(key string) (Buffer, error)

func (*DB) GetBufferSlice

func (db *DB) GetBufferSlice(key string) ([]Buffer, error)

func (*DB) GetSecure

func (db *DB) GetSecure(key string) ([]byte, error)

read file content with shared locking

func (*DB) GetSecureBuffer

func (db *DB) GetSecureBuffer(key string) (Buffer, error)

func (*DB) GetSecureBufferSlice

func (db *DB) GetSecureBufferSlice(key string) ([]Buffer, error)

func (*DB) InitAES128

func (db *DB) InitAES128(secret string) error

func (*DB) InitAES256

func (db *DB) InitAES256(secret string) error

func (*DB) IsExist

func (db *DB) IsExist(key string) bool

func (*DB) KeyPath

func (db *DB) KeyPath(key string) string

func (*DB) Set

func (db *DB) Set(key string, value []byte) error

func (*DB) SetBuffer

func (db *DB) SetBuffer(key string, value Buffer) error

func (*DB) SetBufferSlice

func (db *DB) SetBufferSlice(key string, value []Buffer) error

func (*DB) SetSecure

func (db *DB) SetSecure(key string, value []byte) error

write content to file with exclusive locking

func (*DB) SetSecureBuffer

func (db *DB) SetSecureBuffer(key string, value Buffer) error

func (*DB) SetSecureBufferSlice

func (db *DB) SetSecureBufferSlice(key string, value []Buffer) error

func (*DB) String

func (db *DB) 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 (eng *FileEngine) Cancel()

cancel blocking operations

func (*FileEngine) FileExist

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

check if file exists and is regular file

func (*FileEngine) PurgeFile

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

delete file

func (*FileEngine) ReadFile

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

read file content with shared locking

func (*FileEngine) UpdateOptions

func (eng *FileEngine) UpdateOptions(opts Options)

update file engine options

func (*FileEngine) WriteFile

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

write content to file with exclusive locking

type Options

type Options = types.NDict

Jump to

Keyboard shortcuts

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