leveld-api:(6)Options
leveldb/Options.java at master · dain/leveldb · GitHub
判断Argment是否为null:
static void checkArgNotNull(Object value, String name) { if (value == null) { throw new IllegalArgumentException("The " + name + " argument cannot be null"); } }
createIfMissing:数据库打开时,若数据库丢失则重新创建一份
public boolean createIfMissing() { return createIfMissing; } public Options createIfMissing(boolean createIfMissing) { this.createIfMissing = createIfMissing; return this; }
errorIfexists:数据库打开时如果是true则报错
public boolean errorIfExists() { return errorIfExists; } public Options errorIfExists(boolean errorIfExists) { this.errorIfExists = errorIfExists; return this; }
writeBufferSize:memetable的大小超过writebuffersize时,转为immemtable
public int writeBufferSize() { return writeBufferSize; } public Options writeBufferSize(int writeBufferSize) { this.writeBufferSize = writeBufferSize; return this; }
maxOpenFile:DB可打开的最大文件数
public int maxOpenFiles() { return maxOpenFiles; } public Options maxOpenFiles(int maxOpenFiles) { this.maxOpenFiles = maxOpenFiles; return this; }
blockRestartInterval: block重启点之间的key的个数
public int blockRestartInterval() { return blockRestartInterval; } public Options blockRestartInterval(int blockRestartInterval) { this.blockRestartInterval = blockRestartInterval; return this; }
blockSize:每一个block大小,指压缩数据大小
public int blockSize() { return blockSize; } public Options blockSize(int blockSize) { this.blockSize = blockSize; return this; }
CompressionType:压缩block的方式
public CompressionType compressionType() { return compressionType; } public Options compressionType(CompressionType compressionType) { checkArgNotNull(compressionType, "compressionType"); this.compressionType = compressionType; return this; }
verifChecksums:所有读取数据都会校验
public boolean verifyChecksums() { return verifyChecksums; } public Options verifyChecksums(boolean verifyChecksums) { this.verifyChecksums = verifyChecksums; return this; }
cacheSize:缓存大小
public long cacheSize() { return cacheSize; } public Options cacheSize(long cacheSize) { this.cacheSize = cacheSize; return this; }
DBcomparator:
public DBComparator comparator() { return comparator; } public Options comparator(DBComparator comparator) { this.comparator = comparator; return this; }
logger:db产生的处理和错误日志写入指定文件,若为空,则在同一个目录中创建一个文件写入db
public Logger logger() { return logger; } public Options logger(Logger logger) { this.logger = logger; return this; }
paranoidchecks:如果为true,数据处理过程会严格检查数据,检查到任何数据都会提前停止
public boolean paranoidChecks() { return paranoidChecks; } public Options paranoidChecks(boolean paranoidChecks) { this.paranoidChecks = paranoidChecks; return this; }
浙公网安备 33010602011771号