View Javadoc

1   /*
2    *   Licensed to the Apache Software Foundation (ASF) under one
3    *   or more contributor license agreements.  See the NOTICE file
4    *   distributed with this work for additional information
5    *   regarding copyright ownership.  The ASF licenses this file
6    *   to you under the Apache License, Version 2.0 (the
7    *   "License"); you may not use this file except in compliance
8    *   with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing,
13   *   software distributed under the License is distributed on an
14   *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *   KIND, either express or implied.  See the License for the
16   *   specific language governing permissions and limitations
17   *   under the License.
18   *
19   */
20  package org.apache.directory.server.core.changelog;
21  
22  
23  
24  /**
25   * A ChangeLogStore which allows tagging for tracking server state snapshots.
26   * At most one tag per revision can be created.  There is no point to creating
27   * more than one tag on a revision in our case for snapshotting server state.
28   *
29   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
30   * @version $Rev$, $Date$
31   */
32  public interface TaggableChangeLogStore extends ChangeLogStore
33  {
34      /**
35       * Creates a tag for a snapshot of the server in a specific state at a revision.
36       *
37       * @param revision the revision to tag the snapshot
38       * @return the Tag associated with the revision
39       * @throws Exception if there is a problem taking a tag, or if
40       * the revision does not exist
41       */
42      Tag tag( long revision ) throws Exception;
43  
44      /**
45       * Creates a snapshot of the server at the current revision.
46       *
47       * @return the revision at which the tag is created
48       * @throws Exception if there is a problem taking a tag
49       */
50      Tag tag() throws Exception;
51  
52      /**
53       * Creates a snapshot of the server at the current revision with a description
54       * of the snapshot tag.
55       *
56       * @param description a description of the state associate with the tag
57       * @return the revision at which the tag is created
58       * @throws Exception if there is a problem taking a tag
59       */
60      Tag tag( String description ) throws Exception;
61  
62  
63      /**
64       * Gets the latest tag if one was at all taken.
65       *
66       * @return the last tag to have been created (youngest), or null if no
67       * tags have been created
68       * @throws Exception on failures to access the tag store
69       */
70      Tag getLatest() throws Exception;
71      
72      
73      /**
74       * Removes a Tag created for a given revision.
75       *
76       * @param revision the revision number that was tagged
77       * @return the removed tag, null if there is no Tag present with the given revision
78       * @throws Exception on failures to access the tag store
79       */
80      Tag removeTag( long revision ) throws Exception;
81      
82      /**
83       * Creates a tag with the given description for a snapshot of the server
84       * in a specific state at a revision.
85       *
86       * @param revision the revision number that was tagged
87       * @param descrition a description of the state associate with the tag
88       * @return the Tag associated with the revision
89       * @throws Exception on failures to access the tag store
90       */
91      Tag tag( long revision, String descrition ) throws Exception;
92  }