public class LevelDBBucket extends Object implements Serializable
| 限定符和类型 | 类和说明 |
|---|---|
static class |
LevelDBBucket.Builder
构造LevelDBBucket
|
static class |
LevelDBBucket.Profile
bucket配置信息
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected static String |
buildBucketKey(String id) |
protected static String |
buildBucketPageCount(String id) |
protected String |
buildPageId(String pageNo) |
protected String |
buildReadPageNoKey() |
int |
capacity()
max capacity of bucket
|
int |
count()
获取total count of bucket
|
LevelDBPage |
getCurrentPage() |
org.iq80.leveldb.DB |
getDb() |
String |
getId() |
int |
getMaxCapacityOfPage() |
int |
getMaxCountOfPage() |
int |
getPageCount() |
LevelDBPage |
getPageInner(int pageId)
这个方法会判断openCache是否开启,如果开启了,则从pageCach中获取
|
String |
getQueueName() |
boolean |
isFull() |
boolean |
isOpenCache() |
void |
iterateIndex(IndexIterator iterator)
遍历整个bucket中的page数据,并将每页中的index,传递到iterator中
|
void |
open()
开启bucket
|
String |
pop(org.iq80.leveldb.WriteBatch wb)
根据page中的index值取出索引数据,并删除page中的索引数据
|
List<String> |
pop(org.iq80.leveldb.WriteBatch wb,
int count)
弹出索引数据,并删除page中的索引数据
|
String |
popByIndex(org.iq80.leveldb.WriteBatch wb,
String index)
根据page中的index进行索引弹出,这个必须要开启openCache才能使用这个功能
|
Integer |
savePageIndex(org.iq80.leveldb.WriteBatch wb,
String index)
将page页的一条索引值插入到bucket的当前页中,如果当前页满了,则需要查找到空闲的一张页面,如果空闲页面也找不到,那么就扩展一张新的页。
|
void |
saveReadPageNo(org.iq80.leveldb.WriteBatch wb,
Integer pageNo) |
void |
setMaxCountOfPage(int maxCountOfPage) |
protected String |
wrapperKey(String key) |
public void open()
throws IOException
IOExceptionpublic String popByIndex(org.iq80.leveldb.WriteBatch wb, String index) throws IllegalAccessException, IOException
wb - index - IllegalAccessException - if openCache didn't open, it would be thrownIOExceptionpublic String pop(org.iq80.leveldb.WriteBatch wb) throws IOException
IOExceptionpublic List<String> pop(org.iq80.leveldb.WriteBatch wb, int count) throws IOException
count - IOExceptionpublic Integer savePageIndex(org.iq80.leveldb.WriteBatch wb, String index) throws BucketFullException, IOException
index - BucketFullExceptionIOExceptionpublic void saveReadPageNo(org.iq80.leveldb.WriteBatch wb,
Integer pageNo)
throws IOException
IOExceptionpublic LevelDBPage getCurrentPage()
public boolean isFull()
public int count()
public int capacity()
public LevelDBPage getPageInner(int pageId) throws IOException
pageId - IOExceptionpublic void iterateIndex(IndexIterator iterator) throws IOException
iterator - IOExceptionprotected String buildReadPageNoKey()
public org.iq80.leveldb.DB getDb()
public boolean isOpenCache()
public String getQueueName()
public int getMaxCountOfPage()
public void setMaxCountOfPage(int maxCountOfPage)
public int getMaxCapacityOfPage()
public int getPageCount()
public String getId()
Copyright © 2018 Jue Ming. All rights reserved.