~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/slot/storage_engine.h

Split StorageEngine into slot. This completes the plugin-slot-reorg. Woot.
Next step - getting slot registration to inject a plugin reference into a
registry so that we can make I_S.PLUGINS stop being broken.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2009 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef DRIZZLED_SLOT_STORAGE_ENGINE_H
 
21
#define DRIZZLED_SLOT_STORAGE_ENGINE_H
 
22
 
 
23
#include "drizzled/registry.h"
 
24
 
 
25
#include <string>
 
26
 
 
27
class Session;
 
28
class XID;
 
29
typedef struct st_hash HASH;
 
30
 
 
31
namespace drizzled
 
32
{
 
33
 
 
34
namespace plugin
 
35
{
 
36
  class StorageEngine;
 
37
  class TableNameIteratorImplementation;
 
38
}
 
39
 
 
40
namespace message
 
41
{
 
42
  class Table;
 
43
}
 
44
 
 
45
namespace slot
 
46
{
 
47
 
 
48
/**
 
49
 * Class to handle all Storage Engine plugins
 
50
 */
 
51
class StorageEngine
 
52
{
 
53
private:
 
54
 
 
55
  Registry<plugin::StorageEngine *> all_engines;
 
56
 
 
57
public:
 
58
 
 
59
  StorageEngine();
 
60
  ~StorageEngine();
 
61
 
 
62
  void add(plugin::StorageEngine *engine);
 
63
  void remove(plugin::StorageEngine *engine);
 
64
 
 
65
  Registry<plugin::StorageEngine *>::iterator begin()
 
66
  {
 
67
    return all_engines.begin();
 
68
  }
 
69
 
 
70
  Registry<plugin::StorageEngine *>::iterator end()
 
71
  {
 
72
    return all_engines.end();
 
73
  }
 
74
 
 
75
  int getTableProto(const char* path, message::Table *table_proto);
 
76
 
 
77
  plugin::StorageEngine *findByName(Session *session,
 
78
                                    std::string find_str);
 
79
  void closeConnection(Session* session);
 
80
  void dropDatabase(char* path);
 
81
  int commitOrRollbackByXID(XID *xid, bool commit);
 
82
  int releaseTemporaryLatches(Session *session);
 
83
  bool flushLogs(plugin::StorageEngine *db_type);
 
84
  int recover(HASH *commit_list);
 
85
  int startConsistentSnapshot(Session *session);
 
86
  int deleteTable(Session *session, const char *path, const char *db,
 
87
                  const char *alias, bool generate_warning);
 
88
 
 
89
};
 
90
 
 
91
class TableNameIterator
 
92
{
 
93
private:
 
94
  Registry<plugin::StorageEngine *>::iterator engine_iter;
 
95
  plugin::TableNameIteratorImplementation *current_implementation;
 
96
  plugin::TableNameIteratorImplementation *default_implementation;
 
97
  std::string database;
 
98
public:
 
99
  TableNameIterator(const std::string &db);
 
100
  ~TableNameIterator();
 
101
 
 
102
  int next(std::string *name);
 
103
};
 
104
 
 
105
} /* namespace slot */
 
106
} /* namespace drizzled */
 
107
 
 
108
/**
 
109
  Return the storage engine plugin::StorageEngine for the supplied name
 
110
 
 
111
  @param session         current thread
 
112
  @param name        name of storage engine
 
113
 
 
114
  @return
 
115
    pointer to storage engine plugin handle
 
116
*/
 
117
drizzled::plugin::StorageEngine *ha_resolve_by_name(Session *session,
 
118
                                                    const std::string &find_str);
 
119
 
 
120
void ha_close_connection(Session* session);
 
121
void ha_drop_database(char* path);
 
122
int ha_commit_or_rollback_by_xid(XID *xid, bool commit);
 
123
 
 
124
/* report to InnoDB that control passes to the client */
 
125
int ha_release_temporary_latches(Session *session);
 
126
bool ha_flush_logs(drizzled::plugin::StorageEngine *db_type);
 
127
int ha_recover(HASH *commit_list);
 
128
int ha_start_consistent_snapshot(Session *session);
 
129
int ha_delete_table(Session *session, const char *path,
 
130
                    const char *db, const char *alias, bool generate_warning);
 
131
 
 
132
#endif /* DRIZZLED_SLOT_STORAGE_ENGINE_H */