public interface DatasetManager
extends java.lang.AutoCloseable
DatasetManager
which then allow creating, retrieving
and destroying Dataset
.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the DatasetManager.
|
static ClusteredDatasetManagerBuilder |
clustered(java.lang.Iterable<java.net.InetSocketAddress> servers)
Creates a
ClusteredDatasetManagerBuilder for configuring the interaction with a cluster. |
static ClusteredDatasetManagerBuilder |
clustered(java.net.URI uri)
Creates a
ClusteredDatasetManagerBuilder for configuring the interaction with a cluster. |
DatasetConfigurationBuilder |
datasetConfiguration()
Creates a
DatasetConfigurationBuilder for configuring which resources a Dataset can use. |
boolean |
destroyDataset(java.lang.String name)
Permanently removes the
Dataset and all the data it contains. |
static EmbeddedDatasetManagerBuilder |
embedded()
Creates an
EmbeddedDatasetManagerBuilder for configuring the interaction with embedded Dataset instances. |
<K extends java.lang.Comparable<K>> |
getDataset(java.lang.String name,
Type<K> keyType)
Gets a
Dataset with the specified name and key type. |
DatasetManagerConfiguration |
getDatasetManagerConfiguration() |
java.util.Map<java.lang.String,Type<?>> |
listDatasets()
List all existing
Dataset s known to this DatasetManager . |
<K extends java.lang.Comparable<K>> |
newDataset(java.lang.String name,
Type<K> keyType,
DatasetConfiguration configuration)
Create a new persistent
Dataset with the given name and key type. |
default <K extends java.lang.Comparable<K>> |
newDataset(java.lang.String name,
Type<K> keyType,
DatasetConfigurationBuilder configurationBuilder)
Create a new persistent
Dataset with the given name and key type. |
static ClusteredDatasetManagerBuilder |
secureClustered(java.lang.Iterable<java.net.InetSocketAddress> servers,
java.nio.file.Path securityRootDirectory)
Creates a ClusteredDatasetManagerBuilder for configuring the interaction with a cluster where the network communication
is secured using SSL/TLS.
|
static ClusteredDatasetManagerBuilder |
secureClustered(java.net.URI uri,
java.nio.file.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 a
DatasetManager using the given DatasetManagerConfiguration and
default ConfigurationMode ConfigurationMode.VALIDATE |
static DatasetManager |
using(DatasetManagerConfiguration datasetManagerConfiguration,
ConfigurationMode configurationMode)
Creates a
DatasetManager using the given DatasetManagerConfiguration and create/validate
Dataset s as per given ConfigurationMode |
static ClusteredDatasetManagerBuilder clustered(java.net.URI uri)
ClusteredDatasetManagerBuilder
for configuring the interaction with a cluster. The passed in URI takes
the form terracotta://server1:port,server2:port,...,serverN:port
.uri
- the URI
for the clusterClusteredDatasetManagerBuilder
that can be used to configure the interaction with the clusterstatic ClusteredDatasetManagerBuilder clustered(java.lang.Iterable<java.net.InetSocketAddress> servers)
ClusteredDatasetManagerBuilder
for configuring the interaction with a cluster.servers
- an Iterable
of InetSocketAddress
es of the servers in the clusterClusteredDatasetManagerBuilder
that can be used to configure the interaction with the clusterstatic ClusteredDatasetManagerBuilder secureClustered(java.net.URI uri, java.nio.file.Path securityRootDirectory)
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.static ClusteredDatasetManagerBuilder secureClustered(java.lang.Iterable<java.net.InetSocketAddress> servers, java.nio.file.Path securityRootDirectory)
servers
- an Iterable
of InetSocketAddress
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.static EmbeddedDatasetManagerBuilder embedded()
EmbeddedDatasetManagerBuilder
for configuring the interaction with embedded Dataset
instances.
An embedded Dataset
is hosted in-process, possibly with a local persistence layer.
EmbeddedDatasetManagerBuilder
that can be used to configure the interaction with embedded Dataset
instances.static DatasetManager using(DatasetManagerConfiguration datasetManagerConfiguration) throws StoreException
DatasetManager
using the given DatasetManagerConfiguration
and
default ConfigurationMode ConfigurationMode.VALIDATE
datasetManagerConfiguration
- DatasetManager
configurationDatasetManager
instanceStoreException
- if the creation of the DatasetManager
fails or creation/validation fails
using ConfigurationMode ConfigurationMode.VALIDATE
static DatasetManager using(DatasetManagerConfiguration datasetManagerConfiguration, ConfigurationMode configurationMode) throws StoreException
DatasetManager
using the given DatasetManagerConfiguration
and create/validate
Dataset
s as per given ConfigurationMode
datasetManagerConfiguration
- DatasetManager
configurationconfigurationMode
- configurationMode to useDatasetManager
instanceStoreException
- if the creation of the DatasetManager
fails or creation/validation fails
as per given ConfigurationMode
DatasetManagerConfiguration getDatasetManagerConfiguration()
DatasetManagerConfiguration
for this DatasetManager
<K extends java.lang.Comparable<K>> boolean newDataset(java.lang.String name, Type<K> keyType, DatasetConfiguration configuration) throws StoreException
Dataset
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 the Dataset
s created with it.
Multiple DatasetManager
instances connected to the same cluster are equivalent and hence
a clustered dataset created by one would be visible to all others.
K
- the class of the key of the Dataset
name
- the name of the Dataset
keyType
- the type of the key of the Dataset
configuration
- the configuration for the creation of the Dataset
true
if the Dataset
was created, false
if it existed alreadyDatasetKeyTypeMismatchException
- if the named Dataset
exists but with a different key typeStoreException
- if an error occurs creating the Dataset
default <K extends java.lang.Comparable<K>> boolean newDataset(java.lang.String name, Type<K> keyType, DatasetConfigurationBuilder configurationBuilder) throws StoreException
Dataset
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.
K
- the class of the key of the Dataset
name
- the name of the Dataset
keyType
- the type of the key of the Dataset
configurationBuilder
- the configuration builder for the creation of the Dataset
true
if the Dataset
was created, false
if it existed alreadyDatasetKeyTypeMismatchException
- if the named Dataset
exists but with a different key typeStoreException
- if an error occurs creating the Dataset
<K extends java.lang.Comparable<K>> Dataset<K> getDataset(java.lang.String name, Type<K> keyType) throws StoreException
Dataset
with the specified name and key type.K
- the class of the key of the Dataset
name
- the name of the Dataset
to getkeyType
- the type of the key of the Dataset
Dataset
matching name
and keyType
DatasetKeyTypeMismatchException
- if the named Dataset
exists but with a different key typeDatasetMissingException
- if the named Dataset
does not existStoreException
- if an error is encountered while retrieving the Dataset
java.util.Map<java.lang.String,Type<?>> listDatasets() throws StoreException
Dataset
s known to this DatasetManager
.
For an embedded DatasetManager
this means all Dataset
that were created through it. For a clustered
DatasetManager
this means all Dataset
that are known to the cluster it connects to.
Map
with one entry per Dataset
, each entry having the Dataset
name as key and the Dataset
type as value.StoreException
- if anything goes wrong while retrieving the listboolean destroyDataset(java.lang.String name) throws StoreException
Dataset
and all the data it contains.name
- the name of the Dataset
to destroytrue
if the Dataset
was destroyed, false
if it did not existStoreException
- if the Dataset
is in use by another client so could not be destroyed.void close()
close
in interface java.lang.AutoCloseable
DatasetConfigurationBuilder datasetConfiguration()
DatasetConfigurationBuilder
for configuring which resources a Dataset
can use.DatasetConfigurationBuilder
that can be used to configure a Dataset
.