/*
 * Copyright 2016 higherfrequencytrading.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.openhft.chronicle.queue;

import net.openhft.chronicle.core.time.TimeProvider;

public interface RollCycle {

    /**
     * Returns the format that is to be applied when file names
     * are calculated for a new roll cycle.
     * <p>
     * For example, the following formats can be returned:
     * <ul>
     *     <li>"yyyyMMdd-HHmm" (MINUTELY)</li>
     *     <li>"yyyyMMdd" (DAILY)</li>
     * </ul>
     *
     * @return the format that is to be applied when file names
     *         are calculated for a new roll cycle
     */
    String format();

    /**
     * Returns the length in milliseconds (i.e. the maximum duration) for a roll cycle.
     * <p>
     * For example, the following lengths can be returned:
     * <ul>
     *     <li>60 * 1,000 = 60,000 (MINUTELY)</li>
     *     <li>24 * 60 * 60 * 1,000 = 86,400,000 (DAILY)</li>
     * </ul>
     *
     * @return the length in milliseconds (i.e. the maximum duration) for a roll cycle
     */
    int length();

    int defaultIndexCount();

    int defaultIndexSpacing();

    /**
     * @param epoch and EPOCH offset, to all the user to define their own epoch
     * @return the cycle
     */
    int current(TimeProvider time, long epoch);

    /**
     * Returns the index for the given {@code cycle} and {@code sequenceNumber}.
     * <p>
     * An index is comprised of both a cycle and a sequence number but
     * the way the index is composed of said properties may vary.
     *
     * @param cycle to be composed into an index
     * @param sequenceNumber to be composed into an index
     * @return the index for the given {@code cycle} and {@code sequenceNumber}
     */
    long toIndex(int cycle, long sequenceNumber);

    /**
     * Returns the sequence number for the given {@code index}.
     * <p>
     * An index is comprised of both a cycle and a sequence number but
     * the way the index is composed of said properties may vary.
     * This method decomposes the provided {@code index} and extracts
     * the sequence number.
     *
     * @param index to use when extracting the sequence number
     * @return the sequence number for the given {@code index}
     */
    long toSequenceNumber(long index);

    /**
     * Returns the cycle for the given {@code index}.
     * <p>
     * An index is comprised of both a cycle and a sequence number but
     * the way the index is composed of said properties may vary.
     * This method decomposes the provided {@code index} and extracts
     * the cycle.
     *
     * @param index to use when extracting the cycle
     * @return the sequence number for the given {@code index}
     */
    int toCycle(long index);
}

@@ -1595,24 +1595,25 @@
  length();%0A%0A
+%0A
     int defa
@@ -1626,24 +1626,542 @@
 exCount();%0A%0A
+    /**%0A     * Returns the space between excerpts that are explicitly indexed.%0A     * %3Cp%3E%0A     * A higher number means higher sequential write performance but%0A     * slower random access read. The sequential read performance is not%0A     * affected by this property.%0A     * %3Cp%3E%0A     * For example, the following default index spacing can be returned:%0A     * %3Cul%3E%0A     *     %3Cli%3E16 (MINUTELY)%3C/li%3E%0A     *     %3Cli%3E64 (DAILY)%3C/li%3E%0A     * %3C/ul%3E%0A     * @return the space between excerpts that are explicitly indexed%0A     */%0A
     int defa

Add JavaDoc for RollCycle::defaultIndexSpacing