摘要:
实现leveldb-api的snapshot接口: public class SnapshotImpl implements Snapshot 在leveldb快照中每次都是用一个序列号保存当前插入的这一条记录,因此当插入多条相同的记录时,通过序列号来确定那一条是最新的记录,在leveldb的快照中 阅读全文
posted @ 2022-07-20 11:49
只能说运气有点好
阅读(48)
评论(0)
推荐(0)
摘要:
实现leveldb-api中的WriteBatch接口:WriteBatch的实现类为WriteBatchImpl public class WriteBatchImpl implements WriteBatch 可以看到WriteBatch中有一个变量为batch用来保存每一次的操作,还有一个变 阅读全文
posted @ 2022-07-19 14:56
只能说运气有点好
阅读(33)
评论(0)
推荐(0)
摘要:
LevelDB使用WriteBatch来替代简单的异步写操作,首先将所有的写操作记录到一个batch中,然后执行同步写,这样同步写的开销就被分摊到多个写操作中,降低同步写入的成本。 public interface WriteBatch extends Closeable { WriteBatch 阅读全文
posted @ 2022-07-19 11:56
只能说运气有点好
阅读(83)
评论(0)
推荐(0)
摘要:
leveldb/WriteOptions.java at master · dain/leveldb · GitHub 定义写操作方式 public class WriteOptions { private boolean sync; private boolean snapshot; public 阅读全文
posted @ 2022-07-19 11:47
只能说运气有点好
阅读(40)
评论(0)
推荐(0)
摘要:
leveldb/Range.java at master · dain/leveldb · GitHub range.java定义key范围start limit public class Range { private final byte[] start; private final byte[ 阅读全文
posted @ 2022-07-19 11:18
只能说运气有点好
阅读(36)
评论(0)
推荐(0)
摘要:
public class ReadOptions { private boolean verifyChecksums; private boolean fillCache = true; private Snapshot snapshot; public Snapshot snapshot() { 阅读全文
posted @ 2022-07-19 11:04
只能说运气有点好
阅读(29)
评论(0)
推荐(0)
摘要:
leveldb/Options.java at master · dain/leveldb · GitHub 判断Argment是否为null: static void checkArgNotNull(Object value, String name) { if (value == null) { 阅读全文
posted @ 2022-07-18 17:39
只能说运气有点好
阅读(42)
评论(0)
推荐(0)
摘要:
DB迭代器:继承closeable接口 public interface DBIterator extends Iterator<Map.Entry<byte[], byte[]>>, Closeable { /** * Repositions the iterator so the key of 阅读全文
posted @ 2022-07-18 17:17
只能说运气有点好
阅读(76)
评论(0)
推荐(0)
摘要:
定义DB工厂类:open,destroy,repair public interface DBFactory { DB open(File path, Options options) throws IOException; void destroy(File path, Options optio 阅读全文
posted @ 2022-07-18 16:39
只能说运气有点好
阅读(22)
评论(0)
推荐(0)
摘要:
leveldb/DBComparator.java at master · dain/leveldb · GitHub 定义比较器:继承comparator接口 public interface DBComparator extends Comparator<byte[]> { String nam 阅读全文
posted @ 2022-07-18 16:35
只能说运气有点好
阅读(49)
评论(0)
推荐(0)
浙公网安备 33010602011771号