Interface DatasetManager
- All Superinterfaces:
AutoCloseable
DatasetManager
which then allow creating, retrieving
and destroying Dataset
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the DatasetManager.clustered
(Iterable<InetSocketAddress> servers) Creates aClusteredDatasetManagerBuilder
for configuring the interaction with a cluster.Creates aClusteredDatasetManagerBuilder
for configuring the interaction with a cluster.Creates aDatasetConfigurationBuilder
for configuring which resources aDataset
can use.boolean
destroyDataset
(String name) Permanently removes theDataset
and all the data it contains.embedded()
Creates anEmbeddedDatasetManagerBuilder
for configuring the interaction with embeddedDataset
instances.<K extends Comparable<K>>
Dataset<K>getDataset
(String name, Type<K> keyType) Gets aDataset
with the specified name and key type.List all existingDataset
s known to thisDatasetManager
.<K extends Comparable<K>>
booleannewDataset
(String name, Type<K> keyType, DatasetConfiguration configuration) Create a new persistentDataset
with the given name and key type.default <K extends Comparable<K>>
booleannewDataset
(String name, Type<K> keyType, DatasetConfigurationBuilder configurationBuilder) Create a new persistentDataset
with 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 DatasetManager
using
(DatasetManagerConfiguration datasetManagerConfiguration) Creates aDatasetManager
using the givenDatasetManagerConfiguration
and default ConfigurationModeConfigurationMode.VALIDATE
static DatasetManager
using
(DatasetManagerConfiguration datasetManagerConfiguration, ConfigurationMode configurationMode) Creates aDatasetManager
using the givenDatasetManagerConfiguration
and create/validateDataset
s as per givenConfigurationMode
-
Method Details
-
clustered
Creates aClusteredDatasetManagerBuilder
for configuring the interaction with a cluster. The passed in URI takes the formterracotta://server1:port,server2:port,...,serverN:port
.- Parameters:
uri
- theURI
for the cluster- Returns:
- a
ClusteredDatasetManagerBuilder
that can be used to configure the interaction with the cluster
-
clustered
Creates aClusteredDatasetManagerBuilder
for configuring the interaction with a cluster.- Parameters:
servers
- anIterable
ofInetSocketAddress
es of the servers in the cluster- Returns:
- a
ClusteredDatasetManagerBuilder
that 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
- anIterable
ofInetSocketAddress
es 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 anEmbeddedDatasetManagerBuilder
for configuring the interaction with embeddedDataset
instances.An embedded
Dataset
is hosted in-process, possibly with a local persistence layer.- Returns:
- an
EmbeddedDatasetManagerBuilder
that can be used to configure the interaction with embeddedDataset
instances.
-
using
static DatasetManager using(DatasetManagerConfiguration datasetManagerConfiguration) throws StoreException Creates aDatasetManager
using the givenDatasetManagerConfiguration
and default ConfigurationModeConfigurationMode.VALIDATE
- Parameters:
datasetManagerConfiguration
-DatasetManager
configuration- Returns:
- a clustered or embedded
DatasetManager
instance - Throws:
StoreException
- if the creation of theDatasetManager
fails or creation/validation fails using ConfigurationModeConfigurationMode.VALIDATE
-
using
static DatasetManager using(DatasetManagerConfiguration datasetManagerConfiguration, ConfigurationMode configurationMode) throws StoreException Creates aDatasetManager
using the givenDatasetManagerConfiguration
and create/validateDataset
s as per givenConfigurationMode
- Parameters:
datasetManagerConfiguration
-DatasetManager
configurationconfigurationMode
- configurationMode to use- Returns:
- a clustered or embedded
DatasetManager
instance - Throws:
StoreException
- if the creation of theDatasetManager
fails or creation/validation fails as per givenConfigurationMode
-
getDatasetManagerConfiguration
DatasetManagerConfiguration getDatasetManagerConfiguration()- Returns:
DatasetManagerConfiguration
for thisDatasetManager
-
newDataset
<K extends Comparable<K>> boolean newDataset(String name, Type<K> keyType, DatasetConfiguration configuration) throws StoreException Create a new persistentDataset
with the given name and key type.Note that if the
Dataset
already exists, only the validity of the key type will be checked. The rest of the configuration is not checked for compatibility.A
DatasetManager
does not provide any namespacing to theDataset
s created with it. MultipleDatasetManager
instances 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 theDataset
keyType
- the type of the key of theDataset
configuration
- the configuration for the creation of theDataset
- Returns:
true
if theDataset
was created,false
if it existed already- Throws:
DatasetKeyTypeMismatchException
- if the namedDataset
exists 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 persistentDataset
with the given name and key type.Note that if the
Dataset
already 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 theDataset
keyType
- the type of the key of theDataset
configurationBuilder
- the configuration builder for the creation of theDataset
- Returns:
true
if theDataset
was created,false
if it existed already- Throws:
DatasetKeyTypeMismatchException
- if the namedDataset
exists but with a different key typeStoreException
- if an error occurs creating theDataset
-
getDataset
Gets aDataset
with the specified name and key type.- Type Parameters:
K
- the class of the key of theDataset
- Parameters:
name
- the name of theDataset
to getkeyType
- the type of the key of theDataset
- Returns:
- the
Dataset
matchingname
andkeyType
- Throws:
DatasetKeyTypeMismatchException
- if the namedDataset
exists but with a different key typeDatasetMissingException
- if the namedDataset
does not existStoreException
- if an error is encountered while retrieving theDataset
-
listDatasets
List all existingDataset
s known to thisDatasetManager
.For an embedded
DatasetManager
this means allDataset
that were created through it. For a clusteredDatasetManager
this means allDataset
that are known to the cluster it connects to.- Returns:
- a
Map
with one entry perDataset
, each entry having theDataset
name as key and theDataset
type as value. - Throws:
StoreException
- if anything goes wrong while retrieving the list
-
destroyDataset
Permanently removes theDataset
and all the data it contains.- Parameters:
name
- the name of theDataset
to destroy- Returns:
true
if theDataset
was destroyed,false
if it did not exist- Throws:
StoreException
- if theDataset
is 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:
close
in interfaceAutoCloseable
-
datasetConfiguration
DatasetConfigurationBuilder datasetConfiguration()Creates aDatasetConfigurationBuilder
for configuring which resources aDataset
can use.- Returns:
- a
DatasetConfigurationBuilder
that can be used to configure aDataset
.
-