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