public interface StorageDataFileEvaluator extends StorageDataFileDissolvingEvaluator
Note that any implementation of this type must be safe enough to never throw an exception as this would doom the storage thread that executes it. Catching any exception would not prevent the problem for the channel thread as the function has to work in order for the channel to work properly. It is therefore strongly suggested that implementations only use "exception free" logic (like simple arithmetic) or handle any possible exception internally.
| Modifier and Type | Interface and Description |
|---|---|
static class |
StorageDataFileEvaluator.Default |
static interface |
StorageDataFileEvaluator.Defaults |
static interface |
StorageDataFileEvaluator.Validation |
| Modifier and Type | Method and Description |
|---|---|
int |
fileMaximumSize() |
int |
fileMinimumSize() |
boolean |
needsDissolving(StorageLiveDataFile storageFile) |
boolean |
needsRetirement(long fileTotalLength) |
static StorageDataFileEvaluator |
New()
Pseudo-constructor method to create a new
StorageDataFileEvaluator instance
using default values specified by StorageDataFileEvaluator.Defaults. |
static StorageDataFileEvaluator |
New(double minimumUseRatio)
Pseudo-constructor method to create a new
StorageDataFileEvaluator instance
using the passed value and default values specified by StorageDataFileEvaluator.Defaults. |
static StorageDataFileEvaluator |
New(int fileMinimumSize,
int fileMaximumSize)
Pseudo-constructor method to create a new
StorageDataFileEvaluator instance
using the passed values and default values specified by StorageDataFileEvaluator.Defaults. |
static StorageDataFileEvaluator |
New(int fileMinimumSize,
int fileMaximumSize,
double minimumUseRatio)
Pseudo-constructor method to create a new
StorageDataFileEvaluator instance
using the passed values. |
static StorageDataFileEvaluator |
New(int fileMinimumSize,
int fileMaximumSize,
double minimumUseRatio,
boolean cleanUpHeadFile)
Pseudo-constructor method to create a new
StorageDataFileEvaluator instance
using the passed values and default values specified by StorageDataFileEvaluator.Defaults. |
boolean needsDissolving(StorageLiveDataFile storageFile)
needsDissolving in interface StorageDataFileDissolvingEvaluatorboolean needsRetirement(long fileTotalLength)
int fileMinimumSize()
int fileMaximumSize()
static StorageDataFileEvaluator New()
StorageDataFileEvaluator instance
using default values specified by StorageDataFileEvaluator.Defaults.
For explanations and customizing values, see New(int, int, double).
StorageDataFileEvaluator instance.New(int, int),
New(double),
New(int, int, double),
StorageDataFileEvaluator.Defaultsstatic StorageDataFileEvaluator New(double minimumUseRatio)
StorageDataFileEvaluator instance
using the passed value and default values specified by StorageDataFileEvaluator.Defaults.
For explanations and customizing values, see New(int, int, double).
minimumUseRatio - the ratio (value in ]0.0;1.0]) of non-gap data contained in a storage file to prevent
the file from being dissolved. "Gap" data is anything that is not the latest version of an entity's data,
inluding older versions of an entity and "comment" bytes (a sequence of bytes beginning with its length
as a negative value length header).StorageDataFileEvaluator instance.New(),
New(int, int),
New(int, int, double),
StorageDataFileEvaluator.Defaultsstatic StorageDataFileEvaluator New(int fileMinimumSize, int fileMaximumSize)
StorageDataFileEvaluator instance
using the passed values and default values specified by StorageDataFileEvaluator.Defaults.
For explanations and customizing values, see New(int, int, double).
fileMinimumSize - the minimum file size in bytes that a single storage file must have. Smaller files
will be dissolved.fileMaximumSize - the maximum file size in bytes that a single storage file may have. Larger files
will be dissolved.StorageDataFileEvaluator instance.New(),
New(double),
New(int, int, double),
StorageDataFileEvaluator.Defaultsstatic StorageDataFileEvaluator New(int fileMinimumSize, int fileMaximumSize, double minimumUseRatio)
StorageDataFileEvaluator instance
using the passed values.
A StorageDataFileEvaluator is used to evaluate storage data files regarding if they should be
desolved, meaning copy all their still needed data to the current head file and then delete the file.
This technique is used to optimize (or "clean up") the occupied storage space: No longer needed data, e.g.
of entities that became unreachable or prior versions of a still reachable entity, is considered a logical "gap",
that occupies storage space unnecessarily. These "gaps" have to be removed in order to only occupy as much
storage space as required.
The parameters defined here give an opportunity to configure how "aggressive" this clean up shall be performaned.
The trade-off is between acceptale gap sizes and the required performance and disk-writes to clean them up.
Without specifying them, default values will be used, defined in StorageDataFileEvaluator.Defaults.
fileMinimumSize - the minimum file size in bytes that a single storage file must have. Smaller files
will be dissolved.fileMaximumSize - the maximum file size in bytes that a single storage file may have. Larger files
will be dissolved.minimumUseRatio - the ratio (value in ]0.0;1.0]) of non-gap data contained in a storage file to prevent
the file from being dissolved. "Gap" data is anything that is not the latest version of an entity's data,
inluding older versions of an entity and "comment" bytes (a sequence of bytes beginning with its length
as a negative value length header).StorageDataFileEvaluator instance.New(),
New(double),
New(int, int),
StorageDataFileEvaluator.Defaultsstatic StorageDataFileEvaluator New(int fileMinimumSize, int fileMaximumSize, double minimumUseRatio, boolean cleanUpHeadFile)
StorageDataFileEvaluator instance
using the passed values and default values specified by StorageDataFileEvaluator.Defaults.
For explanations and customizing values, see New(int, int, double).
fileMinimumSize - the minimum file size in bytes that a single storage file must have. Smaller files
will be dissolved.fileMaximumSize - the maximum file size in bytes that a single storage file may have. Larger files
will be dissolved.minimumUseRatio - the ratio (value in ]0.0;1.0]) of non-gap data contained in a storage file to prevent
the file from being dissolved. "Gap" data is anything that is not the latest version of an entity's data,
inluding older versions of an entity and "comment" bytes (a sequence of bytes beginning with its length
as a negative value length header).cleanUpHeadFile - a flag defining wether the current head file (the only file actively written to)
shall be subjected to file cleanups as well.StorageDataFileEvaluator instance.New(),
New(double),
New(int, int),
New(int, int, double),
StorageDataFileEvaluator.DefaultsCopyright © 2022 MicroStream Software. All rights reserved.