Refactor csv input processing. Add support for kafka interfaces. Fix bug in join...
[com/gs-lite.git] / include / app.h
1 /* ------------------------------------------------
2  Copyright 2014 AT&T Intellectual Property
3  Licensed under the Apache License, Version 2.0 (the "License");
4  you may not use this file except in compliance with the License.
5  You may obtain a copy of the License at
6  
7  http://www.apache.org/licenses/LICENSE-2.0
8  
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14  ------------------------------------------- */
15 /*
16  * app.h: interface for applications
17  */
18 #ifndef APP_H
19 #define APP_H
20
21
22 #include "fta.h"
23 #include "lapp.h"
24
25 /* HIGH LEVEL APPLICATION INTERFACE */
26 /* ================================ */
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32
33
34
35 /* will call hostlib_init using the specified ringbuffer size
36  */
37 gs_retval_t ftaapp_init(gs_uint32_t bufsz);
38
39 /* this should be used before exit() to make sure everything gets
40  cleaned up
41  */
42 gs_retval_t ftaapp_exit();
43
44 /* adds an FTA by key returns unique streamid which can be used to reference FTA*/
45
46 /* reuse:
47  if reuse is set to 0, only FTA information will be returned
48  if reuse is set to 1, instance will be returned provided there is an
49  instance that is marked as reusable by fta/app who instantiated it
50  */
51
52 /* reusable:
53  if reusable is 0, new instance will be created and it will be marked as
54  non-reusable regardless of how reuse flag is set by query writer
55  
56  if reusable is 1, new instance will be created and it will be marked as
57  reusable regardless of how reuse flag is set by query writer
58  
59  if reusable is set to 2. new instance will be created with reusability flag
60  matching the reusability flag of the query being instantiated
61  */
62
63 FTAID ftaapp_add_fta(FTAname name, gs_uint32_t reuse, gs_uint32_t reusable,
64                      gs_int32_t command, gs_int32_t sz, void *  data);
65
66 /* adds an FTA by key returns unique streamid which can be used to reference
67  FTA. This FTA does not produce any local data. Instead it generates a
68  compressed outpufile in gdat format. The path specifies the directory
69  the file will be put in. base specifies the base part of the name
70  the <temporal field value> will be prepented to the name and gdat.gz
71  will be appended. The temporal field needs to be specified which
72  can be an uint, int, ullong or llong. The delta is an integer defining how
73  much the temoral value has to change before a new file is generated.
74  The same ftaapp_remote_fta function is used to remove these FTAs.
75  */
76 FTAID ftaapp_add_fta_print(FTAname name, gs_uint32_t reuse, gs_uint32_t reusable,
77                            gs_int32_t command, gs_int32_t sz,
78                            void *  data, gs_sp_t path,
79                            gs_sp_t basename, gs_sp_t temporal_field, gs_sp_t split_field,
80                            gs_uint32_t delta, gs_uint32_t split);
81
82 /* get the schema handle definition for the FTA associated with the streamid
83  the returned handle will be freed by the app library when the corresponding
84  fta is removed
85  */
86 gs_schemahandle_t ftaapp_get_fta_schema(FTAID f);
87
88 /* get a schema handle definition for the FTA associated with the FTA name
89  this handle has to be freed by the caller using the schema interface */
90 gs_schemahandle_t ftaapp_get_fta_schema_by_name(gs_sp_t name);
91
92 /* get an ascii representation of the schema definition
93  for the FTA associated with the FTA name. The ascii representation
94  is stored in a static buffer. The value will therefore change
95  after subsequent calls to this function and the function is not
96  multithread safe.*/
97 gs_sp_t ftaapp_get_fta_ascii_schema_by_name(gs_sp_t name);
98
99 /* control operations keyed of one to one mapping of stream id */
100 gs_retval_t ftaapp_control(FTAID f, gs_int32_t command, gs_int32_t sz, void *  data);
101
102 /* remove FTA keyed of stream id */
103 /* if recursive is true the children of f will get removed too */
104 gs_retval_t ftaapp_remove_fta(FTAID f, gs_uint32_t recursive);
105
106 /* same as sgroup_get_buffer just repeated to have a complet ftapp interface */
107 gs_retval_t ftaapp_get_tuple(FTAID * f, gs_uint32_t * size, void *tbuffer,
108                              gs_int32_t tbuf_size, gs_int32_t timeout);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif