Documentation
¶
Index ¶
- Variables
- func EncodeTSO(ts int64) uint64
- func InitMetircs(registry *prometheus.Registry)
- type Append
- func (a *Append) AllMatched() bool
- func (a *Append) Close() error
- func (a *Append) GC(ts int64)
- func (a *Append) GetBinlog(ts int64) (*pb.Binlog, error)
- func (a *Append) GetGCTS() int64
- func (a *Append) MaxCommitTS() int64
- func (a *Append) PullCommitBinlog(ctx context.Context, last int64) <-chan *pb.Entity
- func (a *Append) WriteBinlog(binlog *pb.Binlog) error
- type Config
- type Helper
- type HumanizeBytes
- type KVConfig
- type Options
- func (o *Options) WithKVChanCapacity(capacity int) *Options
- func (o *Options) WithKVConfig(kvConfig *KVConfig) *Options
- func (o *Options) WithSlowWriteThreshold(threshold float64) *Options
- func (o *Options) WithStopWriteAtAvailableSpace(bytes uint64) *Options
- func (o *Options) WithSync(sync bool) *Options
- func (o *Options) WithValueLogFileSize(size int64) *Options
- type Record
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWrongMagic means the magic number mismatch ErrWrongMagic = errors.New("wrong magic") )
Functions ¶
func EncodeTSO ¶
EncodeTSO encodes a millisecond into tso. TODO: Use the function defined in github.com/tikv/client-go/v2.
func InitMetircs ¶
func InitMetircs(registry *prometheus.Registry)
InitMetircs register the metrics to registry
Types ¶
type Append ¶
type Append struct {
// contains filtered or unexported fields
}
Append implement the Storage interface
func NewAppendWithResolver ¶
func NewAppendWithResolver(dir string, options *Options, tiStore kv.Storage, tiLockResolver *txnlock.LockResolver) (append *Append, err error)
NewAppendWithResolver returns a instance of Append if tiStore and tiLockResolver is not nil, we will try to query tikv to know whether a txn is committed
func (*Append) AllMatched ¶
AllMatched implement Storage.AllMatched
func (*Append) MaxCommitTS ¶
MaxCommitTS implement Storage.MaxCommitTS
func (*Append) PullCommitBinlog ¶
PullCommitBinlog return commit binlog > last
type Config ¶
type Config struct {
SyncLog *bool `toml:"sync-log" json:"sync-log"`
// the channel to buffer binlog meta, pump will block write binlog request if the channel is full
KVChanCapacity int `toml:"kv_chan_cap" json:"kv_chan_cap"`
SlowWriteThreshold float64 `toml:"slow_write_threshold" json:"slow_write_threshold"`
KV *KVConfig `toml:"kv" json:"kv"`
StopWriteAtAvailableSpace *HumanizeBytes `toml:"stop-write-at-available-space" json:"stop-write-at-available-space"`
}
Config holds the configuration of storage
func (*Config) GetKVChanCapacity ¶
GetKVChanCapacity return kv_chan_cap config option
func (*Config) GetSlowWriteThreshold ¶
GetSlowWriteThreshold return slow write threshold
func (*Config) GetStopWriteAtAvailableSpace ¶
GetStopWriteAtAvailableSpace return stop write available space
func (*Config) GetSyncLog ¶
GetSyncLog return sync-log config option
type Helper ¶
type Helper struct {
Store tikv.Storage
RegionCache *tikv.RegionCache
}
Helper is a middleware to get some information from tikv/pd.
func (*Helper) GetMvccByEncodedKey ¶
GetMvccByEncodedKey get the MVCC value by the specific encoded key.
type HumanizeBytes ¶
type HumanizeBytes uint64
HumanizeBytes is used for humanize configure
func (*HumanizeBytes) UnmarshalText ¶
func (b *HumanizeBytes) UnmarshalText(text []byte) error
UnmarshalText implements UnmarshalText
type KVConfig ¶
type KVConfig struct {
BlockCacheCapacity int `toml:"block-cache-capacity" json:"block-cache-capacity"`
BlockRestartInterval int `toml:"block-restart-interval" json:"block-restart-interval"`
BlockSize int `toml:"block-size" json:"block-size"`
CompactionL0Trigger int `toml:"compaction-L0-trigger" json:"compaction-L0-trigger"`
CompactionTableSize int `toml:"compaction-table-size" json:"compaction-table-size"`
CompactionTotalSize int `toml:"compaction-total-size" json:"compaction-total-size"`
CompactionTotalSizeMultiplier float64 `toml:"compaction-total-size-multiplier" json:"compaction-total-size-multiplier"`
WriteBuffer int `toml:"write-buffer" json:"write-buffer"`
WriteL0PauseTrigger int `toml:"write-L0-pause-trigger" json:"write-L0-pause-trigger"`
WriteL0SlowdownTrigger int `toml:"write-L0-slowdown-trigger" json:"write-L0-slowdown-trigger"`
}
KVConfig if the configuration of goleveldb
type Options ¶
type Options struct {
ValueLogFileSize int64
Sync bool
KVChanCapacity int
SlowWriteThreshold float64
StopWriteAtAvailableSpace uint64
KVConfig *KVConfig
}
Options is the config options of Append and vlog
func (*Options) WithKVChanCapacity ¶
WithKVChanCapacity set the ChanCapacity
func (*Options) WithKVConfig ¶
WithKVConfig set the Config
func (*Options) WithSlowWriteThreshold ¶
WithSlowWriteThreshold set the Config
func (*Options) WithStopWriteAtAvailableSpace ¶
WithStopWriteAtAvailableSpace set the Config
func (*Options) WithValueLogFileSize ¶
WithValueLogFileSize set the ValueLogFileSize
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Record is the format in the log file
type Storage ¶
type Storage interface {
WriteBinlog(binlog *pb.Binlog) error
// delete <= ts
GC(ts int64)
GetGCTS() int64
// AllMatched return if all the P-binlog have the matching C-binlog
AllMatched() bool
MaxCommitTS() int64
// GetBinlog return the binlog of ts
GetBinlog(ts int64) (binlog *pb.Binlog, err error)
// PullCommitBinlog return the chan to consume the binlog
PullCommitBinlog(ctx context.Context, last int64) <-chan *pb.Entity
Close() error
}
Storage is the interface to handle binlog storage