Lines 65-71
Link Here
|
65 |
|
65 |
|
66 |
/** |
66 |
/** |
67 |
* Index status returned by {@link Index#getStatus(boolean)} method |
67 |
* Index status returned by {@link Index#getStatus(boolean)} method |
68 |
* @since 2.1 |
68 |
* @since 1.5 |
69 |
*/ |
69 |
*/ |
70 |
enum Status { |
70 |
enum Status { |
71 |
/** |
71 |
/** |
Lines 81-104
Link Here
|
81 |
*/ |
81 |
*/ |
82 |
VALID; |
82 |
VALID; |
83 |
} |
83 |
} |
84 |
|
84 |
|
|
|
85 |
public static interface IndexWithStatus extends Index { |
86 |
/** |
87 |
* Checks the validity of the index. The index is invalid when it's broken. |
88 |
* @param tryOpen when true the {@link Index} does exact but more expensive check. |
89 |
* @return {@link Status#INVALID} when the index is broken, {@link Status#EMPTY} |
90 |
* when the index does not exist or {@link Status#VALID} if the index is valid |
91 |
* @throws IOException in case of IO problem |
92 |
* @since 1.5 |
93 |
*/ |
94 |
Status getStatus (boolean tryOpen) throws IOException; |
95 |
} |
96 |
|
85 |
/** |
97 |
/** |
86 |
* An exception thrown by {@link Index} when operation is called on |
98 |
* An exception thrown by {@link Index} when operation is called on |
87 |
* a closed index. |
99 |
* a closed index. |
88 |
*/ |
100 |
*/ |
89 |
public static final class IndexClosedException extends IOException { |
101 |
public static final class IndexClosedException extends IOException { |
90 |
} |
102 |
} |
91 |
|
103 |
|
|
|
104 |
/** |
105 |
* Check if the index already exists |
106 |
* @return true if the index already exists on disk. |
107 |
*/ |
108 |
boolean exists (); |
92 |
|
109 |
|
93 |
/** |
110 |
/** |
94 |
* Checks the validity of the index. The index is invalid when it's broken. |
111 |
* Checks the validity of the index. The index is invalid when it's broken. |
95 |
* @param tryOpen when true the {@link Index} does exact but more expensive check. |
112 |
* @param tryOpen when true the {@link Index} does exact but more expensive check. |
96 |
* @return {@link Status#INVALID} when the index is broken, {@link Status#EMPTY} |
113 |
* @return true when {@link Index} is not broken |
97 |
* when the index does not exist or {@link Status#VALID} if the index is valid |
|
|
98 |
* @throws IOException in case of IO problem |
114 |
* @throws IOException in case of IO problem |
99 |
* @since 2.1 |
|
|
100 |
*/ |
115 |
*/ |
101 |
Status getStatus (boolean tryOpen) throws IOException; |
116 |
boolean isValid (boolean tryOpen) throws IOException; |
102 |
|
117 |
|
103 |
/** |
118 |
/** |
104 |
* Queries the {@link Index} by given queries. |
119 |
* Queries the {@link Index} by given queries. |