Package org.apache.geode.cache
Interface DiskStoreFactory
public interface DiskStoreFactory
Factory for creating instances of
DiskStore. To get an instance of this factory call
GemFireCache.createDiskStoreFactory(). If all you want to do is find an existing disk store see
GemFireCache.findDiskStore(java.lang.String).
To use this factory configure it with the set methods and then call create(java.lang.String)
to produce a disk store instance.
- Since:
- GemFire 6.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default value of the allow force compaction attribute.static final booleanThe default setting for auto compaction.static final intThe default compaction threshold.static final intThe default disk directory size in megabytes.static final int[]The default disk directory sizes.static final File[]The default disk directories.static final StringThe name of the default disk store is "DEFAULT".static final floatThe default disk usage critical percentage.static final floatThe default disk usage warning percentage.static final longThe default maximum oplog file size in megabytes.static final intThe default maximum number of operations that can be asynchronously queued.static final longThe default time interval in milliseconds.static final intThe default write buffer size. -
Method Summary
Modifier and TypeMethodDescriptionCreate a new disk store or find an existing one.setAllowForceCompaction(boolean allowForceCompaction) Set totrueto allowDiskStore.forceCompaction()to be called on regions using this disk store.setAutoCompact(boolean isAutoCompact) Set totrueto cause the disk files to be automatically compacted.setCompactionThreshold(int compactionThreshold) Sets the threshold at which an oplog will become compactable.setDiskDirs(File[] diskDirs) Sets the directories to which this disk store's data is written.setDiskDirsAndSizes(File[] diskDirs, int[] diskDirSizes) Sets the directories to which this disk store's data is written and also set the sizes in megabytes of each directory.setDiskUsageCriticalPercentage(float criticalPercent) Sets the critical threshold for disk usage as a percentage of the total disk volume.setDiskUsageWarningPercentage(float warningPercent) Sets the warning threshold for disk usage as a percentage of the total disk volume.setMaxOplogSize(long maxOplogSize) Sets the maximum size in megabytes a single oplog (operation log) is allowed to be.setQueueSize(int queueSize) Sets the maximum number of operations that can be asynchronously queued.setTimeInterval(long timeInterval) Sets the number of milliseconds that can elapse before data written asynchronously is flushed to disk.setWriteBufferSize(int writeBufferSize) Sets the write buffer size in bytes.
-
Field Details
-
DEFAULT_DISK_STORE_NAME
The name of the default disk store is "DEFAULT". This name can be used to redefine the default disk store. Regions that have not had their disk-store-name set will use this disk store.- See Also:
-
DEFAULT_AUTO_COMPACT
static final boolean DEFAULT_AUTO_COMPACTThe default setting for auto compaction.Current value:
true.- See Also:
-
DEFAULT_COMPACTION_THRESHOLD
static final int DEFAULT_COMPACTION_THRESHOLDThe default compaction threshold.Current value:
50.- See Also:
-
DEFAULT_ALLOW_FORCE_COMPACTION
static final boolean DEFAULT_ALLOW_FORCE_COMPACTIONThe default value of the allow force compaction attribute.Current value:
false.- See Also:
-
DEFAULT_MAX_OPLOG_SIZE
static final long DEFAULT_MAX_OPLOG_SIZEThe default maximum oplog file size in megabytes.Current value:
1024which is one gigabyte. -
DEFAULT_TIME_INTERVAL
static final long DEFAULT_TIME_INTERVALThe default time interval in milliseconds.Current value:
1000.- See Also:
-
DEFAULT_WRITE_BUFFER_SIZE
static final int DEFAULT_WRITE_BUFFER_SIZEThe default write buffer size.Current value:
32768.- See Also:
-
DEFAULT_QUEUE_SIZE
static final int DEFAULT_QUEUE_SIZEThe default maximum number of operations that can be asynchronously queued.Current value:
0.- See Also:
-
DEFAULT_DISK_DIRS
The default disk directories.Current value:
current directory. -
DEFAULT_DISK_DIR_SIZE
static final int DEFAULT_DISK_DIR_SIZEThe default disk directory size in megabytes.Current value:
2,147,483,647which is two petabytes.- See Also:
-
DEFAULT_DISK_DIR_SIZES
static final int[] DEFAULT_DISK_DIR_SIZESThe default disk directory sizes.Current value:
DEFAULT_DISK_DIR_SIZEwhich is two petabytes each. -
DEFAULT_DISK_USAGE_WARNING_PERCENTAGE
static final float DEFAULT_DISK_USAGE_WARNING_PERCENTAGEThe default disk usage warning percentage.Current value:
90.- See Also:
-
DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGE
static final float DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGEThe default disk usage critical percentage.Current value:
99.- See Also:
-
-
Method Details
-
setAutoCompact
Set totrueto cause the disk files to be automatically compacted. Set tofalseif no compaction is needed or manual compaction will be used.- Parameters:
isAutoCompact- if true then use auto compaction- Returns:
- a reference to
this
-
setCompactionThreshold
Sets the threshold at which an oplog will become compactable. Until it reaches this threshold the oplog will not be compacted. The threshold is a percentage in the range 0..100. When the amount of live data in an oplog becomes less than this percentage then when a compaction is done this garbage will be cleaned up freeing up disk space. Garbage is created by entry destroys, entry updates, and region destroys.- Parameters:
compactionThreshold- percentage of remaining live data in the oplog at which an oplog is compactable- Returns:
- a reference to
this
-
setAllowForceCompaction
Set totrueto allowDiskStore.forceCompaction()to be called on regions using this disk store.- Parameters:
allowForceCompaction- if true then allow force compaction.- Returns:
- a reference to
this
-
setMaxOplogSize
Sets the maximum size in megabytes a single oplog (operation log) is allowed to be. When an oplog is created this amount of file space will be immediately reserved.- Parameters:
maxOplogSize- maximum size in megabytes for one single oplog file.- Returns:
- a reference to
this
-
setTimeInterval
Sets the number of milliseconds that can elapse before data written asynchronously is flushed to disk.For how to configure a region to be asynchronous see:
AttributesFactory.setDiskSynchronous(boolean).- Parameters:
timeInterval- number of milliseconds that can elapse before async data is flushed to disk.- Returns:
- a reference to
this
-
setWriteBufferSize
Sets the write buffer size in bytes.- Parameters:
writeBufferSize- write buffer size in bytes.- Returns:
- a reference to
this
-
setQueueSize
Sets the maximum number of operations that can be asynchronously queued. Once this many pending async operations have been queued async ops will begin blocking until some of the queued ops have been flushed to disk.For how to configure a region to be asynchronous see:
AttributesFactory.setDiskSynchronous(boolean).- Parameters:
queueSize- number of operations that can be asynchronously queued. If 0, the queue will be unlimited.- Returns:
- a reference to
this
-
setDiskDirs
Sets the directories to which this disk store's data is written. If multiple directories are used, GemFire will attempt to distribute the data evenly amongst them. The size of each directory will be set to the default ofDEFAULT_DISK_DIR_SIZE.- Parameters:
diskDirs- directories to put the oplog files.- Returns:
- a reference to
this
-
setDiskDirsAndSizes
Sets the directories to which this disk store's data is written and also set the sizes in megabytes of each directory.- Parameters:
diskDirs- directories to put the oplog files.diskDirSizes- sizes of disk directories in megabytes- Returns:
- a reference to
this - Throws:
IllegalArgumentException- if length of the size array does not match to the length of the dir array
-
setDiskUsageWarningPercentage
Sets the warning threshold for disk usage as a percentage of the total disk volume.- Parameters:
warningPercent- warning percent of disk usage- Returns:
- a reference to
this - Since:
- GemFire 8.0
-
setDiskUsageCriticalPercentage
Sets the critical threshold for disk usage as a percentage of the total disk volume.- Parameters:
criticalPercent- critical percent of disk usage- Returns:
- a reference to
this - Since:
- GemFire 8.0
-
create
Create a new disk store or find an existing one. In either case the returned disk store's configuration will be the same as this factory's configuration.- Parameters:
name- the name of the DiskStore- Returns:
- the newly created DiskStore.
- Throws:
IllegalStateException- if a disk store with the given name already exists and its configuration is not consistent with this factory.
-