]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/TableProperties.java
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / TableProperties.java
1 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2 package org.rocksdb;
3
4 import java.util.Map;
5
6 /**
7 * TableProperties contains read-only properties of its associated
8 * table.
9 */
10 public class TableProperties {
11 private final long dataSize;
12 private final long indexSize;
13 private final long indexPartitions;
14 private final long topLevelIndexSize;
15 private final long indexKeyIsUserKey;
16 private final long indexValueIsDeltaEncoded;
17 private final long filterSize;
18 private final long rawKeySize;
19 private final long rawValueSize;
20 private final long numDataBlocks;
21 private final long numEntries;
22 private final long numDeletions;
23 private final long numMergeOperands;
24 private final long numRangeDeletions;
25 private final long formatVersion;
26 private final long fixedKeyLen;
27 private final long columnFamilyId;
28 private final long creationTime;
29 private final long oldestKeyTime;
30 private final byte[] columnFamilyName;
31 private final String filterPolicyName;
32 private final String comparatorName;
33 private final String mergeOperatorName;
34 private final String prefixExtractorName;
35 private final String propertyCollectorsNames;
36 private final String compressionName;
37 private final Map<String, String> userCollectedProperties;
38 private final Map<String, String> readableProperties;
39 private final Map<String, Long> propertiesOffsets;
40
41 /**
42 * Access is private as this will only be constructed from
43 * C++ via JNI.
44 */
45 private TableProperties(final long dataSize, final long indexSize,
46 final long indexPartitions, final long topLevelIndexSize,
47 final long indexKeyIsUserKey, final long indexValueIsDeltaEncoded,
48 final long filterSize, final long rawKeySize, final long rawValueSize,
49 final long numDataBlocks, final long numEntries, final long numDeletions,
50 final long numMergeOperands, final long numRangeDeletions,
51 final long formatVersion, final long fixedKeyLen,
52 final long columnFamilyId, final long creationTime,
53 final long oldestKeyTime, final byte[] columnFamilyName,
54 final String filterPolicyName, final String comparatorName,
55 final String mergeOperatorName, final String prefixExtractorName,
56 final String propertyCollectorsNames, final String compressionName,
57 final Map<String, String> userCollectedProperties,
58 final Map<String, String> readableProperties,
59 final Map<String, Long> propertiesOffsets) {
60 this.dataSize = dataSize;
61 this.indexSize = indexSize;
62 this.indexPartitions = indexPartitions;
63 this.topLevelIndexSize = topLevelIndexSize;
64 this.indexKeyIsUserKey = indexKeyIsUserKey;
65 this.indexValueIsDeltaEncoded = indexValueIsDeltaEncoded;
66 this.filterSize = filterSize;
67 this.rawKeySize = rawKeySize;
68 this.rawValueSize = rawValueSize;
69 this.numDataBlocks = numDataBlocks;
70 this.numEntries = numEntries;
71 this.numDeletions = numDeletions;
72 this.numMergeOperands = numMergeOperands;
73 this.numRangeDeletions = numRangeDeletions;
74 this.formatVersion = formatVersion;
75 this.fixedKeyLen = fixedKeyLen;
76 this.columnFamilyId = columnFamilyId;
77 this.creationTime = creationTime;
78 this.oldestKeyTime = oldestKeyTime;
79 this.columnFamilyName = columnFamilyName;
80 this.filterPolicyName = filterPolicyName;
81 this.comparatorName = comparatorName;
82 this.mergeOperatorName = mergeOperatorName;
83 this.prefixExtractorName = prefixExtractorName;
84 this.propertyCollectorsNames = propertyCollectorsNames;
85 this.compressionName = compressionName;
86 this.userCollectedProperties = userCollectedProperties;
87 this.readableProperties = readableProperties;
88 this.propertiesOffsets = propertiesOffsets;
89 }
90
91 /**
92 * Get the total size of all data blocks.
93 *
94 * @return the total size of all data blocks.
95 */
96 public long getDataSize() {
97 return dataSize;
98 }
99
100 /**
101 * Get the size of index block.
102 *
103 * @return the size of index block.
104 */
105 public long getIndexSize() {
106 return indexSize;
107 }
108
109 /**
110 * Get the total number of index partitions
111 * if {@link IndexType#kTwoLevelIndexSearch} is used.
112 *
113 * @return the total number of index partitions.
114 */
115 public long getIndexPartitions() {
116 return indexPartitions;
117 }
118
119 /**
120 * Size of the top-level index
121 * if {@link IndexType#kTwoLevelIndexSearch} is used.
122 *
123 * @return the size of the top-level index.
124 */
125 public long getTopLevelIndexSize() {
126 return topLevelIndexSize;
127 }
128
129 /**
130 * Whether the index key is user key.
131 * Otherwise it includes 8 byte of sequence
132 * number added by internal key format.
133 *
134 * @return the index key
135 */
136 public long getIndexKeyIsUserKey() {
137 return indexKeyIsUserKey;
138 }
139
140 /**
141 * Whether delta encoding is used to encode the index values.
142 *
143 * @return whether delta encoding is used to encode the index values.
144 */
145 public long getIndexValueIsDeltaEncoded() {
146 return indexValueIsDeltaEncoded;
147 }
148
149 /**
150 * Get the size of filter block.
151 *
152 * @return the size of filter block.
153 */
154 public long getFilterSize() {
155 return filterSize;
156 }
157
158 /**
159 * Get the total raw key size.
160 *
161 * @return the total raw key size.
162 */
163 public long getRawKeySize() {
164 return rawKeySize;
165 }
166
167 /**
168 * Get the total raw value size.
169 *
170 * @return the total raw value size.
171 */
172 public long getRawValueSize() {
173 return rawValueSize;
174 }
175
176 /**
177 * Get the number of blocks in this table.
178 *
179 * @return the number of blocks in this table.
180 */
181 public long getNumDataBlocks() {
182 return numDataBlocks;
183 }
184
185 /**
186 * Get the number of entries in this table.
187 *
188 * @return the number of entries in this table.
189 */
190 public long getNumEntries() {
191 return numEntries;
192 }
193
194 /**
195 * Get the number of deletions in the table.
196 *
197 * @return the number of deletions in the table.
198 */
199 public long getNumDeletions() {
200 return numDeletions;
201 }
202
203 /**
204 * Get the number of merge operands in the table.
205 *
206 * @return the number of merge operands in the table.
207 */
208 public long getNumMergeOperands() {
209 return numMergeOperands;
210 }
211
212 /**
213 * Get the number of range deletions in this table.
214 *
215 * @return the number of range deletions in this table.
216 */
217 public long getNumRangeDeletions() {
218 return numRangeDeletions;
219 }
220
221 /**
222 * Get the format version, reserved for backward compatibility.
223 *
224 * @return the format version.
225 */
226 public long getFormatVersion() {
227 return formatVersion;
228 }
229
230 /**
231 * Get the length of the keys.
232 *
233 * @return 0 when the key is variable length, otherwise number of
234 * bytes for each key.
235 */
236 public long getFixedKeyLen() {
237 return fixedKeyLen;
238 }
239
240 /**
241 * Get the ID of column family for this SST file,
242 * corresponding to the column family identified by
243 * {@link #getColumnFamilyName()}.
244 *
245 * @return the id of the column family.
246 */
247 public long getColumnFamilyId() {
248 return columnFamilyId;
249 }
250
251 /**
252 * The time when the SST file was created.
253 * Since SST files are immutable, this is equivalent
254 * to last modified time.
255 *
256 * @return the created time.
257 */
258 public long getCreationTime() {
259 return creationTime;
260 }
261
262 /**
263 * Get the timestamp of the earliest key.
264 *
265 * @return 0 means unknown, otherwise the timestamp.
266 */
267 public long getOldestKeyTime() {
268 return oldestKeyTime;
269 }
270
271 /**
272 * Get the name of the column family with which this
273 * SST file is associated.
274 *
275 * @return the name of the column family, or null if the
276 * column family is unknown.
277 */
278 /*@Nullable*/ public byte[] getColumnFamilyName() {
279 return columnFamilyName;
280 }
281
282 /**
283 * Get the name of the filter policy used in this table.
284 *
285 * @return the name of the filter policy, or null if
286 * no filter policy is used.
287 */
288 /*@Nullable*/ public String getFilterPolicyName() {
289 return filterPolicyName;
290 }
291
292 /**
293 * Get the name of the comparator used in this table.
294 *
295 * @return the name of the comparator.
296 */
297 public String getComparatorName() {
298 return comparatorName;
299 }
300
301 /**
302 * Get the name of the merge operator used in this table.
303 *
304 * @return the name of the merge operator, or null if no merge operator
305 * is used.
306 */
307 /*@Nullable*/ public String getMergeOperatorName() {
308 return mergeOperatorName;
309 }
310
311 /**
312 * Get the name of the prefix extractor used in this table.
313 *
314 * @return the name of the prefix extractor, or null if no prefix
315 * extractor is used.
316 */
317 /*@Nullable*/ public String getPrefixExtractorName() {
318 return prefixExtractorName;
319 }
320
321 /**
322 * Get the names of the property collectors factories used in this table.
323 *
324 * @return the names of the property collector factories separated
325 * by commas, e.g. {collector_name[1]},{collector_name[2]},...
326 */
327 public String getPropertyCollectorsNames() {
328 return propertyCollectorsNames;
329 }
330
331 /**
332 * Get the name of the compression algorithm used to compress the SST files.
333 *
334 * @return the name of the compression algorithm.
335 */
336 public String getCompressionName() {
337 return compressionName;
338 }
339
340 /**
341 * Get the user collected properties.
342 *
343 * @return the user collected properties.
344 */
345 public Map<String, String> getUserCollectedProperties() {
346 return userCollectedProperties;
347 }
348
349 /**
350 * Get the readable properties.
351 *
352 * @return the readable properties.
353 */
354 public Map<String, String> getReadableProperties() {
355 return readableProperties;
356 }
357
358 /**
359 * The offset of the value of each property in the file.
360 *
361 * @return the offset of each property.
362 */
363 public Map<String, Long> getPropertiesOffsets() {
364 return propertiesOffsets;
365 }
366 }