]>
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 TableFileDeletionInfo { | |
11 | private final String dbName; | |
12 | private final String filePath; | |
13 | private final int jobId; | |
14 | private final Status status; | |
15 | ||
16 | /** | |
17 | * Access is package private as this will only be constructed from | |
18 | * C++ via JNI and for testing. | |
19 | */ | |
20 | TableFileDeletionInfo( | |
21 | final String dbName, final String filePath, final int jobId, final Status status) { | |
22 | this.dbName = dbName; | |
23 | this.filePath = filePath; | |
24 | this.jobId = jobId; | |
25 | this.status = status; | |
26 | } | |
27 | ||
28 | /** | |
29 | * Get the name of the database where the file was deleted. | |
30 | * | |
31 | * @return the name of the database. | |
32 | */ | |
33 | public String getDbName() { | |
34 | return dbName; | |
35 | } | |
36 | ||
37 | /** | |
38 | * Get the path to the deleted file. | |
39 | * | |
40 | * @return the path. | |
41 | */ | |
42 | public String getFilePath() { | |
43 | return filePath; | |
44 | } | |
45 | ||
46 | /** | |
47 | * Get the id of the job which deleted the file. | |
48 | * | |
49 | * @return the id of the job. | |
50 | */ | |
51 | public int getJobId() { | |
52 | return jobId; | |
53 | } | |
54 | ||
55 | /** | |
56 | * Get the status indicating whether the deletion 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 | TableFileDeletionInfo that = (TableFileDeletionInfo) o; | |
71 | return jobId == that.jobId && Objects.equals(dbName, that.dbName) | |
72 | && Objects.equals(filePath, that.filePath) && Objects.equals(status, that.status); | |
73 | } | |
74 | ||
75 | @Override | |
76 | public int hashCode() { | |
77 | return Objects.hash(dbName, filePath, jobId, status); | |
78 | } | |
79 | ||
80 | @Override | |
81 | public String toString() { | |
82 | return "TableFileDeletionInfo{" | |
83 | + "dbName='" + dbName + '\'' + ", filePath='" + filePath + '\'' + ", jobId=" + jobId | |
84 | + ", status=" + status + '}'; | |
85 | } | |
86 | } |