public class LocalBinaryManager extends AbstractBinaryManager
A garbage collection is needed to purge unused binaries.
The format of the binaries directory is:
Modifier and Type | Class and Description |
---|---|
static class |
LocalBinaryManager.DefaultBinaryGarbageCollector |
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_FILE |
static String |
DATA |
static String |
DEFAULT_PATH |
static String |
TMP |
DEFAULT_DEPTH, DEFAULT_DIGEST, MAX_BUF_SIZE, MIN_BUF_SIZE
Constructor and Description |
---|
LocalBinaryManager() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the binary manager and releases all resources and temporary objects held by it.
|
Binary |
getBinary(String digest)
Returns a
Binary corresponding to the given digest. |
File |
getFileForDigest(String digest,
boolean createDir)
Gets a file representing the storage for a given digest.
|
File |
getStorageDir() |
void |
initialize(BinaryManagerDescriptor binaryManagerDescriptor)
Initializer.
|
static void |
touch(File file)
Sets the last modification date to now on a file
|
getBinary, getGarbageCollector, toHexString
public static final String DEFAULT_PATH
public static final String DATA
public static final String TMP
public static final String CONFIG_FILE
public void initialize(BinaryManagerDescriptor binaryManagerDescriptor) throws IOException
BinaryManager
initialize
in interface BinaryManager
initialize
in class AbstractBinaryManager
IOException
public void close()
BinaryManager
public File getStorageDir()
public Binary getBinary(String digest)
BinaryManager
Binary
corresponding to the given digest.
A null
is returned if the digest could not be found.
getBinary
in interface BinaryManager
getBinary
in class AbstractBinaryManager
digest
- the digest, or null
public File getFileForDigest(String digest, boolean createDir)
digest
- the digestcreateDir
- true
if the directory containing the file itself must be createdpublic static void touch(File file)
file
- the fileCopyright © 2015 Nuxeo SA. All rights reserved.