Documentation
¶
Index ¶
- Variables
- func CompareWithSlash(a, b []byte) int
- func GetStorageEntry(batch WriteBatch, key string) (*proto.StorageEntry, error)
- type DB
- type KV
- type KVFactory
- type KVFactoryOptions
- 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) ([]byte, io.Closer, 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) 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) Size() int
- type PebbleFactory
- type PebbleIterator
- type PebbleLogger
- type PebbleReverseIterator
- type ReverseKeyIterator
- type Snapshot
- type SnapshotChunk
- type SnapshotLoader
- type UpdateOperationCallback
- type WriteBatch
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorKeyNotFound = errors.New("oxia: key not found") MaxSnapshotChunkSize int64 = 1024 * 1024 // bytes )
View Source
var DefaultKVFactoryOptions = &KVFactoryOptions{ DataDir: "data", CacheSizeMB: 100, InMemory: false, }
View Source
var ErrorBadVersionId = errors.New("oxia: bad version id")
View Source
var ( OxiaSlashSpanComparer = &pebble.Comparer{ 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 CompareWithSlash ¶
func GetStorageEntry ¶
func GetStorageEntry(batch WriteBatch, key string) (*proto.StorageEntry, error)
Types ¶
type DB ¶
type DB interface {
io.Closer
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)
ReadCommitOffset() (int64, error)
ReadNextNotifications(ctx context.Context, startOffset int64) ([]*proto.NotificationBatch, error)
UpdateTerm(newTerm int64) error
ReadTerm() (term int64, err error)
Snapshot() (Snapshot, error)
// Delete and close the database and all its files
Delete() error
}
type KV ¶
type KV interface {
io.Closer
NewWriteBatch() WriteBatch
Get(key string) ([]byte, io.Closer, 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 KVFactory ¶
type KVFactory interface {
io.Closer
NewKV(namespace string, shardId int64) (KV, error)
NewSnapshotLoader(namespace string, shardId int64) (SnapshotLoader, error)
}
func NewPebbleKVFactory ¶
func NewPebbleKVFactory(options *KVFactoryOptions) (KVFactory, error)
type KVFactoryOptions ¶
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) KeyRangeScan ¶
func (b *PebbleBatch) KeyRangeScan(lowerBound, upperBound string) (KeyIterator, 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 PebbleLogger ¶
type PebbleLogger struct {
// contains filtered or unexported fields
}
func (*PebbleLogger) Errorf ¶
func (pl *PebbleLogger) Errorf(format string, args ...interface{})
func (*PebbleLogger) Fatalf ¶
func (pl *PebbleLogger) Fatalf(format string, args ...interface{})
func (*PebbleLogger) Infof ¶
func (pl *PebbleLogger) Infof(format string, args ...interface{})
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 ReverseKeyIterator ¶
type SnapshotChunk ¶
type SnapshotLoader ¶
type UpdateOperationCallback ¶
type UpdateOperationCallback interface {
OnPut(WriteBatch, *proto.PutRequest, *proto.StorageEntry) (proto.Status, error)
OnDelete(WriteBatch, 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)
DeleteRange(lowerBound, upperBound string) error
KeyRangeScan(lowerBound, upperBound string) (KeyIterator, 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.