1 /* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
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, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef PIPELINE_FACTORY_INCLUDED
24 #define PIPELINE_FACTORY_INCLUDED
25 
26 #include "plugin/group_replication/include/pipeline_interfaces.h"
27 
28 /**
29   @enum Handler_id
30 
31   Enumeration type for the different types of handlers.
32 */
33 enum Handler_id {
34   CERTIFICATION_HANDLER,
35   SQL_THREAD_APPLICATION_HANDLER,
36   CATALOGING_HANDLER,
37 };
38 
39 /**
40   @enum Handler_id
41 
42   Enumeration type for the different types of handlers.
43 */
44 enum Handler_pipeline_type { STANDARD_GROUP_REPLICATION_PIPELINE = 0 };
45 
46 /**
47   This method joins the two above method, assembling a pipeline accordingly
48   with the given configuration.
49 
50   @param[in]    pipeline_type    the selected pipeline
51   @param[out]   pipeline         the assembled pipeline
52 
53   @return the end status
54     @retval 0      OK
55     @retval !=0    Error returned on the execution
56 */
57 int get_pipeline(Handler_pipeline_type pipeline_type, Event_handler **pipeline);
58 
59 /**
60   This method returns the configured handlers for the received pipeline.
61 
62   @param[in]    pipeline_type    the selected pipeline
63   @param[out]   pipeline_conf    the returned list of handler ids
64 
65   @return the number of handlers in the pipeline
66 */
67 int get_pipeline_configuration(Handler_pipeline_type pipeline_type,
68                                Handler_id **pipeline_conf);
69 
70 /**
71   This method configures the pipeline accordingly to the received handlers.
72 
73   Taking the received handlers, this method initializes each one of them,
74   appending them to the pipeline. It also checks the handler role, checking
75   for duplicated handlers that were marked as being unique.
76 
77   @param[out]  pipeline            the pipeline to configure
78   @param[in]   handler_list        the list of handler ids
79   @param[in]   num_handlers        the number of handlers to configure
80 
81   @return the end status
82     @retval 0      OK
83     @retval !=0    Error returned on the execution
84 */
85 int configure_pipeline(Event_handler **pipeline, Handler_id handler_list[],
86                        int num_handlers);
87 
88 #endif /* PIPELINE_FACTORY_INCLUDED */
89