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 */
020package org.apache.directory.server.core.api.changelog;
021
022
023/**
024 * A ChangeLogStore which allows tagging for tracking server state snapshots.
025 * At most one tag per revision can be created.  There is no point to creating
026 * more than one tag on a revision in our case for snapshotting server state.
027 *
028 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
029 */
030public interface TaggableChangeLogStore extends ChangeLogStore
031{
032    /**
033     * Creates a tag for a snapshot of the server in a specific state at a revision.
034     *
035     * @param revision the revision to tag the snapshot
036     * @return the Tag associated with the revision
037     */
038    Tag tag( long revision );
039
040
041    /**
042     * Creates a snapshot of the server at the current revision.
043     *
044     * @return the revision at which the tag is created
045     */
046    Tag tag();
047
048
049    /**
050     * Creates a snapshot of the server at the current revision with a description
051     * of the snapshot tag.
052     *
053     * @param description a description of the state associate with the tag
054     * @return the revision at which the tag is created
055     */
056    Tag tag( String description );
057
058
059    /**
060     * Gets the latest tag if one was at all taken.
061     *
062     * @return the last tag to have been created (youngest), or null if no
063     * tags have been created
064     */
065    Tag getLatest();
066
067
068    /**
069     * Removes a Tag created for a given revision.
070     *
071     * @param revision the revision number that was tagged
072     * @return the removed tag, null if there is no Tag present with the given revision
073     */
074    Tag removeTag( long revision );
075
076
077    /**
078     * Creates a tag with the given description for a snapshot of the server
079     * in a specific state at a revision.
080     *
081     * @param revision the revision number that was tagged
082     * @param descrition a description of the state associate with the tag
083     * @return the Tag associated with the revision
084     */
085    Tag tag( long revision, String descrition );
086}