~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

  • Committer: Brian Aker
  • Date: 2010-10-08 16:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 1834.
  • Revision ID: brian@tangent.org-20101008161147-o3us2a8itszsaycx
Typdef our lock type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_PLUGIN_H
21
21
#define DRIZZLED_PLUGIN_H
22
22
 
23
 
#include <drizzled/lex_string.h>
24
 
#include <drizzled/xid.h>
25
 
#include <drizzled/plugin/manifest.h>
26
 
#include <drizzled/plugin/module.h>
 
23
#include "drizzled/module/manifest.h"
 
24
#include "drizzled/module/module.h"
27
25
#include "drizzled/plugin/version.h"
 
26
#include "drizzled/module/context.h"
28
27
#include "drizzled/definitions.h"
29
 
#include "drizzled/plugin/context.h"
30
28
 
 
29
#include "drizzled/lex_string.h"
 
30
#include "drizzled/xid.h"
 
31
#include <boost/program_options.hpp>
31
32
 
32
33
namespace drizzled
33
34
{
45
46
typedef drizzle_lex_string LEX_STRING;
46
47
struct option;
47
48
 
48
 
extern char *opt_plugin_add;
49
 
extern char *opt_plugin_remove;
50
 
extern char *opt_plugin_load;
51
 
extern char *opt_plugin_dir_ptr;
52
49
extern char opt_plugin_dir[FN_REFLEN];
53
50
 
54
51
namespace plugin { class StorageEngine; }
56
53
/*
57
54
  Macros for beginning and ending plugin declarations. Between
58
55
  DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
59
 
  be a plugin::Manifest for each plugin to be declared.
 
56
  be a module::Manifest for each plugin to be declared.
60
57
*/
61
58
 
62
59
 
63
60
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
64
61
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
65
62
#define DRIZZLE_DECLARE_PLUGIN \
66
 
  ::drizzled::plugin::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
 
63
  ::drizzled::module::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
67
64
 
68
65
 
69
66
#define DRIZZLE_DECLARE_PLUGIN_END
70
 
#define DRIZZLE_PLUGIN(init,system) \
 
67
#define DRIZZLE_PLUGIN(init,system,options) \
71
68
  DRIZZLE_DECLARE_PLUGIN \
72
69
  { \
73
70
    DRIZZLE_VERSION_ID, \
76
73
    STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
77
74
    STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
78
75
    PANDORA_MODULE_LICENSE, \
79
 
    init, system, NULL \
 
76
    init, system, options \
80
77
  } 
81
78
 
82
79
 
87
84
{
88
85
  SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
89
86
  SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
90
 
  SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG,
 
87
  SHOW_FUNC,
91
88
  SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS,
92
89
  SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_INT_NOFLUSH,
93
90
  SHOW_LONGLONG_STATUS, SHOW_DOUBLE, SHOW_SIZE
188
185
  mysql_var_check_func check;   \
189
186
  mysql_var_update_func update
190
187
 
191
 
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
 
188
#define DRIZZLE_SYSVAR_NAME(name) drizzle_sysvar_ ## name
192
189
#define DRIZZLE_SYSVAR(name) \
193
190
  ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
194
191
 
371
368
  Miscellaneous functions for plugin implementors
372
369
*/
373
370
 
374
 
#ifdef __cplusplus
375
 
extern "C" {
376
 
#endif
377
 
 
378
 
extern bool plugin_init(plugin::Registry &registry,
379
 
                        int *argc, char **argv,
380
 
                        bool skip_init);
381
 
extern void plugin_shutdown(plugin::Registry &plugins);
 
371
extern bool plugin_init(module::Registry &registry,
 
372
                        boost::program_options::options_description &long_options);
 
373
extern bool plugin_finalize(module::Registry &registry);
382
374
extern void my_print_help_inc_plugins(option *options);
383
375
extern bool plugin_is_ready(const LEX_STRING *name, int type);
384
376
extern void plugin_sessionvar_init(Session *session);
391
383
const char *get_session_proc_info(Session *session);
392
384
int64_t session_test_options(const Session *session, int64_t test_options);
393
385
int session_sql_command(const Session *session);
394
 
int session_tx_isolation(const Session *session);
 
386
enum_tx_isolation session_tx_isolation(const Session *session);
395
387
 
 
388
void compose_plugin_add(std::vector<std::string> options);
 
389
void compose_plugin_remove(std::vector<std::string> options);
 
390
void notify_plugin_load(std::string in_plugin_load);
396
391
 
397
392
 
398
393
/**
426
421
int session_killed(const Session *session);
427
422
 
428
423
 
429
 
/**
430
 
  Return the thread id of a user thread
431
 
 
432
 
  @param session  user thread connection handle
433
 
  @return  thread id
434
 
*/
435
 
unsigned long session_get_thread_id(const Session *session);
436
 
 
437
424
const charset_info_st *session_charset(Session *session);
438
 
int session_non_transactional_update(const Session *session);
439
 
void session_mark_transaction_to_rollback(Session *session, bool all);
440
 
 
441
 
 
442
 
/**
443
 
  Allocate memory in the connection's local memory pool
444
 
 
445
 
  @details
446
 
  When properly used in place of @c malloc(), this can significantly
447
 
  improve concurrency. Don't use this or related functions to allocate
448
 
  large chunks of memory. Use for temporary storage only. The memory
449
 
  will be freed automatically at the end of the statement; no explicit
450
 
  code is required to prevent memory leaks.
451
 
 
452
 
  @see alloc_root()
453
 
*/
454
 
void *session_alloc(Session *session, unsigned int size);
455
 
/**
456
 
  @see session_alloc()
457
 
*/
458
 
void *session_calloc(Session *session, unsigned int size);
459
 
/**
460
 
  @see session_alloc()
461
 
*/
462
 
char *session_strdup(Session *session, const char *str);
463
 
/**
464
 
  @see session_alloc()
465
 
*/
466
 
char *session_strmake(Session *session, const char *str, unsigned int size);
467
 
/**
468
 
  @see session_alloc()
469
 
*/
470
 
void *session_memdup(Session *session, const void* str, unsigned int size);
471
 
 
472
 
/**
473
 
  Get the XID for this connection's transaction
474
 
 
475
 
  @param session  user thread connection handle
476
 
  @param xid  location where identifier is stored
477
 
*/
478
 
void session_get_xid(const Session *session, DRIZZLE_XID *xid);
479
425
 
480
426
/**
481
427
  Invalidate the query cache for a given table.
489
435
                                   const char *key, unsigned int key_length,
490
436
                                   int using_trx);
491
437
 
492
 
#ifdef __cplusplus
493
 
}
494
 
#endif
495
 
 
496
438
} /* namespace drizzled */
497
439
 
498
440
#endif /* DRIZZLED_PLUGIN_H */