summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Reporting/Storage/base.py
blob: 771f755a1965c234ed550f090bdceb5b1aeb689a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
The base for all Storage backends
"""

import logging


class StorageError(Exception):
    """Generic StorageError"""
    pass

class StorageBase(object):
    """The base for all storages"""

    options = []

    __rmi__ = ['Ping', 'GetExtra', 'GetCurrentEntry']

    def __init__(self):
        """Do something here"""
        clsname = self.__class__.__name__
        self.logger = logging.getLogger(clsname)
        self.logger.debug("Loading %s storage" % clsname)

    def import_interaction(self, interaction):
        """Import the data into the backend"""
        raise NotImplementedError

    def validate(self):
        """Validate backend storage.  Should be called once when loaded"""
        raise NotImplementedError

    def shutdown(self):
        """Called at program exit"""
        pass

    def Ping(self):
        """Test for communication with reporting collector"""
        return "Pong"

    def GetExtra(self, client):
        """Return a list of extra entries for a client.  Minestruct"""
        raise NotImplementedError

    def GetCurrentEntry(self, client, e_type, e_name):
        """Get the current status of an entry on the client"""
        raise NotImplementedError