(final String[] args)
| 18 | } |
| 19 | |
| 20 | public static void main(final String[] args) { |
| 21 | if (args.length < 1) { |
| 22 | System.out.println("usage: RocksDBSample db_path"); |
| 23 | System.exit(-1); |
| 24 | } |
| 25 | |
| 26 | final String db_path = args[0]; |
| 27 | final String db_path_not_found = db_path + "_not_found"; |
| 28 | |
| 29 | System.out.println("RocksDBSample"); |
| 30 | try (final Options options = new Options(); |
| 31 | final Filter bloomFilter = new BloomFilter(10); |
| 32 | final ReadOptions readOptions = new ReadOptions() |
| 33 | .setFillCache(false); |
| 34 | final Statistics stats = new Statistics(); |
| 35 | final RateLimiter rateLimiter = new RateLimiter(10000000,10000, 10)) { |
| 36 | |
| 37 | try (final RocksDB db = RocksDB.open(options, db_path_not_found)) { |
| 38 | assert (false); |
| 39 | } catch (final RocksDBException e) { |
| 40 | System.out.format("Caught the expected exception -- %s\n", e); |
| 41 | } |
| 42 | |
| 43 | try { |
| 44 | options.setCreateIfMissing(true) |
| 45 | .setStatistics(stats) |
| 46 | .setWriteBufferSize(8 * SizeUnit.KB) |
| 47 | .setMaxWriteBufferNumber(3) |
| 48 | .setMaxBackgroundCompactions(10) |
| 49 | .setCompressionType(CompressionType.SNAPPY_COMPRESSION) |
| 50 | .setCompactionStyle(CompactionStyle.UNIVERSAL); |
| 51 | } catch (final IllegalArgumentException e) { |
| 52 | assert (false); |
| 53 | } |
| 54 | |
| 55 | assert (options.createIfMissing() == true); |
| 56 | assert (options.writeBufferSize() == 8 * SizeUnit.KB); |
| 57 | assert (options.maxWriteBufferNumber() == 3); |
| 58 | assert (options.maxBackgroundCompactions() == 10); |
| 59 | assert (options.compressionType() == CompressionType.SNAPPY_COMPRESSION); |
| 60 | assert (options.compactionStyle() == CompactionStyle.UNIVERSAL); |
| 61 | |
| 62 | assert (options.memTableFactoryName().equals("SkipListFactory")); |
| 63 | options.setMemTableConfig( |
| 64 | new HashSkipListMemTableConfig() |
| 65 | .setHeight(4) |
| 66 | .setBranchingFactor(4) |
| 67 | .setBucketCount(2000000)); |
| 68 | assert (options.memTableFactoryName().equals("HashSkipListRepFactory")); |
| 69 | |
| 70 | options.setMemTableConfig( |
| 71 | new HashLinkedListMemTableConfig() |
| 72 | .setBucketCount(100000)); |
| 73 | assert (options.memTableFactoryName().equals("HashLinkedListRepFactory")); |
| 74 | |
| 75 | options.setMemTableConfig( |
| 76 | new VectorMemTableConfig().setReservedSize(10000)); |
| 77 | assert (options.memTableFactoryName().equals("VectorRepFactory")); |
nothing calls this directly
no test coverage detected