Documentation ¶
Index ¶
- Constants
- func GetVersionedPathForDb(log logger.Logger, dirPath string, dbName string, currentDbVersion uint64) (versionedDirPath string, err error)
- func LeveldbOptions(sizeGetter DbWriteBufferSizeGetter) *opt.Options
- type CountMeter
- func (m *CountMeter) Count() int64
- func (m *CountMeter) Mark(i int64)
- func (m *CountMeter) Rate1() float64
- func (m *CountMeter) Rate15() float64
- func (m *CountMeter) Rate5() float64
- func (m *CountMeter) RateMean() float64
- func (m *CountMeter) Shutdown() <-chan struct{}
- func (m *CountMeter) Snapshot() metrics.Meter
- type DbWriteBufferSizeGetter
- type LevelDb
- func (ldb *LevelDb) Close() (err error)
- func (ldb *LevelDb) Get(key []byte, ro *opt.ReadOptions) (value []byte, err error)
- func (ldb *LevelDb) GetWithMeter(key []byte, hitMeter, missMeter *CountMeter) (value []byte, err error)
- func (ldb *LevelDb) Put(key, value []byte, wo *opt.WriteOptions) (err error)
- func (ldb *LevelDb) PutWithMeter(key, value []byte, putMeter *CountMeter) (err error)
- func (ldb *LevelDb) StatStrings() ([]string, error)
- type MeterSnapshot
- type MeterStatus
Constants ¶
const ( // Metered specified that this DB should be metered. Metered = true // Unmetered specified that this DB should not be metered. Unmetered = false )
Variables ¶
This section is empty.
Functions ¶
func GetVersionedPathForDb ¶
func GetVersionedPathForDb( log logger.Logger, dirPath string, dbName string, currentDbVersion uint64) (versionedDirPath string, err error)
GetVersionedPathForDb returns a path for the db that includes a version number.
func LeveldbOptions ¶
func LeveldbOptions(sizeGetter DbWriteBufferSizeGetter) *opt.Options
LeveldbOptions returns leveldb options.
Types ¶
type CountMeter ¶
type CountMeter struct {
// contains filtered or unexported fields
}
CountMeter counts ticks with a sliding window into the past.
func (*CountMeter) Rate1 ¶
func (m *CountMeter) Rate1() float64
Rate1 returns the number of ticks in the last 1 minute.
func (*CountMeter) Rate15 ¶
func (m *CountMeter) Rate15() float64
Rate15 returns the number of ticks in the last 15 minutes.
func (*CountMeter) Rate5 ¶
func (m *CountMeter) Rate5() float64
Rate5 returns the number of ticks in the last 5 minutes.
func (*CountMeter) RateMean ¶
func (m *CountMeter) RateMean() float64
RateMean returns the overall count of ticks.
func (*CountMeter) Shutdown ¶
func (m *CountMeter) Shutdown() <-chan struct{}
Shutdown shuts down this CountMeter.
func (*CountMeter) Snapshot ¶
func (m *CountMeter) Snapshot() metrics.Meter
Snapshot returns the snapshot in time of this CountMeter.
type DbWriteBufferSizeGetter ¶
type DbWriteBufferSizeGetter interface { // DbWriteBufferSize indicates how large the write buffer should // be on local levelDbs -- this also controls how big the on-disk // tables are before compaction. DbWriteBufferSize() int }
DbWriteBufferSizeGetter is an interface that contains a method for getting the size of a leveldb write buffer.
type LevelDb ¶
LevelDb is a libkbfs wrapper for leveldb.DB.
func OpenLevelDb ¶
func OpenLevelDb( stor storage.Storage, sizeGetter DbWriteBufferSizeGetter) ( *LevelDb, error)
OpenLevelDb opens or recovers a leveldb.DB with a passed-in storage.Storage as its underlying storage layer.
func OpenLevelDbWithOptions ¶
OpenLevelDbWithOptions opens or recovers a leveldb.DB with a passed-in storage.Storage as its underlying storage layer, and with the options specified.
func OpenVersionedLevelDb ¶
func OpenVersionedLevelDb( log logger.Logger, storageRoot string, dbFolderName string, currentDbVersion uint64, dbFilename string, sizeGetter DbWriteBufferSizeGetter) (db *LevelDb, err error)
OpenVersionedLevelDb opens a level DB under a versioned path on the local filesystem under storageRoot. The path include dbFolderName and dbFilename. Note that dbFilename is actually created as a folder; it's just where raw LevelDb lives.
func (*LevelDb) GetWithMeter ¶
func (ldb *LevelDb) GetWithMeter(key []byte, hitMeter, missMeter *CountMeter) ( value []byte, err error)
GetWithMeter gets data from the DB while tracking the hit rate.
func (*LevelDb) Put ¶
func (ldb *LevelDb) Put(key, value []byte, wo *opt.WriteOptions) (err error)
Put puts data into the DB.
func (*LevelDb) PutWithMeter ¶
func (ldb *LevelDb) PutWithMeter(key, value []byte, putMeter *CountMeter) ( err error)
PutWithMeter gets data from the DB while tracking the hit rate.
func (*LevelDb) StatStrings ¶
StatStrings returns newline-split leveldb stats, suitable for JSONification.
type MeterSnapshot ¶
type MeterSnapshot struct {
// contains filtered or unexported fields
}
MeterSnapshot is a read-only copy of another Meter.
func (*MeterSnapshot) Count ¶
func (m *MeterSnapshot) Count() int64
Count returns the count of events at the time the snapshot was taken.
func (*MeterSnapshot) Rate1 ¶
func (m *MeterSnapshot) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) Rate15 ¶
func (m *MeterSnapshot) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) Rate5 ¶
func (m *MeterSnapshot) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) RateMean ¶
func (m *MeterSnapshot) RateMean() float64
RateMean returns the meter's mean rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) Snapshot ¶
func (m *MeterSnapshot) Snapshot() metrics.Meter
Snapshot returns the snapshot.
type MeterStatus ¶
MeterStatus represents the status of a rate meter.
func RateMeterToStatus ¶
func RateMeterToStatus(m metrics.Meter) MeterStatus
RateMeterToStatus returns the status for a meter.