elasticluster.repository¶
-
class
elasticluster.repository.AbstractClusterRepository[source]¶ Defines the contract for a cluster repository to store clusters in a persistent state.
-
delete(cluster)[source]¶ Deletes the cluster from persistent state.
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster to delete from persistent state
-
get(name)[source]¶ Retrieves the cluster by the given name.
Parameters: name (str) – name of the cluster (identifier) Returns: instance of elasticluster.cluster.Clusterthat matches the given name
-
get_all()[source]¶ Retrieves all stored clusters from the persistent state.
Returns: list of elasticluster.cluster.Cluster
-
save_or_update(cluster)[source]¶ Save or update the cluster in a persistent state. Elasticluster will call this method multiple times, so the implementation should handle save and update seamlessly
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster object to store
-
-
elasticluster.repository.ClusterRepository¶
-
class
elasticluster.repository.DiskRepository(storage_path)[source]¶ This is a generic repository class that assumes each cluster is saved on a file on disk. It only defines a few methods, to avoid duplication of code.
-
delete(cluster)[source]¶ Deletes the cluster from persistent state.
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster to delete from persistent state
-
get(name)[source]¶ Retrieves the cluster with the given name.
Parameters: name (str) – name of the cluster (identifier) Returns: elasticluster.cluster.Cluster
-
get_all()[source]¶ Retrieves all clusters from the persistent state.
Returns: list of elasticluster.cluster.Cluster
-
save_or_update(cluster)[source]¶ Save or update the cluster to persistent state.
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster to save or update
-
-
class
elasticluster.repository.JsonRepository(storage_path)[source]¶ This implementation of
AbstractClusterRepositorystores the cluster on a file in json format.Parameters: storage_path (str) – path to the folder to store the cluster information
-
class
elasticluster.repository.MemRepository[source]¶ This implementation of
AbstractClusterRepositorystores the clusters in memory, without actually saving the data on disk.-
delete(cluster)[source]¶ Deletes the cluster from memory.
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster to delete
-
get(name)[source]¶ Retrieves the cluster by the given name.
Parameters: name (str) – name of the cluster (identifier) Returns: instance of elasticluster.cluster.Clusterthat matches the given name
-
get_all()[source]¶ Retrieves all stored clusters from the memory.
Returns: list of elasticluster.cluster.Cluster
-
save_or_update(cluster)[source]¶ Save or update the cluster in a memory.
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster object to store
-
-
class
elasticluster.repository.MultiDiskRepository(storage_path, default_store='yaml')[source]¶ This class is able to deal with multiple type of storage types.
-
delete(cluster)[source]¶ Deletes the cluster from persistent state.
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster to delete from persistent state
-
get(name)[source]¶ Retrieves the cluster by the given name.
Parameters: name (str) – name of the cluster (identifier) Returns: instance of elasticluster.cluster.Clusterthat matches the given name
-
get_all()[source]¶ Retrieves all stored clusters from the persistent state.
Returns: list of elasticluster.cluster.Cluster
-
save_or_update(cluster)[source]¶ Save or update the cluster in a persistent state. Elasticluster will call this method multiple times, so the implementation should handle save and update seamlessly
Parameters: cluster ( elasticluster.cluster.Cluster) – cluster object to store
-
-
class
elasticluster.repository.PickleRepository(storage_path)[source]¶ This implementation of
AbstractClusterRepositorystores the cluster on the local disc using pickle. Therefore the cluster object and all its dependencies will be saved in a pickle (binary) file.Parameters: storage_path (str) – path to the folder to store the cluster information
-
class
elasticluster.repository.YamlRepository(storage_path)[source]¶ This implementation of
AbstractClusterRepositorystores the cluster on a file in yaml format.Parameters: storage_path (str) – path to the folder to store the cluster information