Interface DatasetManager
- All Superinterfaces:
AutoCloseable
DatasetManager which then allow creating, retrieving
and destroying Dataset.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the DatasetManager.clustered(Iterable<InetSocketAddress> servers) Creates aClusteredDatasetManagerBuilderfor configuring the interaction with a cluster.Creates aClusteredDatasetManagerBuilderfor configuring the interaction with a cluster.Creates aDatasetConfigurationBuilderfor configuring which resources aDatasetcan use.booleandestroyDataset(String name) Permanently removes theDatasetand all the data it contains.embedded()Creates anEmbeddedDatasetManagerBuilderfor configuring the interaction with embeddedDatasetinstances.<K extends Comparable<K>>
Dataset<K>getDataset(String name, Type<K> keyType) Gets aDatasetwith the specified name and key type.List all existingDatasets known to thisDatasetManager.<K extends Comparable<K>>
booleannewDataset(String name, Type<K> keyType, DatasetConfiguration configuration) Create a new persistentDatasetwith the given name and key type.default <K extends Comparable<K>>
booleannewDataset(String name, Type<K> keyType, DatasetConfigurationBuilder configurationBuilder) Create a new persistentDatasetwith the given name and key type.secureClustered(Iterable<InetSocketAddress> servers, Path securityRootDirectory) Creates a ClusteredDatasetManagerBuilder for configuring the interaction with a cluster where the network communication is secured using SSL/TLS.secureClustered(URI uri, Path securityRootDirectory) Creates a ClusteredDatasetManagerBuilder for configuring the interaction with a cluster where the network communication is secured using SSL/TLS.static DatasetManagerusing(DatasetManagerConfiguration datasetManagerConfiguration) Creates aDatasetManagerusing the givenDatasetManagerConfigurationand default ConfigurationModeConfigurationMode.VALIDATEstatic DatasetManagerusing(DatasetManagerConfiguration datasetManagerConfiguration, ConfigurationMode configurationMode) Creates aDatasetManagerusing the givenDatasetManagerConfigurationand create/validateDatasets as per givenConfigurationMode
-
Method Details
-
clustered
Creates aClusteredDatasetManagerBuilderfor configuring the interaction with a cluster. The passed in URI takes the formterracotta://server1:port,server2:port,...,serverN:port.- Parameters:
uri- theURIfor the cluster- Returns:
- a
ClusteredDatasetManagerBuilderthat can be used to configure the interaction with the cluster
-
clustered
Creates aClusteredDatasetManagerBuilderfor configuring the interaction with a cluster.- Parameters:
servers- anIterableofInetSocketAddresses of the servers in the cluster- Returns:
- a
ClusteredDatasetManagerBuilderthat can be used to configure the interaction with the cluster
-
secureClustered
Creates a ClusteredDatasetManagerBuilder for configuring the interaction with a cluster where the network communication is secured using SSL/TLS. The passed in URI takes the form "terracotta://server1:port,server2:port,...,serverN:port- Parameters:
uri- the URI for the clustersecurityRootDirectory- path to a directory containing security configuration information. The contents of the directory must follow the well-defined structure.- Returns:
- a ClusteredDatasetManagerBuilder that can be used to configure the interaction with the cluster
-
secureClustered
static ClusteredDatasetManagerBuilder secureClustered(Iterable<InetSocketAddress> servers, Path securityRootDirectory) Creates a ClusteredDatasetManagerBuilder for configuring the interaction with a cluster where the network communication is secured using SSL/TLS. The passed in URI takes the form "terracotta://server1:port,server2:port,...,serverN:port- Parameters:
servers- anIterableofInetSocketAddresses of the servers in the clustersecurityRootDirectory- path to a directory containing security configuration information. The contents of the directory must follow the well-defined structure.- Returns:
- a ClusteredDatasetManagerBuilder that can be used to configure the interaction with the cluster
-
embedded
Creates anEmbeddedDatasetManagerBuilderfor configuring the interaction with embeddedDatasetinstances.An embedded
Datasetis hosted in-process, possibly with a local persistence layer.- Returns:
- an
EmbeddedDatasetManagerBuilderthat can be used to configure the interaction with embeddedDatasetinstances.
-
using
static DatasetManager using(DatasetManagerConfiguration datasetManagerConfiguration) throws StoreException Creates aDatasetManagerusing the givenDatasetManagerConfigurationand default ConfigurationModeConfigurationMode.VALIDATE- Parameters:
datasetManagerConfiguration-DatasetManagerconfiguration- Returns:
- a clustered or embedded
DatasetManagerinstance - Throws:
StoreException- if the creation of theDatasetManagerfails or creation/validation fails using ConfigurationModeConfigurationMode.VALIDATE
-
using
static DatasetManager using(DatasetManagerConfiguration datasetManagerConfiguration, ConfigurationMode configurationMode) throws StoreException Creates aDatasetManagerusing the givenDatasetManagerConfigurationand create/validateDatasets as per givenConfigurationMode- Parameters:
datasetManagerConfiguration-DatasetManagerconfigurationconfigurationMode- configurationMode to use- Returns:
- a clustered or embedded
DatasetManagerinstance - Throws:
StoreException- if the creation of theDatasetManagerfails or creation/validation fails as per givenConfigurationMode
-
getDatasetManagerConfiguration
DatasetManagerConfiguration getDatasetManagerConfiguration()- Returns:
DatasetManagerConfigurationfor thisDatasetManager
-
newDataset
<K extends Comparable<K>> boolean newDataset(String name, Type<K> keyType, DatasetConfiguration configuration) throws StoreException Create a new persistentDatasetwith the given name and key type.Note that if the
Datasetalready exists, only the validity of the key type will be checked. The rest of the configuration is not checked for compatibility.A
DatasetManagerdoes not provide any namespacing to theDatasets created with it. MultipleDatasetManagerinstances connected to the same cluster are equivalent and hence a clustered dataset created by one would be visible to all others.- Type Parameters:
K- the class of the key of theDataset- Parameters:
name- the name of theDatasetkeyType- the type of the key of theDatasetconfiguration- the configuration for the creation of theDataset- Returns:
trueif theDatasetwas created,falseif it existed already- Throws:
DatasetKeyTypeMismatchException- if the namedDatasetexists but with a different key typeStoreException- if an error occurs creating theDataset
-
newDataset
default <K extends Comparable<K>> boolean newDataset(String name, Type<K> keyType, DatasetConfigurationBuilder configurationBuilder) throws StoreException Create a new persistentDatasetwith the given name and key type.Note that if the
Datasetalready exists, only the validity of the key type will be checked. The rest of the configuration is not checked for compatibility.- Type Parameters:
K- the class of the key of theDataset- Parameters:
name- the name of theDatasetkeyType- the type of the key of theDatasetconfigurationBuilder- the configuration builder for the creation of theDataset- Returns:
trueif theDatasetwas created,falseif it existed already- Throws:
DatasetKeyTypeMismatchException- if the namedDatasetexists but with a different key typeStoreException- if an error occurs creating theDataset
-
getDataset
Gets aDatasetwith the specified name and key type.- Type Parameters:
K- the class of the key of theDataset- Parameters:
name- the name of theDatasetto getkeyType- the type of the key of theDataset- Returns:
- the
DatasetmatchingnameandkeyType - Throws:
DatasetKeyTypeMismatchException- if the namedDatasetexists but with a different key typeDatasetMissingException- if the namedDatasetdoes not existStoreException- if an error is encountered while retrieving theDataset
-
listDatasets
List all existingDatasets known to thisDatasetManager.For an embedded
DatasetManagerthis means allDatasetthat were created through it. For a clusteredDatasetManagerthis means allDatasetthat are known to the cluster it connects to.- Returns:
- a
Mapwith one entry perDataset, each entry having theDatasetname as key and theDatasettype as value. - Throws:
StoreException- if anything goes wrong while retrieving the list
-
destroyDataset
Permanently removes theDatasetand all the data it contains.- Parameters:
name- the name of theDatasetto destroy- Returns:
trueif theDatasetwas destroyed,falseif it did not exist- Throws:
StoreException- if theDatasetis in use by another client so could not be destroyed.
-
close
void close()Closes the DatasetManager. In a clustered topology, closes connection to remote server. In an embedded topology, disposes all datasets.- Specified by:
closein interfaceAutoCloseable
-
datasetConfiguration
DatasetConfigurationBuilder datasetConfiguration()Creates aDatasetConfigurationBuilderfor configuring which resources aDatasetcan use.- Returns:
- a
DatasetConfigurationBuilderthat can be used to configure aDataset.
-