~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/pbms_enabled.h

Added the PBMS daemon plugin.

(Augen zu und durch!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2009 PrimeBase Technologies GmbH, Germany
 
2
 *
 
3
 * PrimeBase Media Stream for MySQL
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
18
 *
 
19
 * Barry Leslie
 
20
 *
 
21
 * 2009-07-16
 
22
 *
 
23
 * H&G2JCtL
 
24
 *
 
25
 * PBMS interface used to enable engines for use with the PBMS daemon.
 
26
 *
 
27
 * For an example on how to build this into an engine have a look at the PBXT engine
 
28
 * in file ha_pbxt.cc. Search for 'PBMS_ENABLED'.
 
29
 *
 
30
 */
 
31
 
 
32
 
 
33
#ifndef __PBMS_ENABLED_H__
 
34
#define __PBMS_ENABLED_H__
 
35
 
 
36
#include "pbms.h"
 
37
 
 
38
#ifdef DRIZZLED
 
39
#include <drizzled/server_includes.h>
 
40
#define TABLE Table
 
41
#define uchar unsigned char
 
42
#else
 
43
#include <mysql_priv.h>
 
44
#endif
 
45
 
 
46
class Field;
 
47
typedef bool (*IsPBMSFilterFunc)(Field *field);
 
48
 
 
49
/*
 
50
 * pbms_initialize() should be called from the engines plugIn's 'init()' function.
 
51
 * The engine_name is the name of your engine, "PBXT" or "InnoDB" for example.
 
52
 *
 
53
 * The isServer flag indicates if this entire server is being enabled. This is only
 
54
 * true if this is being built into the server's handler code above the engine level
 
55
 * calls. 
 
56
 */
 
57
extern bool pbms_initialize(const char *engine_name, bool isServer, bool isTransactional, PBMSResultPtr result, IsPBMSFilterFunc is_pbms_blob);
 
58
 
 
59
/*
 
60
 * pbms_finalize() should be called from the engines plugIn's 'deinit()' function.
 
61
 */
 
62
extern void pbms_finalize(const char *engine_name);
 
63
 
 
64
/*
 
65
 * pbms_write_row_blobs() should be called from the engine's 'write_row' function.
 
66
 * It can alter the row data so it must be called before any other function using the row data.
 
67
 * It should also be called from engine's 'update_row' function for the new row.
 
68
 *
 
69
 * pbms_completed() must be called after calling pbms_write_row_blobs() and just before
 
70
 * returning from write_row() to indicate if the operation completed successfully.
 
71
 */
 
72
extern int pbms_write_row_blobs(TABLE *table, unsigned char *buf, PBMSResultPtr result);
 
73
 
 
74
/*
 
75
 * pbms_delete_row_blobs() should be called from the engine's 'delete_row' function.
 
76
 * It should also be called from engine's 'update_row' function for the old row.
 
77
 *
 
78
 * pbms_completed() must be called after calling pbms_delete_row_blobs() and just before
 
79
 * returning from delete_row() to indicate if the operation completed successfully.
 
80
 */
 
81
extern int pbms_delete_row_blobs(TABLE *table, const unsigned char *buf, PBMSResultPtr result);
 
82
 
 
83
/*
 
84
 * pbms_rename_table_with_blobs() should be called from the engine's 'rename_table' function.
 
85
 *
 
86
 * NOTE: Renaming tables across databases is not supported.
 
87
 *
 
88
 * pbms_completed() must be called after calling pbms_rename_table_with_blobs() and just before
 
89
 * returning from rename_table() to indicate if the operation completed successfully.
 
90
 */
 
91
extern int pbms_rename_table_with_blobs(const char *old_table_path, const char *new_table_path, PBMSResultPtr result);
 
92
 
 
93
/*
 
94
 * pbms_delete_table_with_blobs() should be called from the engine's 'delete_table' function.
 
95
 *
 
96
 * NOTE: Currently pbms_delete_table_with_blobs() cannot be undone so it should only
 
97
 * be called after the host engine has performed successfully drop it's table.
 
98
 *
 
99
 * pbms_completed() must be called after calling pbms_delete_table_with_blobs() and just before
 
100
 * returning from delete_table() to indicate if the operation completed successfully.
 
101
 */
 
102
extern int pbms_delete_table_with_blobs(const char *table_path, PBMSResultPtr result);
 
103
 
 
104
/*
 
105
 * pbms_completed() must be called to indicate success or failure of a an operation after having
 
106
 * called  pbms_write_row_blobs(), pbms_delete_row_blobs(), pbms_rename_table_with_blobs(), or
 
107
 * pbms_delete_table_with_blobs().
 
108
 *
 
109
 * pbms_completed() has the effect of committing or rolling back the changes made if the session
 
110
 * is in 'autocommit' mode.
 
111
 */
 
112
extern void pbms_completed(TABLE *table, bool ok);
 
113
 
 
114
#endif