~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

  • Committer: Mark Atwood
  • Date: 2011-08-12 04:08:33 UTC
  • mfrom: (2385.2.17 refactor5)
  • Revision ID: me@mark.atwood.name-20110812040833-u6j85nc6ahuc0dtz
mergeĀ lp:~olafvdspek/drizzle/refactor5

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_PLUGIN_STORAGE_ENGINE_H
21
 
#define DRIZZLED_PLUGIN_STORAGE_ENGINE_H
22
 
 
23
 
 
24
 
#include <drizzled/cached_directory.h>
 
20
#pragma once
 
21
 
25
22
#include <drizzled/definitions.h>
26
23
#include <drizzled/error_t.h>
27
24
#include <drizzled/handler_structs.h>
28
 
#include <drizzled/identifier.h>
29
25
#include <drizzled/message.h>
30
26
#include <drizzled/message/cache.h>
31
27
#include <drizzled/plugin.h>
40
36
 
41
37
#include <drizzled/visibility.h>
42
38
 
43
 
namespace drizzled
44
 
{
45
 
 
46
 
class TableList;
47
 
class Session;
48
 
class Cursor;
49
 
typedef struct st_hash HASH;
50
 
 
51
 
class TableShare;
 
39
namespace drizzled {
 
40
 
 
41
struct HASH;
 
42
 
52
43
typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,
53
44
                             const char *file, uint32_t file_len,
54
45
                             const char *status, uint32_t status_len);
113
104
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_FOREIGN_KEYS(1 << HTON_BIT_FOREIGN_KEYS);
114
105
 
115
106
 
116
 
class Table;
117
 
class NamedSavepoint;
118
 
 
119
 
namespace plugin
120
 
{
 
107
namespace plugin {
121
108
 
122
109
typedef std::vector<StorageEngine *> EngineVector;
123
110
 
179
166
    return table_definition_ext;
180
167
  }
181
168
 
 
169
  virtual message::Table::Index::IndexType default_index_type() const
 
170
  {
 
171
    return message::Table::Index::BTREE;
 
172
  }
 
173
 
182
174
private:
183
175
  std::vector<std::string> aliases;
184
176
 
204
196
  pthread_mutex_t proto_cache_mutex;
205
197
 
206
198
public:
207
 
  StorageEngine(const std::string name_arg,
 
199
  StorageEngine(const std::string &name_arg,
208
200
                const std::bitset<HTON_BIT_SIZE> &flags_arg= HTON_NO_FLAGS);
209
201
 
210
202
  virtual ~StorageEngine();
282
274
  virtual int doCreateTable(Session &session,
283
275
                            Table &table_arg,
284
276
                            const drizzled::identifier::Table &identifier,
285
 
                            message::Table &message)= 0;
 
277
                            const message::Table &message)= 0;
286
278
 
287
279
  virtual int doRenameTable(Session &session,
288
280
                            const drizzled::identifier::Table &from, const drizzled::identifier::Table &to)= 0;
292
284
 
293
285
  virtual void doGetTableIdentifiers(CachedDirectory &directory,
294
286
                                     const drizzled::identifier::Schema &schema_identifier,
295
 
                                     identifier::Table::vector &set_of_identifiers)= 0;
 
287
                                     identifier::table::vector &set_of_identifiers)= 0;
296
288
 
297
289
  virtual bool doDoesTableExist(Session& session, const drizzled::identifier::Table &identifier);
298
290
 
333
325
  static plugin::StorageEngine *findByName(const std::string &find_str);
334
326
  static plugin::StorageEngine *findByName(Session& session, const std::string &find_str);
335
327
 
336
 
  static void closeConnection(Session* session);
 
328
  static void closeConnection(Session&);
337
329
  static void dropDatabase(char* path);
338
330
  static bool flushLogs(plugin::StorageEngine *db_type);
339
331
 
345
337
 
346
338
  static bool dropTable(Session& session,
347
339
                        StorageEngine &engine,
348
 
                        identifier::Table::const_reference identifier,
 
340
                        const identifier::Table& identifier,
349
341
                        drizzled::error_t &error);
350
342
 
351
343
  static void getIdentifiers(Session &session,
352
344
                             const identifier::Schema &schema_identifier,
353
 
                             identifier::Table::vector &set_of_identifiers);
 
345
                             identifier::table::vector &set_of_identifiers);
354
346
 
355
347
  // Check to see if any SE objects to creation.
356
348
  static bool canCreateTable(const drizzled::identifier::Table &identifier);
357
349
 
358
350
  // @note All schema methods defined here
359
 
  static void getIdentifiers(Session &session, identifier::Schema::vector &schemas);
 
351
  static void getIdentifiers(Session &session, identifier::schema::vector &schemas);
360
352
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Table &identifier);
361
353
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Schema &identifier);
362
354
  static bool doesSchemaExist(const drizzled::identifier::Schema &identifier);
363
 
  static const CHARSET_INFO *getSchemaCollation(const drizzled::identifier::Schema &identifier);
 
355
  static const charset_info_st *getSchemaCollation(const drizzled::identifier::Schema &identifier);
364
356
  static bool createSchema(const drizzled::message::Schema &schema_message);
365
357
  static bool dropSchema(Session &session,
366
 
                         identifier::Schema::const_reference identifier,
 
358
                         const identifier::Schema& identifier,
367
359
                         message::schema::const_reference schema_message);
368
360
  static bool alterSchema(const drizzled::message::Schema &schema_message);
369
361
 
370
362
  // @note make private/protected
371
363
protected:
372
 
  virtual void doGetSchemaIdentifiers(identifier::Schema::vector&)
 
364
  virtual void doGetSchemaIdentifiers(identifier::schema::vector&)
373
365
  { }
374
366
 
375
367
  virtual drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&)
422
414
protected:
423
415
  static int deleteDefinitionFromPath(const drizzled::identifier::Table &identifier);
424
416
  static int renameDefinitionFromPath(const drizzled::identifier::Table &dest, const drizzled::identifier::Table &src);
425
 
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, message::Table &proto);
 
417
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, const message::Table &proto);
426
418
  static bool readTableFile(const std::string &path, message::Table &table_message);
427
419
 
428
420
public:
465
457
} /* namespace plugin */
466
458
} /* namespace drizzled */
467
459
 
468
 
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */