~drizzle-trunk/drizzle/development

971.3.37 by Eric Day
Fixed copyright on gearman_udf plugin, was on Sun time. :)
1
/* Copyright (C) 2009 Sun Microsystems
971.3.33 by Eric Day
Gearman UDFs complete.
2
3
   This program is free software; you can redistribute it and/or modify
4
   it under the terms of the GNU General Public License as published by
5
   the Free Software Foundation; version 2 of the License.
6
7
   This program is distributed in the hope that it will be useful,
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
   GNU General Public License for more details.
11
12
   You should have received a copy of the GNU General Public License
13
   along with this program; if not, write to the Free Software
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
1122.2.10 by Monty Taylor
Fixed all of the include guards.
16
#ifndef PLUGIN_GEARMAN_UDF_GMAN_DO_H
17
#define PLUGIN_GEARMAN_UDF_GMAN_DO_H
18
971.3.33 by Eric Day
Gearman UDFs complete.
19
#include <drizzled/item/func.h>
20
#include <drizzled/function/str/strfunc.h>
21
22
#include <libgearman/gearman.h>
23
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
24
class Item_func_gman_do :public drizzled::Item_str_func
971.3.33 by Eric Day
Gearman UDFs complete.
25
{
26
protected:
27
  typedef enum
28
  {
29
    GMAN_DO_OPTIONS_NONE=       0,
30
    GMAN_DO_OPTIONS_HIGH=       (1 << 0),
31
    GMAN_DO_OPTIONS_LOW=        (1 << 1),
32
    GMAN_DO_OPTIONS_BACKGROUND= (1 << 2),
33
    GMAN_DO_OPTIONS_CLIENT=     (1 << 3)
34
  } gman_do_options_t;
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
35
36
private:
971.3.33 by Eric Day
Gearman UDFs complete.
37
  gman_do_options_t options;
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
38
  gearman_client_st client;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
39
  drizzled::String buffer;
971.3.33 by Eric Day
Gearman UDFs complete.
40
41
public:
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
42
  Item_func_gman_do():
43
    Item_str_func(),
44
    options(GMAN_DO_OPTIONS_NONE) {}
45
  Item_func_gman_do(gman_do_options_t options_arg):
46
    Item_str_func(),
47
    options(options_arg) {}
971.3.33 by Eric Day
Gearman UDFs complete.
48
  ~Item_func_gman_do();
49
  void fix_length_and_dec() { max_length=10; }
50
  virtual const char *func_name() const{ return "gman_do"; }
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
51
  drizzled::String *val_str(drizzled::String *);
971.3.33 by Eric Day
Gearman UDFs complete.
52
  void *realloc(size_t size);
53
};
54
55
class Item_func_gman_do_high :public Item_func_gman_do
56
{
57
public:
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
58
  Item_func_gman_do_high():
59
    Item_func_gman_do(GMAN_DO_OPTIONS_HIGH) {}
971.3.33 by Eric Day
Gearman UDFs complete.
60
  const char *func_name() const{ return "gman_do_high"; }
61
};
62
63
class Item_func_gman_do_low :public Item_func_gman_do
64
{
65
public:
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
66
  Item_func_gman_do_low():
67
    Item_func_gman_do(GMAN_DO_OPTIONS_LOW) {}
971.3.33 by Eric Day
Gearman UDFs complete.
68
  const char *func_name() const{ return "gman_do_low"; }
69
};
70
71
class Item_func_gman_do_background :public Item_func_gman_do
72
{
73
public:
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
74
  Item_func_gman_do_background():
75
    Item_func_gman_do(GMAN_DO_OPTIONS_BACKGROUND) {}
971.3.33 by Eric Day
Gearman UDFs complete.
76
  const char *func_name() const{ return "gman_do_background"; }
77
};
78
79
class Item_func_gman_do_high_background :public Item_func_gman_do
80
{
81
public:
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
82
  Item_func_gman_do_high_background():
83
    Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_HIGH |
84
                                          GMAN_DO_OPTIONS_BACKGROUND)) {}
971.3.33 by Eric Day
Gearman UDFs complete.
85
  const char *func_name() const{ return "gman_do_high_background"; }
86
};
87
88
class Item_func_gman_do_low_background :public Item_func_gman_do
89
{
90
public:
971.3.34 by Eric Day
Merged trunk, fixed gearman_udf plugin to use new plugin system.
91
  Item_func_gman_do_low_background():
92
    Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_LOW |
93
                                         GMAN_DO_OPTIONS_BACKGROUND)) {}
971.3.33 by Eric Day
Gearman UDFs complete.
94
  const char *func_name() const{ return "gman_do_low_background"; }
95
};
1122.2.10 by Monty Taylor
Fixed all of the include guards.
96
97
#endif /* PLUGIN_GEARMAN_UDF_GMAN_DO_H */