]>
Commit | Line | Data |
---|---|---|
f67539c2 | 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. |
7c673cae FG |
2 | package org.rocksdb; |
3 | ||
4 | /** | |
5 | * The config for vector memtable representation. | |
6 | */ | |
7 | public class VectorMemTableConfig extends MemTableConfig { | |
8 | public static final int DEFAULT_RESERVED_SIZE = 0; | |
9 | ||
10 | /** | |
11 | * VectorMemTableConfig constructor | |
12 | */ | |
13 | public VectorMemTableConfig() { | |
14 | reservedSize_ = DEFAULT_RESERVED_SIZE; | |
15 | } | |
16 | ||
17 | /** | |
18 | * Set the initial size of the vector that will be used | |
19 | * by the memtable created based on this config. | |
20 | * | |
21 | * @param size the initial size of the vector. | |
22 | * @return the reference to the current config. | |
23 | */ | |
24 | public VectorMemTableConfig setReservedSize(final int size) { | |
25 | reservedSize_ = size; | |
26 | return this; | |
27 | } | |
28 | ||
29 | /** | |
30 | * Returns the initial size of the vector used by the memtable | |
31 | * created based on this config. | |
32 | * | |
33 | * @return the initial size of the vector. | |
34 | */ | |
35 | public int reservedSize() { | |
36 | return reservedSize_; | |
37 | } | |
38 | ||
39 | @Override protected long newMemTableFactoryHandle() { | |
40 | return newMemTableFactoryHandle(reservedSize_); | |
41 | } | |
42 | ||
43 | private native long newMemTableFactoryHandle(long reservedSize) | |
44 | throws IllegalArgumentException; | |
45 | private int reservedSize_; | |
46 | } |