Datastores

DTrove Datastore Base Classes

The base classes that define the interface for all datastores.

If you wish to create your own datastore, simply subclass the base and override the methods you need to for example:

from dtrove.datastores import base
from dtrove.commands import run

class MyBackyardDBManager(base.BaseManager):

    def backup():
        with self.conn as connection:
            run('/bin/bash my_backup.sh')

    @property
    def name():
        return 'ClassNameOverriddenDB'

Templates for the managers live in dtrove/datastores/<manager_name> where manager name by default is the lowercase manager name with the ‘Manager’ removed. For example ‘MySQLManager’ would be ‘mysql’.

More on templates later.

class dtrove.datastores.base.BaseManager(datastore)

Manager Base

Parameters:datastore – The actual datastore version that is being managed. The datastores have the image and package information to install on the guest vm’s.
backup(instance)

Preform a backup on the remote instance.

name

Returns the name of the manager ex: MySQLManager = mysql

prepare(instance)

Install and configure the datastore on the instance.

render_config_file(instance)

Load and render a config file for this datastore.

restart()

Restart the datastore.

service_name = None

Name of the service ie ‘mysql’

start()

Start the datastore

stop()

Stop the datastore

Implementations

This is a list of the current built in Managers

  • dtrove.datastores.mysql.MySQLManager
  • dtrove.datastores.redis.RedisManager
  • dtrove.datastores.pgsql.PostgresManager