~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

  • Committer: Brian Aker
  • Date: 2009-10-02 19:38:12 UTC
  • mfrom: (1152.1.7 merge)
  • Revision ID: brian@gaz-20091002193812-mpd61oecep74t6gd
Merge Monty + Brian for plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
 
24
24
#include <drizzled/definitions.h>
25
 
#include <drizzled/sql_plugin.h>
 
25
#include <drizzled/plugin.h>
26
26
#include <drizzled/handler_structs.h>
27
27
#include <drizzled/message/table.pb.h>
28
28
#include <drizzled/registry.h>
41
41
typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,
42
42
                             const char *file, uint32_t file_len,
43
43
                             const char *status, uint32_t status_len);
44
 
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
45
44
 
46
45
/* Possible flags of a StorageEngine (there can be 32 of them) */
47
46
enum engine_flag_bits {
69
68
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY);
70
69
 
71
70
class Table;
 
71
 
 
72
namespace drizzled
 
73
{
 
74
namespace plugin
 
75
{
 
76
 
 
77
const std::string UNKNOWN_STRING("UNKNOWN");
 
78
 
72
79
class TableNameIteratorImplementation;
73
 
 
74
80
/*
75
81
  StorageEngine is a singleton structure - one instance per storage engine -
76
82
  to provide access to storage engine functionality that works on the
128
134
 
129
135
  virtual ~StorageEngine();
130
136
 
131
 
  static int getTableProto(const char* path,
132
 
                           drizzled::message::Table *table_proto);
133
 
 
134
137
  virtual int getTableProtoImplementation(const char* path,
135
138
                                          drizzled::message::Table *table_proto)
136
139
    {
187
190
  void enable() { enabled= true; }
188
191
  void disable() { enabled= false; }
189
192
 
190
 
  std::string getName() const { return name; }
 
193
  const std::string &getName() const { return name; }
191
194
 
192
195
  /*
193
196
    StorageEngine methods:
325
328
    (void)database;
326
329
    return NULL;
327
330
  }
 
331
 
 
332
 
 
333
  static bool addPlugin(plugin::StorageEngine *engine);
 
334
  static void removePlugin(plugin::StorageEngine *engine);
 
335
 
 
336
  static int getTableProto(const char* path, message::Table *table_proto);
 
337
 
 
338
  static plugin::StorageEngine *findByName(Session *session,
 
339
                                           std::string find_str);
 
340
  static void closeConnection(Session* session);
 
341
  static void dropDatabase(char* path);
 
342
  static int commitOrRollbackByXID(XID *xid, bool commit);
 
343
  static int releaseTemporaryLatches(Session *session);
 
344
  static bool flushLogs(plugin::StorageEngine *db_type);
 
345
  static int recover(HASH *commit_list);
 
346
  static int startConsistentSnapshot(Session *session);
 
347
  static int deleteTable(Session *session, const char *path, const char *db,
 
348
                         const char *alias, bool generate_warning);
 
349
  static inline const std::string &resolveName(const StorageEngine *engine)
 
350
  {
 
351
    return engine == NULL ? UNKNOWN_STRING : engine->getName();
 
352
  }
 
353
 
328
354
};
329
355
 
330
356
class TableNameIteratorImplementation
343
369
class TableNameIterator
344
370
{
345
371
private:
346
 
  drizzled::Registry<StorageEngine *>::iterator engine_iter;
347
 
  TableNameIteratorImplementation *current_implementation;
348
 
  TableNameIteratorImplementation *default_implementation;
 
372
  ::drizzled::Registry<plugin::StorageEngine *>::iterator engine_iter;
 
373
  plugin::TableNameIteratorImplementation *current_implementation;
 
374
  plugin::TableNameIteratorImplementation *default_implementation;
349
375
  std::string database;
350
376
public:
351
377
  TableNameIterator(const std::string &db);
354
380
  int next(std::string *name);
355
381
};
356
382
 
 
383
 
 
384
} /* namespace plugin */
 
385
} /* namespace drizzled */
 
386
 
357
387
/* lookups */
358
 
StorageEngine *ha_default_storage_engine(Session *session);
359
 
StorageEngine *ha_resolve_by_name(Session *session, std::string find_str);
 
388
/**
 
389
  Return the default storage engine plugin::StorageEngine for thread
 
390
 
 
391
  @param ha_default_storage_engine(session)
 
392
  @param session         current thread
 
393
 
 
394
  @return
 
395
    pointer to plugin::StorageEngine
 
396
*/
 
397
drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session);
360
398
 
361
399
handler *get_new_handler(TableShare *share, MEM_ROOT *alloc,
362
 
                         StorageEngine *db_type);
363
 
const std::string ha_resolve_storage_engine_name(const StorageEngine *db_type);
 
400
                         drizzled::plugin::StorageEngine *db_type);
364
401
 
365
402
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */