~gearman-developers/gearman-interface/gearman-interface

« back to all changes in this revision

Viewing changes to interface/libgearman/gearman.i

  • Committer: Monty Taylor
  • Date: 2009-07-21 20:41:39 UTC
  • Revision ID: mordred@inaugust.com-20090721204139-rcyse999id1lbu1h
Python worker initial import.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  gearman-interface: Interface Wrappers for Drizzle
 
5
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
6
 *
 
7
 *  This program is free software; you can redistribute it and/or modify
 
8
 *  it under the terms of the GNU General Public License as published by
 
9
 *  the Free Software Foundation; either version 2 of the License, or
 
10
 *  (at your option) any later version.
 
11
 *
 
12
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
20
 */
 
21
 
 
22
 
 
23
%rename(version) gearman_version;
 
24
%rename(bugreport) gearman_bugreport;
 
25
 
 
26
const char *gearman_version(void);
 
27
const char *gearman_bugreport(void);
 
28
 
 
29
%rename(Gearman) gearman;
 
30
 
 
31
class Gearman {};
 
32
 
 
33
 
 
34
%extend Gearman {
 
35
 
 
36
  /* Initialize a library instance structure. */
 
37
  Gearman() {
 
38
    return gearman_create(NULL);
 
39
  }
 
40
 
 
41
  /* Free a library instance structure. */
 
42
  ~Gearman() {
 
43
    gearman_free($self);
 
44
  }
 
45
 
 
46
  /* Clone a library instance structure. */
 
47
  Gearman *copy() {
 
48
    return gearman_clone(NULL, $self);
 
49
  }
 
50
 
 
51
  /* Return an error string for last library error encountered. */
 
52
  const char *error()
 
53
  {
 
54
    return gearman_error($self);
 
55
  }
 
56
 
 
57
  /* Value of errno in the case of a GEARMAN_ERRNO return value. */
 
58
  int errno()
 
59
  {
 
60
    return gearman_errno($self);
 
61
  }
 
62
 
 
63
  void setOptions(gearman_options_t options, uint32_t data)
 
64
  {
 
65
    gearman_set_options($self, options, data);
 
66
  }
 
67
 
 
68
  /**
 
69
   * Set logging callback for gearman instance.
 
70
   * @param gearman Gearman instance structure previously initialized with
 
71
   *        gearman_create.
 
72
   * @param log_fn Function to call when there is a logging message.
 
73
   * @param log_fn_arg Argument to pass into the log callback function.
 
74
   * @param verbose Verbosity level.
 
75
   */
 
76
/*TODO:
 
77
  void gearman_set_log(gearman_st *gearman, gearman_log_fn log_fn,
 
78
                       void *log_fn_arg, gearman_verbose_t verbose);
 
79
*/
 
80
 
 
81
  /**
 
82
   * Set custom I/O event callbacks for a gearman structure.
 
83
   */
 
84
/*TODO:
 
85
  void gearman_set_event_watch(gearman_st *gearman,
 
86
                               gearman_event_watch_fn *event_watch,
 
87
                               void *event_watch_arg);
 
88
*/
 
89
 
 
90
 
 
91
};