Documentation ¶
Index ¶
- Constants
- Variables
- func TestAppendLogEntryWithoutCommitContext(tb testing.TB, stg *Storage, llsn types.LLSN, glsn types.GLSN, data []byte)
- func TestGetUnderlyingDB(tb testing.TB, stg *Storage) *pebble.DB
- func TestSetCommitContext(tb testing.TB, stg *Storage, cc CommitContext)
- type CommitBatch
- type CommitContext
- type Option
- func ReadOnly() Option
- func WithL0CompactionThreshold(l0CompactionThreshold int) Option
- func WithL0StopWritesThreshold(l0StopWritesThreshold int) Option
- func WithLBaseMaxBytes(lbaseMaxBytes int64) Option
- func WithLogger(logger *zap.Logger) Option
- func WithMaxConcurrentCompaction(maxConcurrentCompaction int) Option
- func WithMaxOpenFiles(maxOpenFiles int) Option
- func WithMemTableSize(memTableSize int) Option
- func WithMemTableStopWritesThreshold(memTableStopWritesThreshold int) Option
- func WithPath(path string) Option
- func WithVerboseLogging() Option
- func WithoutSync() Option
- func WithoutWAL() Option
- type ReadOption
- type RecoveryPoints
- type ScanOption
- type Scanner
- type Storage
- func (s *Storage) Close() (err error)
- func (s *Storage) CommitContextOf(glsn types.GLSN) (cc CommitContext, err error)
- func (s *Storage) DiskUsage() int64
- func (s *Storage) NewCommitBatch(cc CommitContext) (*CommitBatch, error)
- func (s *Storage) NewScanner(opts ...ScanOption) *Scanner
- func (s *Storage) NewWriteBatch() *WriteBatch
- func (s *Storage) NextCommitContextOf(cc CommitContext) (next CommitContext, err error)
- func (s *Storage) Path() string
- func (s *Storage) Read(opts ...ReadOption) (le varlogpb.LogEntry, err error)
- func (s *Storage) ReadCommitContext() (cc CommitContext, err error)
- func (s *Storage) ReadRecoveryPoints() (rp RecoveryPoints, err error)
- func (s *Storage) Trim(glsn types.GLSN) error
- type WriteBatch
Constants ¶
const ( DefaultL0CompactionThreshold = 4 DefaultL0StopWritesThreshold = 12 DefaultLBaseMaxBytes = 64 << 20 DefaultMaxOpenFiles = 1000 DefaultMemTableSize = 4 << 20 DefaultMemTableStopWritesThreshold = 2 DefaultMaxConcurrentCompactions = 1 )
Variables ¶
Functions ¶
func TestAppendLogEntryWithoutCommitContext ¶ added in v0.5.0
func TestAppendLogEntryWithoutCommitContext(tb testing.TB, stg *Storage, llsn types.LLSN, glsn types.GLSN, data []byte)
TestAppendLogEntryWithoutCommitContext stores log entries without commit context.
func TestGetUnderlyingDB ¶ added in v0.5.0
TestGetUnderlyingDB returns a pebble that is an internal database in the storage.
func TestSetCommitContext ¶ added in v0.5.0
func TestSetCommitContext(tb testing.TB, stg *Storage, cc CommitContext)
TestSetCommitContext stores only commit context.
Types ¶
type CommitBatch ¶
type CommitBatch struct {
// contains filtered or unexported fields
}
func (*CommitBatch) Apply ¶
func (cb *CommitBatch) Apply() error
func (*CommitBatch) Close ¶
func (cb *CommitBatch) Close() error
type CommitContext ¶
type CommitContext struct { Version types.Version HighWatermark types.GLSN CommittedGLSNBegin types.GLSN CommittedGLSNEnd types.GLSN CommittedLLSNBegin types.LLSN }
func (CommitContext) Empty ¶
func (cc CommitContext) Empty() bool
func (CommitContext) Equal ¶
func (cc CommitContext) Equal(other CommitContext) bool
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func ReadOnly ¶ added in v0.5.0
func ReadOnly() Option
ReadOnly makes storage read-only. It is helpful only for testing. Usually, users do not have to call it.
func WithLBaseMaxBytes ¶
func WithLogger ¶
func WithMaxOpenFiles ¶
func WithMemTableSize ¶
func WithVerboseLogging ¶
func WithVerboseLogging() Option
func WithoutSync ¶
func WithoutSync() Option
func WithoutWAL ¶
func WithoutWAL() Option
type ReadOption ¶
type ReadOption interface {
// contains filtered or unexported methods
}
func AtGLSN ¶
func AtGLSN(glsn types.GLSN) ReadOption
func AtLLSN ¶
func AtLLSN(llsn types.LLSN) ReadOption
type RecoveryPoints ¶
type RecoveryPoints struct { LastCommitContext *CommitContext CommittedLogEntry struct { First *varlogpb.LogEntryMeta Last *varlogpb.LogEntryMeta } }
type ScanOption ¶
type ScanOption interface {
// contains filtered or unexported methods
}
func WithGLSN ¶
func WithGLSN(begin, end types.GLSN) ScanOption
func WithLLSN ¶
func WithLLSN(begin, end types.LLSN) ScanOption
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) CommitContextOf ¶
func (s *Storage) CommitContextOf(glsn types.GLSN) (cc CommitContext, err error)
CommitContextOf looks up a commit context that contains the log entry for the argument glsn.
func (*Storage) NewCommitBatch ¶
func (s *Storage) NewCommitBatch(cc CommitContext) (*CommitBatch, error)
NewCommitBatch creates a batch for commit operations.
func (*Storage) NewScanner ¶
func (s *Storage) NewScanner(opts ...ScanOption) *Scanner
NewScanner creates a scanner for the given key range.
func (*Storage) NewWriteBatch ¶
func (s *Storage) NewWriteBatch() *WriteBatch
NewWriteBatch creates a batch for write operations.
func (*Storage) NextCommitContextOf ¶
func (s *Storage) NextCommitContextOf(cc CommitContext) (next CommitContext, err error)
NextCommitContextOf returns the next commit context after the argument cc if exists.
func (*Storage) Read ¶
func (s *Storage) Read(opts ...ReadOption) (le varlogpb.LogEntry, err error)
Read reads the log entry at the glsn.
func (*Storage) ReadCommitContext ¶ added in v0.5.0
func (s *Storage) ReadCommitContext() (cc CommitContext, err error)
func (*Storage) ReadRecoveryPoints ¶
func (s *Storage) ReadRecoveryPoints() (rp RecoveryPoints, err error)
ReadRecoveryPoints reads data necessary to restore the status of a log stream replica - the first and last log entries and commit context. Incompatible between the boundary of log entries and commit context is okay; thus, it returns nil as err. However, if there is a fatal error, such as missing data in a log entry, it returns an error.
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
WriteBatch is a batch of writes to storage.
func (*WriteBatch) Apply ¶
func (wb *WriteBatch) Apply() error
Apply applies the batch to the underlying storage.