Browse Source

Split client callbaks out to their own file.

Brian Aker 14 years ago
parent
commit
fcd8870f0d
4 changed files with 69 additions and 24 deletions
  1. 59 0
      libgearman/client_callbacks.h
  2. 8 24
      libgearman/constants.h
  3. 1 0
      libgearman/gearman.h
  4. 1 0
      libgearman/include.am

+ 59 - 0
libgearman/client_callbacks.h

@@ -0,0 +1,59 @@
+/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ * 
+ *  Gearmand client and server library.
+ *
+ *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *  Copyright (C) 2008 Brian Aker, Eric Day
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *      * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ *
+ *      * Redistributions in binary form must reproduce the above
+ *  copyright notice, this list of conditions and the following disclaimer
+ *  in the documentation and/or other materials provided with the
+ *  distribution.
+ *
+ *      * The names of its contributors may not be used to endorse or
+ *  promote products derived from this software without specific prior
+ *  written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Client callbacks
+typedef gearman_return_t (gearman_workload_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_created_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_data_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_warning_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_universal_status_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_complete_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_exception_fn)(gearman_task_st *task);
+typedef gearman_return_t (gearman_fail_fn)(gearman_task_st *task);
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 24
libgearman/constants.h

@@ -147,14 +147,6 @@ typedef enum
   GEARMAN_WORKER_MAX=   (1 << 10)
 } gearman_worker_options_t;
 
-/**
- * @addtogroup gearman_types Types
- * @ingroup gearman_universal
- * @ingroup gearman_client
- * @ingroup gearman_worker
- * @{
- */
-
 /* Types. */
 typedef struct gearman_packet_st gearman_packet_st;
 typedef struct gearman_task_st gearman_task_st;
@@ -166,26 +158,10 @@ typedef struct gearman_result_st gearman_result_st;
 typedef struct gearman_string_t gearman_string_t;
 typedef struct gearman_argument_t gearman_argument_t;
 
-/* Function types. */
-typedef gearman_return_t (gearman_workload_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_created_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_data_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_warning_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_universal_status_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_complete_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_exception_fn)(gearman_task_st *task);
-typedef gearman_return_t (gearman_fail_fn)(gearman_task_st *task);
-
 typedef gearman_return_t (gearman_parse_server_fn)(const char *host,
                                                    in_port_t port,
                                                    void *context);
 
-typedef void* (gearman_worker_fn)(gearman_job_st *job, void *context,
-                                  size_t *result_size,
-                                  gearman_return_t *ret_ptr);
-
-typedef gearman_worker_error_t (gearman_mapper_fn)(gearman_job_st *job, void *context);
-
 typedef void* (gearman_malloc_fn)(size_t size, void *context);
 typedef void (gearman_free_fn)(void *ptr, void *context);
 
@@ -194,6 +170,14 @@ typedef void (gearman_task_context_free_fn)(gearman_task_st *task, void *context
 typedef void (gearman_log_fn)(const char *line, gearman_verbose_t verbose, void *context);
 
 
+// Worker types
+
+typedef void* (gearman_worker_fn)(gearman_job_st *job, void *context,
+                                  size_t *result_size,
+                                  gearman_return_t *ret_ptr);
+
+typedef gearman_worker_error_t (gearman_mapper_fn)(gearman_job_st *job, void *worker_context);
+
 typedef struct gearman_aggregator_st gearman_aggregator_st;
 typedef gearman_return_t (gearman_aggregator_fn)(gearman_aggregator_st *, gearman_task_st *, gearman_result_st *);
 

+ 1 - 0
libgearman/gearman.h

@@ -58,6 +58,7 @@
 #include <libgearman/visibility.h>
 #include <libgearman/version.h>
 #include <libgearman/constants.h>
+#include <libgearman/client_callbacks.h>
 #include <libgearman/strerror.h>
 
 // Everything above this line must be in the order specified.

+ 1 - 0
libgearman/include.am

@@ -16,6 +16,7 @@ nobase_include_HEADERS+= \
 			 libgearman/argument.h \
 			 libgearman/byteorder.h \
 			 libgearman/client.h \
+			 libgearman/client_callbacks.h \
 			 libgearman/command.h \
 			 libgearman/configure.h \
 			 libgearman/connection.h \