Revision 0c8299f1 include/LogDB.h

View differences:

include/LogDB.h
27 27
class LogDB : public SqlDB, Callbackable
28 28
{
29 29
public:
30
    LogDB(SqlDB * _db):db(_db), next_index(0)
31
    {
32
        pthread_mutex_init(&mutex, 0);
33
    };
34

  
35
    virtual ~LogDB()
36
    {
37
        std::map<unsigned int, LogDBRequest *>::iterator it;
38

  
39
        for ( it = requests.begin(); it != requests.end(); ++it )
40
        {
41
            delete it->second;
42
        }
30
    LogDB(SqlDB * _db);
43 31

  
44
        delete db;
45
    };
32
    virtual ~LogDB();
46 33

  
47 34
    /**
48 35
     *  Return the request associated to the given logdb record. If there is
......
90 77
    // -------------------------------------------------------------------------
91 78
    // Database methods
92 79
    // -------------------------------------------------------------------------
93
    int bootstrap()
80
    static int bootstrap(SqlDB *_db)
94 81
    {
95 82
        ostringstream oss(db_bootstrap);
96 83

  
97
        return db->exec_local_wr(oss);
84
        return _db->exec_local_wr(oss);
98 85
    }
99 86

  
100 87
protected:
......
132 119
    static const char * db_bootstrap;
133 120

  
134 121
    /**
122
     *  Callback to initialize the next_index varibale.
123
     */
124
    int init_cb(void *nil, int num, char **values, char **names);
125

  
126
    /**
135 127
     *  This function loads a log record from the database and returns the an
136 128
     *  associated replication request
137 129
     *    @param index of the record

Also available in: Unified diff