Documentation ¶
Overview ¶
Package fs_db provides a client for a simple key-value database for storing files.
Index ¶
Constants ¶
View Source
const ( // IsoLevelReadUncommitted transaction iso level read uncommitted. IsoLevelReadUncommitted = model.TxIsoLevel(iota) // IsoLevelReadCommitted transaction iso level read committed. IsoLevelReadCommitted // IsoLevelRepeatableRead transaction iso level repeatable read. IsoLevelRepeatableRead // IsoLevelSerializable transaction iso level serializable. // // Since the set operation contains insert and update operations, // the serializable level is equal to the repeatable read. IsoLevelSerializable )
View Source
const ( // IsoLevelDefault the default transaction iso level is ReadCommitted. IsoLevelDefault = IsoLevelReadCommitted )
Variables ¶
View Source
var ( ErrUnknown = errors.New("unknown error") ErrNoFreeSpace = errors.New("no free space") ErrNotFound = errors.New("not found") ErrEmptyKey = errors.New("empty key") ErrHeaderNotFound = errors.New("header not found") // Tx errors. ErrTxNotFound = errors.New("transaction not found") ErrTxAlreadyExists = errors.New("transaction already exists") ErrTxSerialization = errors.New("serialization error") // Config errors. ErrEmptyDbPath = errors.New("empty db path") ErrEmptyRootDirs = errors.New("empty root dirs") )
View Source
var ( SizeErr = ErrNoFreeSpace NotFoundErr = ErrNotFound EmptyKeyErr = ErrEmptyKey HeaderNotFoundErr = ErrHeaderNotFound // Tx errors. TxNotFoundErr = ErrTxNotFound TxAlreadyExistsErr = ErrTxAlreadyExists TxSerializationErr = ErrTxSerialization // Config errors. EmptyDbPathErr = ErrEmptyDbPath EmptyRootDirs = ErrEmptyRootDirs )
Old errors to maintain backward compatibility.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { Store // Begin starts a transaction with isoLevel. Begin(ctx context.Context, isoLevel ...model.TxIsoLevel) (Tx, error) // Close closed the connection to fs_db. Close() error }
DB provides fs db interface.
type File ¶ added in v1.1.0
type File interface { io.WriteCloser }
type Store ¶ added in v1.0.0
type Store interface { // Set sets the contents of b using the key. Set(ctx context.Context, key string, b []byte) error // SetReader sets the reader content using the key. SetReader(ctx context.Context, key string, reader io.Reader) error // Get returns content by key. Get(ctx context.Context, key string) ([]byte, error) // GetReader returns content as io.ReadCloser by key. GetReader(ctx context.Context, key string) (io.ReadCloser, error) // GetKeys returns all keys from the database. GetKeys(ctx context.Context) ([]string, error) // Delete delete content by key. Delete(ctx context.Context, key string) error // Create returns the File for to write to. Create(ctx context.Context, key string) (File, error) }
Store provides KV operations with files.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
example
|
|
internal
|
|
delivery/grpc/store/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
repository/content_file/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
repository/file/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
usecase/cleaner/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
usecase/core/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
usecase/dir/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
usecase/store/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
usecase/transaction/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
utils/grpc/streamreader/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
utils/grpc/streamwriter/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
pkg
|
|
Click to show internal directories.
Click to hide internal directories.