import com.github.linushp.rocksdb.linkedlist.RocksLinkedList;
import org.rocksdb.InfoLogLevel;
import org.rocksdb.Options;
import org.rocksdb.RocksDB;
public class TestLinkedList {
public static void main(String [] args) throws Exception {
RocksDB.loadLibrary();
Options options = new Options().setCreateIfMissing(true).setAllowMmapWrites(true);
options.setInfoLogLevel(InfoLogLevel.ERROR_LEVEL);
RocksDB rocksDB = RocksDB.open(options, "./rocksDbData");
byte[] mask = new byte[]{0x10,0x20};
RocksLinkedList linkedList = RocksLinkedList.getInstance(rocksDB,mask);
linkedList.addLast("1".getBytes());
linkedList.addLast("2".getBytes());
linkedList.addLast("3".getBytes());
linkedList.addLast("4".getBytes());
RocksLinkedList linkedList2 = RocksLinkedList.getInstance(rocksDB,mask);
byte[] x = linkedList2.pollFirst();
System.out.println(new String(x));
}
}
-
Notifications
You must be signed in to change notification settings - Fork 2
linushp/rocksdb-utils
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
使用rocksDB实现LinkedList双向链表,可用于本地MQ队列,实现本地MQ等持久化存储。
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published