Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeEntrySpec(key []byte, md *store.KVMetadata, value []byte) *store.EntrySpec
- func EncodeKey(key []byte) []byte
- func EncodeReference(key []byte, md *store.KVMetadata, referencedKey []byte, atTx uint64) *store.EntrySpec
- func EncodeZAdd(set []byte, score float64, key []byte, atTx uint64) *store.EntrySpec
- func PreconditionFromProto(c *schema.Precondition) (store.Precondition, error)
- func TrimPrefix(prefixed []byte) []byte
- func WrapReferenceValueAt(key []byte, atTx uint64) []byte
- func WrapWithPrefix(b []byte, prefix byte) []byte
- func WrapZAddReferenceAt(set []byte, score float64, key []byte, atTx uint64) []byte
- type DB
- type DatabaseList
- type Options
- func (o *Options) AsReplica(replica bool) *Options
- func (o *Options) GetCorruptionChecker() bool
- func (o *Options) GetDBRootPath() string
- func (o *Options) GetStoreOptions() *store.Options
- func (o *Options) GetTxPoolSize() int
- func (o *Options) WithCorruptionChecker(cc bool) *Options
- func (o *Options) WithDBRootPath(Path string) *Options
- func (o *Options) WithReadTxPoolSize(txPoolSize int) *Options
- func (o *Options) WithStoreOptions(storeOpts *store.Options) *Options
- func (o *Options) WithSyncFollowers(syncFollowers int) *Options
- func (o *Options) WithSyncReplication(syncReplication bool) *Options
Constants ¶
View Source
const ( DefaultDbRootPath = "./data" DefaultReadTxPoolSize = 128 )
View Source
const ( SetKeyPrefix byte = iota SortedSetKeyPrefix SQLPrefix )
View Source
const ( PlainValuePrefix = iota ReferenceValuePrefix )
View Source
const MaxKeyResolutionLimit = 1
View Source
const MaxKeyScanLimit = 1000
Variables ¶
View Source
var ( ErrIndexKeyMismatch = status.New(codes.InvalidArgument, "mismatch between provided index and key").Err() ErrNoReferenceProvided = status.New(codes.InvalidArgument, "provided argument is not a reference").Err() ErrReferenceKeyMissing = status.New(codes.InvalidArgument, "reference key not provided").Err() ErrZAddIndexMissing = status.New(codes.InvalidArgument, "zAdd index not provided").Err() ErrReferenceIndexMissing = status.New(codes.InvalidArgument, "reference index not provided").Err() ErrDatabaseAlreadyExists = errors.New("database already exists") ErrDatabaseNotExists = errors.New("database does not exist") ErrCannotDeleteAnOpenDatabase = errors.New("cannot delete an open database") ErrTxReadPoolExhausted = errors.New("read tx pool exhausted") )
View Source
var ErrFinalKeyCannotBeConvertedIntoReference = errors.New("final key cannot be converted into a reference")
View Source
var ErrIllegalArguments = store.ErrIllegalArguments
View Source
var ErrIllegalState = store.ErrIllegalState
View Source
var ErrInvalidRevision = errors.New("invalid key revision number")
View Source
var ErrIsReplica = errors.New("database is read-only because it's a replica")
View Source
var ErrKeyResolutionLimitReached = errors.New("key resolution limit reached. It may be due to cyclic references")
View Source
var ErrNoWaitOperationMustBeSelfContained = fmt.Errorf("no wait operation must be self-contained: %w", store.ErrIllegalArguments)
View Source
var ErrNotReplica = errors.New("database is NOT a replica")
View Source
var ErrReferencedKeyCannotBeAReference = errors.New("referenced key cannot be a reference")
View Source
var ErrResultSizeLimitExceeded = errors.New("result size limit exceeded")
View Source
var ErrResultSizeLimitReached = errors.New("result size limit reached")
View Source
var ErrSQLNotReady = errors.New("SQL catalog not yet replicated")
Functions ¶
func EncodeEntrySpec ¶ added in v1.2.0
func EncodeReference ¶
func EncodeZAdd ¶
func PreconditionFromProto ¶ added in v1.2.3
func PreconditionFromProto(c *schema.Precondition) (store.Precondition, error)
func TrimPrefix ¶ added in v0.9.1
func WrapReferenceValueAt ¶
Types ¶
type DB ¶
type DB interface { GetName() string // Setttings GetOptions() *Options Path() string AsReplica(asReplica bool, syncFollowers int) IsReplica() bool IsSyncReplicationEnabled() bool EnableSyncReplication() error DisableSyncReplication() error MaxResultSize() int UseTimeFunc(timeFunc store.TimeFunc) error // State Health() (waitingCount int, lastReleaseAt time.Time) CurrentState() (*schema.ImmutableState, error) Size() (uint64, error) // Key-Value Set(req *schema.SetRequest) (*schema.TxHeader, error) VerifiableSet(req *schema.VerifiableSetRequest) (*schema.VerifiableTx, error) Get(req *schema.KeyRequest) (*schema.Entry, error) VerifiableGet(req *schema.VerifiableGetRequest) (*schema.VerifiableEntry, error) GetAll(req *schema.KeyListRequest) (*schema.Entries, error) Delete(req *schema.DeleteKeysRequest) (*schema.TxHeader, error) SetReference(req *schema.ReferenceRequest) (*schema.TxHeader, error) VerifiableSetReference(req *schema.VerifiableReferenceRequest) (*schema.VerifiableTx, error) Scan(req *schema.ScanRequest) (*schema.Entries, error) History(req *schema.HistoryRequest) (*schema.Entries, error) ExecAll(operations *schema.ExecAllRequest) (*schema.TxHeader, error) Count(prefix *schema.KeyPrefix) (*schema.EntryCount, error) CountAll() (*schema.EntryCount, error) ZAdd(req *schema.ZAddRequest) (*schema.TxHeader, error) VerifiableZAdd(req *schema.VerifiableZAddRequest) (*schema.VerifiableTx, error) ZScan(req *schema.ZScanRequest) (*schema.ZEntries, error) // SQL-related NewSQLTx(ctx context.Context) (*sql.SQLTx, error) SQLExec(req *schema.SQLExecRequest, tx *sql.SQLTx) (ntx *sql.SQLTx, ctxs []*sql.SQLTx, err error) SQLExecPrepared(stmts []sql.SQLStmt, params map[string]interface{}, tx *sql.SQLTx) (ntx *sql.SQLTx, ctxs []*sql.SQLTx, err error) InferParameters(sql string, tx *sql.SQLTx) (map[string]sql.SQLValueType, error) InferParametersPrepared(stmt sql.SQLStmt, tx *sql.SQLTx) (map[string]sql.SQLValueType, error) SQLQuery(req *schema.SQLQueryRequest, tx *sql.SQLTx) (*schema.SQLQueryResult, error) SQLQueryPrepared(stmt sql.DataSource, namedParams []*schema.NamedParam, tx *sql.SQLTx) (*schema.SQLQueryResult, error) SQLQueryRowReader(stmt sql.DataSource, params map[string]interface{}, tx *sql.SQLTx) (sql.RowReader, error) VerifiableSQLGet(req *schema.VerifiableSQLGetRequest) (*schema.VerifiableSQLEntry, error) ListTables(tx *sql.SQLTx) (*schema.SQLQueryResult, error) DescribeTable(table string, tx *sql.SQLTx) (*schema.SQLQueryResult, error) // Transactional layer WaitForTx(txID uint64, allowPrecommitted bool, cancellation <-chan struct{}) error WaitForIndexingUpto(txID uint64, cancellation <-chan struct{}) error TxByID(req *schema.TxRequest) (*schema.Tx, error) ExportTxByID(req *schema.ExportTxRequest) (txbs []byte, mayCommitUpToTxID uint64, mayCommitUpToAlh [sha256.Size]byte, err error) ReplicateTx(exportedTx []byte) (*schema.TxHeader, error) AllowCommitUpto(txID uint64, alh [sha256.Size]byte) error DiscardPrecommittedTxsSince(txID uint64) error VerifiableTxByID(req *schema.VerifiableTxRequest) (*schema.VerifiableTx, error) TxScan(req *schema.TxScanRequest) (*schema.TxList, error) // Maintenance FlushIndex(req *schema.FlushIndexRequest) error CompactIndex() error IsClosed() bool Close() error }
type DatabaseList ¶ added in v1.0.0
type DatabaseList interface { Put(database DB) Delete(string) (DB, error) GetByIndex(index int) (DB, error) GetByName(string) (DB, error) GetId(dbname string) int Length() int }
DatabaseList interface
func NewDatabaseList ¶ added in v1.0.0
func NewDatabaseList() DatabaseList
NewDatabaseList constructs a new database list
type Options ¶ added in v1.1.0
type Options struct {
// contains filtered or unexported fields
}
Options database instance options
func DefaultOption ¶
func DefaultOption() *Options
DefaultOption Initialise Db Optionts to default values
func (*Options) GetCorruptionChecker ¶ added in v1.1.0
GetCorruptionChecker returns if corruption checker should start for this database instance
func (*Options) GetDBRootPath ¶ added in v1.1.0
GetDbRootPath returns the directory in which this database resides
func (*Options) GetStoreOptions ¶ added in v1.1.0
GetStoreOptions returns backing store options
func (*Options) GetTxPoolSize ¶ added in v1.3.2
func (*Options) WithCorruptionChecker ¶ added in v1.1.0
WithCorruptionChecker sets if corruption checker should start for this database instance
func (*Options) WithDBRootPath ¶ added in v1.1.0
WithDbRootPath sets the directory in which this database will reside
func (*Options) WithReadTxPoolSize ¶ added in v1.3.2
func (*Options) WithStoreOptions ¶ added in v1.1.0
WithStoreOptions sets backing store options
func (*Options) WithSyncFollowers ¶
func (*Options) WithSyncReplication ¶ added in v1.4.0
Click to show internal directories.
Click to hide internal directories.