01: package org.apache.lucene.index;
02:
03: /**
04: * Licensed to the Apache Software Foundation (ASF) under one or more
05: * contributor license agreements. See the NOTICE file distributed with
06: * this work for additional information regarding copyright ownership.
07: * The ASF licenses this file to You under the Apache License, Version 2.0
08: * (the "License"); you may not use this file except in compliance with
09: * the License. You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19:
20: /**
21: * <p>Expert: represents a single commit into an index as seen by the
22: * {@link IndexDeletionPolicy}.
23: * <p>
24: * Changes to the content of an index are made visible only
25: * after the writer who made that change had written to the
26: * directory a new segments file (<code>segments_N</code>). This point in
27: * time, when the action of writing of a new segments file to the
28: * directory is completed, is therefore an index commit point.
29: * <p>
30: * Each index commit point has a unique segments file associated
31: * with it. The segments file associated with a later
32: * index commit point would have a larger N.
33: */
34:
35: import java.util.Collection;
36: import java.io.IOException;
37:
38: public interface IndexCommitPoint {
39:
40: /**
41: * Get the segments file (<code>segments_N</code>) associated
42: * with this commit point.
43: */
44: public String getSegmentsFileName();
45:
46: /**
47: * Returns all index files referenced by this commit point.
48: */
49: public Collection getFileNames() throws IOException;
50:
51: /**
52: * Delete this commit point.
53: * <p>
54: * Upon calling this, the writer is notified that this commit
55: * point should be deleted.
56: * <p>
57: * Decision that a commit-point should be deleted is taken by the {@link IndexDeletionPolicy} in effect
58: * and therefore this should only be called by its {@link IndexDeletionPolicy#onInit onInit()} or
59: * {@link IndexDeletionPolicy#onCommit onCommit()} methods.
60: */
61: public void delete();
62: }
|