public enum FileWriteStrategy extends Enum<FileWriteStrategy>
This is merely a setting in the Config
. The actual implementation is in the
FileRepoTransport
.
Enum Constant and Description |
---|
directAfterTransfer
Write directly into the destination file after all blocks have been transferred.
|
directDuringTransfer
Write each block directly into the destination file immediately when it was transferred.
|
replaceAfterTransfer
Similar to
directAfterTransfer , but write a new file and then switch
the files (delete the old file and rename the new file). |
Modifier and Type | Field and Description |
---|---|
static FileWriteStrategy |
CONFIG_DEFAULT_VALUE
The
defaultValue used with Config.getPropertyAsEnum(String, Enum) . |
static String |
CONFIG_KEY
The
key used with Config.getPropertyAsEnum(String, Enum) . |
Modifier and Type | Method and Description |
---|---|
static FileWriteStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static FileWriteStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final FileWriteStrategy directAfterTransfer
This strategy requires as much temporary space in the destination file system as blocks are transferred: The maximum total space requirement is thus twice the file size (old file + all blocks).
public static final FileWriteStrategy directDuringTransfer
In contrast to directAfterTransfer
this may leave the destination file in an
inconsistent state for hours or even days - as long as the transfer takes.
However, this strategy requires the least space in the file system: Only once the file size. There are no temporary files involved and thus no additional temporary space required.
public static final FileWriteStrategy replaceAfterTransfer
directAfterTransfer
, but write a new file and then switch
the files (delete the old file and rename the new file).
This strategy is the safest concerning consistency, but requires the most temporary space in the destination file system: The maximum total space requirement is a bit more than twice the file size (old file + blocks not yet written to new file + partial new file). Because the blocks are immediately deleted when written to the (partial) new file and the new file is growing while blocks are deleted (it doesn't have the final size immediately), the required space is not 3 times the size, but - as said - only a bit more than twice the size.
public static final String CONFIG_KEY
key
used with Config.getPropertyAsEnum(String, Enum)
.public static final FileWriteStrategy CONFIG_DEFAULT_VALUE
defaultValue
used with Config.getPropertyAsEnum(String, Enum)
.public static FileWriteStrategy[] values()
for (FileWriteStrategy c : FileWriteStrategy.values()) System.out.println(c);
public static FileWriteStrategy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2013-2014. All Rights Reserved.