Documentation
¶
Index ¶
- Variables
- func Deserialize(value []byte, se *proto.StorageEntry) error
- func GetStorageEntry(batch WriteBatch, key string) (*proto.StorageEntry, error)
- type ComparisonType
- type DB
- type Factory
- type FactoryOptions
- type KV
- type KeyIterator
- type KeyValueIterator
- type Pebble
- func (p *Pebble) Close() error
- func (p *Pebble) Delete() error
- func (p *Pebble) Flush() error
- func (p *Pebble) Get(key string, comparisonType ComparisonType) (returnedKey string, value []byte, closer io.Closer, err error)
- func (p *Pebble) KeyRangeScan(lowerBound, upperBound string) (KeyIterator, error)
- func (p *Pebble) KeyRangeScanReverse(lowerBound, upperBound string) (ReverseKeyIterator, error)
- func (p *Pebble) NewWriteBatch() WriteBatch
- func (p *Pebble) RangeScan(lowerBound, upperBound string) (KeyValueIterator, error)
- func (p *Pebble) Snapshot() (Snapshot, error)
- type PebbleBatch
- func (b *PebbleBatch) Close() error
- func (b *PebbleBatch) Commit() error
- func (b *PebbleBatch) Count() int
- func (b *PebbleBatch) Delete(key string) error
- func (b *PebbleBatch) DeleteRange(lowerBound, upperBound string) error
- func (b *PebbleBatch) FindLower(key string) (lowerKey string, err error)
- func (b *PebbleBatch) Get(key string) ([]byte, io.Closer, error)
- func (b *PebbleBatch) KeyRangeScan(lowerBound, upperBound string) (KeyIterator, error)
- func (b *PebbleBatch) Put(key string, value []byte) error
- func (b *PebbleBatch) RangeScan(lowerBound, upperBound string) (KeyValueIterator, error)
- func (b *PebbleBatch) Size() int
- type PebbleFactory
- type PebbleIterator
- type PebbleReverseIterator
- type RangeScanIterator
- type ReverseKeyIterator
- type Snapshot
- type SnapshotChunk
- type SnapshotLoader
- type TermOptions
- type UpdateOperationCallback
- type WriteBatch
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadVersionId = errors.New("oxia: bad version id") ErrMissingPartitionKey = errors.New("oxia: sequential key operation requires partition key") ErrMissingSequenceDeltas = errors.New("oxia: sequential key operation missing some sequence deltas") ErrSequenceDeltaIsZero = errors.New("oxia: sequential key operation requires first delta do be > 0") ErrNotificationsDisabled = errors.New("oxia: notifications disabled") )
View Source
var ( ErrKeyNotFound = errors.New("oxia: key not found") MaxSnapshotChunkSize int64 = 1024 * 1024 // bytes )
View Source
var DefaultFactoryOptions = &FactoryOptions{ DataDir: "data", CacheSizeMB: 100, InMemory: false, }
View Source
var ( OxiaSlashSpanComparer = &pebble.Comparer{ Compare: compare.CompareWithSlash, Equal: pebble.DefaultComparer.Equal, AbbreviatedKey: pebble.DefaultComparer.AbbreviatedKey, FormatKey: pebble.DefaultComparer.FormatKey, FormatValue: pebble.DefaultComparer.FormatValue, Separator: pebble.DefaultComparer.Separator, Split: pebble.DefaultComparer.Split, Successor: pebble.DefaultComparer.Successor, ImmediateSuccessor: pebble.DefaultComparer.ImmediateSuccessor, Name: "oxia-slash-spans", } )
Functions ¶
func Deserialize ¶ added in v0.10.0
func Deserialize(value []byte, se *proto.StorageEntry) error
func GetStorageEntry ¶
func GetStorageEntry(batch WriteBatch, key string) (*proto.StorageEntry, error)
Types ¶
type ComparisonType ¶ added in v0.5.0
type ComparisonType proto.KeyComparisonType
const ( ComparisonEqual ComparisonType = iota ComparisonFloor ComparisonCeiling ComparisonLower ComparisonHigher )
type DB ¶
type DB interface {
io.Closer
EnableNotifications(enable bool)
ProcessWrite(b *proto.WriteRequest, commitOffset int64, timestamp uint64, updateOperationCallback UpdateOperationCallback) (*proto.WriteResponse, error)
Get(request *proto.GetRequest) (*proto.GetResponse, error)
List(request *proto.ListRequest) (KeyIterator, error)
RangeScan(request *proto.RangeScanRequest) (RangeScanIterator, error)
ReadCommitOffset() (int64, error)
ReadNextNotifications(ctx context.Context, startOffset int64) ([]*proto.NotificationBatch, error)
UpdateTerm(newTerm int64, options TermOptions) error
ReadTerm() (term int64, options TermOptions, err error)
Snapshot() (Snapshot, error)
// Delete and close the database and all its files
Delete() error
}
type Factory ¶ added in v0.3.0
type Factory interface {
io.Closer
NewKV(namespace string, shardId int64) (KV, error)
NewSnapshotLoader(namespace string, shardId int64) (SnapshotLoader, error)
}
func NewPebbleKVFactory ¶
func NewPebbleKVFactory(options *FactoryOptions) (Factory, error)
type FactoryOptions ¶ added in v0.3.0
type KV ¶
type KV interface {
io.Closer
NewWriteBatch() WriteBatch
Get(key string, comparisonType ComparisonType) (storedKey string, value []byte, closer io.Closer, err error)
KeyRangeScan(lowerBound, upperBound string) (KeyIterator, error)
KeyRangeScanReverse(lowerBound, upperBound string) (ReverseKeyIterator, error)
RangeScan(lowerBound, upperBound string) (KeyValueIterator, error)
Snapshot() (Snapshot, error)
Flush() error
Delete() error
}
type KeyValueIterator ¶
type KeyValueIterator interface {
KeyIterator
Value() ([]byte, error)
}
type Pebble ¶
type Pebble struct {
// contains filtered or unexported fields
}
func (*Pebble) KeyRangeScan ¶
func (p *Pebble) KeyRangeScan(lowerBound, upperBound string) (KeyIterator, error)
func (*Pebble) KeyRangeScanReverse ¶
func (p *Pebble) KeyRangeScanReverse(lowerBound, upperBound string) (ReverseKeyIterator, error)
func (*Pebble) NewWriteBatch ¶
func (p *Pebble) NewWriteBatch() WriteBatch
type PebbleBatch ¶
type PebbleBatch struct {
// contains filtered or unexported fields
}
func (*PebbleBatch) Close ¶
func (b *PebbleBatch) Close() error
func (*PebbleBatch) Commit ¶
func (b *PebbleBatch) Commit() error
func (*PebbleBatch) Count ¶
func (b *PebbleBatch) Count() int
func (*PebbleBatch) Delete ¶
func (b *PebbleBatch) Delete(key string) error
func (*PebbleBatch) DeleteRange ¶
func (b *PebbleBatch) DeleteRange(lowerBound, upperBound string) error
func (*PebbleBatch) FindLower ¶ added in v0.5.0
func (b *PebbleBatch) FindLower(key string) (lowerKey string, err error)
func (*PebbleBatch) KeyRangeScan ¶
func (b *PebbleBatch) KeyRangeScan(lowerBound, upperBound string) (KeyIterator, error)
func (*PebbleBatch) RangeScan ¶ added in v0.10.0
func (b *PebbleBatch) RangeScan(lowerBound, upperBound string) (KeyValueIterator, error)
func (*PebbleBatch) Size ¶
func (b *PebbleBatch) Size() int
type PebbleFactory ¶
type PebbleFactory struct {
// contains filtered or unexported fields
}
func (*PebbleFactory) Close ¶
func (p *PebbleFactory) Close() error
func (*PebbleFactory) NewKV ¶
func (p *PebbleFactory) NewKV(namespace string, shardId int64) (KV, error)
func (*PebbleFactory) NewSnapshotLoader ¶
func (p *PebbleFactory) NewSnapshotLoader(namespace string, shardId int64) (SnapshotLoader, error)
type PebbleIterator ¶
type PebbleIterator struct {
// contains filtered or unexported fields
}
func (*PebbleIterator) Close ¶
func (p *PebbleIterator) Close() error
func (*PebbleIterator) Key ¶
func (p *PebbleIterator) Key() string
func (*PebbleIterator) Next ¶
func (p *PebbleIterator) Next() bool
func (*PebbleIterator) Valid ¶
func (p *PebbleIterator) Valid() bool
func (*PebbleIterator) Value ¶
func (p *PebbleIterator) Value() ([]byte, error)
type PebbleReverseIterator ¶
type PebbleReverseIterator struct {
// contains filtered or unexported fields
}
func (*PebbleReverseIterator) Close ¶
func (p *PebbleReverseIterator) Close() error
func (*PebbleReverseIterator) Key ¶
func (p *PebbleReverseIterator) Key() string
func (*PebbleReverseIterator) Prev ¶
func (p *PebbleReverseIterator) Prev() bool
func (*PebbleReverseIterator) Valid ¶
func (p *PebbleReverseIterator) Valid() bool
func (*PebbleReverseIterator) Value ¶
func (p *PebbleReverseIterator) Value() ([]byte, error)
type RangeScanIterator ¶ added in v0.5.0
type ReverseKeyIterator ¶
type SnapshotChunk ¶
type SnapshotLoader ¶
type TermOptions ¶ added in v0.10.0
type TermOptions struct {
NotificationsEnabled bool
}
func ToDbOption ¶ added in v0.10.0
func ToDbOption(opt *proto.NewTermOptions) TermOptions
type UpdateOperationCallback ¶
type UpdateOperationCallback interface {
OnPut(batch WriteBatch, req *proto.PutRequest, se *proto.StorageEntry) (proto.Status, error)
OnDelete(batch WriteBatch, key string) error
OnDeleteRange(batch WriteBatch, keyStartInclusive string, keyEndExclusive string) error
}
var NoOpCallback UpdateOperationCallback = &noopCallback{}
type WriteBatch ¶
type WriteBatch interface {
io.Closer
Put(key string, value []byte) error
Delete(key string) error
Get(key string) ([]byte, io.Closer, error)
FindLower(key string) (lowerKey string, err error)
DeleteRange(lowerBound, upperBound string) error
KeyRangeScan(lowerBound, upperBound string) (KeyIterator, error)
RangeScan(lowerBound, upperBound string) (KeyValueIterator, error)
// Count is the number of transactions that are currently in the batch
Count() int
// Size of all the transactions that are currently in the batch
Size() int
Commit() error
}
Click to show internal directories.
Click to hide internal directories.