001    /*
002     *   Licensed to the Apache Software Foundation (ASF) under one
003     *   or more contributor license agreements.  See the NOTICE file
004     *   distributed with this work for additional information
005     *   regarding copyright ownership.  The ASF licenses this file
006     *   to you under the Apache License, Version 2.0 (the
007     *   "License"); you may not use this file except in compliance
008     *   with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     *   Unless required by applicable law or agreed to in writing,
013     *   software distributed under the License is distributed on an
014     *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *   KIND, either express or implied.  See the License for the
016     *   specific language governing permissions and limitations
017     *   under the License.
018     *
019     */
020    package org.apache.directory.server.core.changelog;
021    
022    
023    
024    /**
025     * A ChangeLogStore which allows tagging for tracking server state snapshots.
026     * At most one tag per revision can be created.  There is no point to creating
027     * more than one tag on a revision in our case for snapshotting server state.
028     *
029     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030     * @version $Rev$, $Date$
031     */
032    public interface TaggableChangeLogStore extends ChangeLogStore
033    {
034        /**
035         * Creates a tag for a snapshot of the server in a specific state at a revision.
036         *
037         * @param revision the revision to tag the snapshot
038         * @return the Tag associated with the revision
039         * @throws Exception if there is a problem taking a tag, or if
040         * the revision does not exist
041         */
042        Tag tag( long revision ) throws Exception;
043    
044        /**
045         * Creates a snapshot of the server at the current revision.
046         *
047         * @return the revision at which the tag is created
048         * @throws Exception if there is a problem taking a tag
049         */
050        Tag tag() throws Exception;
051    
052        /**
053         * Creates a snapshot of the server at the current revision with a description
054         * of the snapshot tag.
055         *
056         * @param description a description of the state associate with the tag
057         * @return the revision at which the tag is created
058         * @throws Exception if there is a problem taking a tag
059         */
060        Tag tag( String description ) throws Exception;
061    
062    
063        /**
064         * Gets the latest tag if one was at all taken.
065         *
066         * @return the last tag to have been created (youngest), or null if no
067         * tags have been created
068         * @throws Exception on failures to access the tag store
069         */
070        Tag getLatest() throws Exception;
071        
072        
073        /**
074         * Removes a Tag created for a given revision.
075         *
076         * @param revision the revision number that was tagged
077         * @return the removed tag, null if there is no Tag present with the given revision
078         * @throws Exception on failures to access the tag store
079         */
080        Tag removeTag( long revision ) throws Exception;
081        
082        /**
083         * Creates a tag with the given description for a snapshot of the server
084         * in a specific state at a revision.
085         *
086         * @param revision the revision number that was tagged
087         * @param descrition a description of the state associate with the tag
088         * @return the Tag associated with the revision
089         * @throws Exception on failures to access the tag store
090         */
091        Tag tag( long revision, String descrition ) throws Exception;
092    }