]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | // This source code is licensed under both the GPLv2 (found in the | |
3 | // COPYING file in the root directory) and Apache 2.0 License | |
4 | // (found in the LICENSE.Apache file in the root directory). | |
5 | ||
6 | package org.rocksdb; | |
7 | ||
8 | import java.util.Objects; | |
9 | ||
10 | public class TableFileCreationInfo extends TableFileCreationBriefInfo { | |
11 | private final long fileSize; | |
12 | private final TableProperties tableProperties; | |
13 | private final Status status; | |
14 | ||
15 | /** | |
16 | * Access is protected as this will only be constructed from | |
17 | * C++ via JNI. | |
18 | * | |
19 | * @param fileSize the size of the table file | |
20 | * @param tableProperties the properties of the table file | |
21 | * @param status the status of the creation operation | |
22 | * @param dbName the database name | |
23 | * @param columnFamilyName the column family name | |
24 | * @param filePath the path to the table file | |
25 | * @param jobId the job identifier | |
26 | * @param tableFileCreationReasonValue the reason for creation of the table file | |
27 | */ | |
28 | protected TableFileCreationInfo(final long fileSize, final TableProperties tableProperties, | |
29 | final Status status, final String dbName, final String columnFamilyName, | |
30 | final String filePath, final int jobId, final byte tableFileCreationReasonValue) { | |
31 | super(dbName, columnFamilyName, filePath, jobId, tableFileCreationReasonValue); | |
32 | this.fileSize = fileSize; | |
33 | this.tableProperties = tableProperties; | |
34 | this.status = status; | |
35 | } | |
36 | ||
37 | /** | |
38 | * Get the size of the file. | |
39 | * | |
40 | * @return the size. | |
41 | */ | |
42 | public long getFileSize() { | |
43 | return fileSize; | |
44 | } | |
45 | ||
46 | /** | |
47 | * Get the detailed properties of the created file. | |
48 | * | |
49 | * @return the properties. | |
50 | */ | |
51 | public TableProperties getTableProperties() { | |
52 | return tableProperties; | |
53 | } | |
54 | ||
55 | /** | |
56 | * Get the status indicating whether the creation was successful or not. | |
57 | * | |
58 | * @return the status. | |
59 | */ | |
60 | public Status getStatus() { | |
61 | return status; | |
62 | } | |
63 | ||
64 | @Override | |
65 | public boolean equals(Object o) { | |
66 | if (this == o) | |
67 | return true; | |
68 | if (o == null || getClass() != o.getClass()) | |
69 | return false; | |
70 | TableFileCreationInfo that = (TableFileCreationInfo) o; | |
71 | return fileSize == that.fileSize && Objects.equals(tableProperties, that.tableProperties) | |
72 | && Objects.equals(status, that.status); | |
73 | } | |
74 | ||
75 | @Override | |
76 | public int hashCode() { | |
77 | return Objects.hash(fileSize, tableProperties, status); | |
78 | } | |
79 | ||
80 | @Override | |
81 | public String toString() { | |
82 | return "TableFileCreationInfo{" | |
83 | + "fileSize=" + fileSize + ", tableProperties=" + tableProperties + ", status=" + status | |
84 | + '}'; | |
85 | } | |
86 | } |