~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

Merge trunk and resolve all conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <drizzled/handler_structs.h>
27
27
#include <drizzled/message/table.pb.h>
28
28
#include "drizzled/plugin/plugin.h"
29
 
#include <drizzled/registry.h>
 
29
#include <drizzled/name_map.h>
30
30
 
31
31
#include <bitset>
32
32
#include <string>
35
35
class TableList;
36
36
class Session;
37
37
class XID;
38
 
class handler;
 
38
class Cursor;
39
39
 
40
40
class TableShare;
41
41
typedef struct st_mysql_lex_string LEX_STRING;
81
81
/*
82
82
  StorageEngine is a singleton structure - one instance per storage engine -
83
83
  to provide access to storage engine functionality that works on the
84
 
  "global" level (unlike handler class that works on a per-table basis)
 
84
  "global" level (unlike Cursor class that works on a per-table basis)
85
85
 
86
86
  usually StorageEngine instance is defined statically in ha_xxx.cc as
87
87
 
97
97
  const bool two_phase_commit;
98
98
  bool enabled;
99
99
 
100
 
  const std::bitset<HTON_BIT_SIZE> flags; /* global handler flags */
 
100
  const std::bitset<HTON_BIT_SIZE> flags; /* global Cursor flags */
101
101
  /*
102
102
    to store per-savepoint data storage engine is provided with an area
103
103
    of a requested size (0 is ok here).
237
237
  virtual int  recover(XID *, uint32_t) { return 0; }
238
238
  virtual int  commit_by_xid(XID *) { return 0; }
239
239
  virtual int  rollback_by_xid(XID *) { return 0; }
240
 
  virtual handler *create(TableShare *, MEM_ROOT *)= 0;
 
240
  virtual Cursor *create(TableShare *, MEM_ROOT *)= 0;
241
241
  /* args: path */
242
242
  virtual void drop_database(char*) { }
243
243
  virtual int start_consistent_snapshot(Session *) { return 0; }
255
255
  /**
256
256
    If frm_error() is called then we will use this to find out what file
257
257
    extentions exist for the storage engine. This is also used by the default
258
 
    rename_table and delete_table method in handler.cc.
 
258
    rename_table and delete_table method in Cursor.cc.
259
259
 
260
260
    For engines that have two file name extentions (separate meta/index file
261
261
    and data file), the order of elements is relevant. First element of engine
340
340
    return engine == NULL ? UNKNOWN_STRING : engine->getName();
341
341
  }
342
342
 
 
343
  /**
 
344
   * Return the default storage engine plugin::StorageEngine for thread
 
345
   *
 
346
   * defaultStorageEngine(session)
 
347
   * @param session         current thread
 
348
   *
 
349
   * @return
 
350
   *   pointer to plugin::StorageEngine
 
351
   */
 
352
  static StorageEngine *defaultStorageEngine(Session *session);
 
353
 
343
354
  static int createTable(Session *session, const char *path,
344
355
                         const char *db, const char *table_name,
345
356
                         HA_CREATE_INFO *create_info,
346
357
                         bool update_create_info,
347
358
                         drizzled::message::Table *table_proto);
 
359
 
 
360
  Cursor *getCursor(TableShare *share, MEM_ROOT *alloc);
348
361
};
349
362
 
350
363
class TableNameIteratorImplementation
363
376
class TableNameIterator
364
377
{
365
378
private:
366
 
  ::drizzled::Registry<plugin::StorageEngine *>::iterator engine_iter;
 
379
  NameMap<plugin::StorageEngine *>::iterator engine_iter;
367
380
  plugin::TableNameIteratorImplementation *current_implementation;
368
381
  plugin::TableNameIteratorImplementation *default_implementation;
369
382
  std::string database;
378
391
} /* namespace plugin */
379
392
} /* namespace drizzled */
380
393
 
381
 
/* lookups */
382
 
/**
383
 
  Return the default storage engine plugin::StorageEngine for thread
384
 
 
385
 
  @param ha_default_storage_engine(session)
386
 
  @param session         current thread
387
 
 
388
 
  @return
389
 
    pointer to plugin::StorageEngine
390
 
*/
391
 
drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session);
392
 
 
393
 
handler *get_new_handler(TableShare *share, MEM_ROOT *alloc,
394
 
                         drizzled::plugin::StorageEngine *db_type);
395
 
 
396
394
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */