001/*
002 * Syncany, www.syncany.org
003 * Copyright (C) 2011-2016 Philipp C. Heckel <philipp.heckel@gmail.com>
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU General Public License for more details.
014 *
015 * You should have received a copy of the GNU General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018package org.syncany.plugins.transfer.features;
019
020import java.lang.annotation.ElementType;
021import java.lang.annotation.Retention;
022import java.lang.annotation.RetentionPolicy;
023import java.lang.annotation.Target;
024
025/**
026 * <p>Some storage backends do not guarantee that a file immediately exists on the
027 * remote side after it is uploaded or moved.<br>
028 * This feature handles such cases by relaxing the strong assumption that a file
029 * is immediately available after creation due to upload or move operations.
030 *
031 * <p>The {@link ReadAfterWriteConsistentFeatureTransferManager} throttles existence check
032 * using a simple exponential method:<br>
033 *
034 * <code>throttle(n) = 3 ^ n * 100 ms</code>, with n being the current iteration
035 *
036 * @author Christian Roth (christian.roth@port17.de)
037 */
038@Feature(required = false)
039@Target(ElementType.TYPE)
040@Retention(RetentionPolicy.RUNTIME)
041public @interface ReadAfterWriteConsistent {
042        /**
043         * @see ReadAfterWriteConsistentFeatureExtension
044         */
045        Class<? extends ReadAfterWriteConsistentFeatureExtension> extension();
046
047        /**
048         * Define how often a transfer manager will try to find a file on the remote side.
049         */
050        int maxRetries() default 5;
051
052        /**
053         * Define the maximum wait time until a file has to exist on the remote side (given in milliseconds).
054         */
055        int maxWaitTime() default 10000;
056}