]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / thrift / lib / c_glib / src / thrift / c_glib / processor / thrift_multiplexed_processor.h
1 /*
2 * thrift_multiplexed_processor.h
3 *
4 * Created on: 14 sept. 2017
5 * Author: gaguilar
6 */
7
8 #ifndef _THRIFT_MULTIPLEXED_MULTIPLEXED_PROCESSOR_H_
9 #define _THRIFT_MULTIPLEXED_MULTIPLEXED_PROCESSOR_H_
10
11
12 #include <glib-object.h>
13
14 #include <thrift/c_glib/processor/thrift_processor.h>
15
16
17 G_BEGIN_DECLS
18
19 /*! \file thrift_multiplexed_processor.h
20 * \brief The multiplexed processor for c_glib.
21 */
22
23 /* type macros */
24 #define THRIFT_TYPE_MULTIPLEXED_PROCESSOR (thrift_multiplexed_processor_get_type ())
25 #define THRIFT_MULTIPLEXED_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_MULTIPLEXED_PROCESSOR, ThriftMultiplexedProcessor))
26 #define THRIFT_IS_MULTIPLEXED_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_MULTIPLEXED_PROCESSOR))
27 #define THRIFT_MULTIPLEXED_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_MULTIPLEXED_PROCESSOR, ThriftMultiplexedProcessorClass))
28 #define THRIFT_IS_MULTIPLEXED_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_MULTIPLEXED_PROCESSOR))
29 #define THRIFT_MULTIPLEXED_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_MULTIPLEXED_PROCESSOR, ThriftMultiplexedProcessorClass))
30
31 /* define the GError domain string */
32 #define THRIFT_MULTIPLEXED_PROCESSOR_ERROR_DOMAIN "thrift-multiplexed-processor-error-quark"
33
34
35 /*!
36 * Thrift MultiplexedProcessor object
37 */
38 struct _ThriftMultiplexedProcessor
39 {
40 ThriftProcessor parent;
41
42 /* private */
43 gchar * default_processor_name;
44 GHashTable *multiplexed_services;
45 };
46 typedef struct _ThriftMultiplexedProcessor ThriftMultiplexedProcessor;
47
48 /*!
49 * Thrift MultiplexedProcessor class
50 */
51 struct _ThriftMultiplexedProcessorClass
52 {
53 ThriftProcessorClass parent;
54
55 gboolean (* register_processor) (ThriftProcessor *self, const gchar * multiplexed_processor_name, ThriftProcessor * multiplexed_processor , GError **error);
56
57 };
58 typedef struct _ThriftMultiplexedProcessorClass ThriftMultiplexedProcessorClass;
59
60 /* used by THRIFT_TYPE_MULTIPLEXED_PROCESSOR */
61 GType thrift_multiplexed_processor_get_type (void);
62
63 /*!
64 * Processes the request.
65 * \public \memberof ThriftMultiplexedProcessorClass
66 */
67 gboolean thrift_multiplexed_processor_process (ThriftMultiplexedProcessor *processor,
68 ThriftProtocol *in, ThriftProtocol *out,
69 GError **error);
70
71
72 /* Public API */
73
74 /**
75 * @brief Registers a processor in the multiplexed processor under its name. It
76 * will take a reference to the processor so refcount will be incremented.
77 * It will also be decremented on object destruction.
78 *
79 * The first registered processor becomes default. But you can override it with
80 * "default" property.
81 *
82 * It returns a compliant error if it cannot be registered.
83 *
84 * @param processor Pointer to the multiplexed processor.
85 * @param multiplexed_processor_name Name of the processor you want to register
86 * @param multiplexed_processor Pointer to implemented processor you want multiplex.
87 * @param error Error object where we should store errors.
88 *
89 * @see https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#g-set-error
90 */
91 gboolean thrift_multiplexed_processor_register_processor(ThriftProcessor *processor, const gchar * multiplexed_processor_name, ThriftProcessor * multiplexed_processor , GError **error);
92
93
94 /* define error/exception types */
95 typedef enum
96 {
97 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_UNKNOWN,
98 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_SERVICE_UNAVAILABLE,
99 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_TYPE,
100 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_WRONGLY_MULTIPLEXED,
101 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_SEND,
102 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_RECEIVE,
103 THRIFT_MULTIPLEXED_PROCESSOR_ERROR_CLOSE
104 } ThriftMultiplexedProcessorError;
105
106
107 GQuark thrift_multiplexed_processor_error_quark (void);
108 #define THRIFT_MULTIPLEXED_PROCESSOR_ERROR (thrift_multiplexed_processor_error_quark ())
109
110
111 G_END_DECLS
112
113
114 #endif /* _THRIFT_MULTIPLEXED_MULTIPLEXED_PROCESSOR_H_ */