code
docs
tests
EntityStore service backed by a source control friendly file system format.
Note that content should not be modified directly, and doing so may corrupt the data.
Table 62. Artifact
Group ID | Artifact ID | Version |
---|---|---|
org.apache.zest.extension | org.apache.zest.extension.entitystore-file | 0 |
Assembly is done as follows:
public void assemble( ModuleAssembly module ) throws AssemblyException { [...snip...] new FileEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); }
Here are the configuration properties for the File EntityStore:
public interface FileEntityStoreConfiguration extends ConfigurationComposite { [...snip...] @Optional Property<String> directory(); [...snip...] @Optional @Range(min=1, max=10000) Property<Integer> slices(); }
directory
is optional and represent the directory where the File EntityStore will keep its persisted state.
It defaults to System.getProperty( "user.dir" ) + "/zest/filestore" If the given path is not absolute, then it’s relative to the current working directory. If you use the FileConfig Library then this property value is ignored and FileConfig is prefered.
slices
defines how many slice directories the store should use.
Many operating systems run into performance problems when the number of files in a directory grows. If you expect a large number of entities in the file entity store, it is wise to set the number of slices (default is 1) to an approximation of the square root of number of expected entities.
For instance, if you estimate that you will have 1 million entities in the file entity store, you should set the slices to 1000.
There is a limit of minimum 1 slice and maximum 10,000 slices, and if more slices than that is needed, you are probably pushing this entitystore beyond its capabilities.
Note that the slices() can not be changed once it has been set, as it would cause the entity store not to find the entities anymore.