d9967e34fa0c7e6b4c0d7cd2c7e97e76f88b9878
[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
29
30
31 /* will call hostlib_init using the specified ringbuffer size
32  */
33 gs_retval_t ftaapp_init(gs_uint32_t bufsz);
34
35 /* this should be used before exit() to make sure everything gets
36  cleaned up
37  */
38 gs_retval_t ftaapp_exit();
39
40 /* adds an FTA by key returns unique streamid which can be used to reference FTA*/
41
42 /* reuse:
43  if reuse is set to 0, only FTA information will be returned
44  if reuse is set to 1, instance will be returned provided there is an
45  instance that is marked as reusable by fta/app who instantiated it
46  */
47
48 /* reusable:
49  if reusable is 0, new instance will be created and it will be marked as
50  non-reusable regardless of how reuse flag is set by query writer
51  
52  if reusable is 1, new instance will be created and it will be marked as
53  reusable regardless of how reuse flag is set by query writer
54  
55  if reusable is set to 2. new instance will be created with reusability flag
56  matching the reusability flag of the query being instantiated
57  */
58
59 FTAID ftaapp_add_fta(FTAname name, gs_uint32_t reuse, gs_uint32_t reusable,
60                      gs_int32_t command, gs_int32_t sz, void *  data);
61
62 /* adds an FTA by key returns unique streamid which can be used to reference
63  FTA. This FTA does not produce any local data. Instead it generates a
64  compressed outpufile in gdat format. The path specifies the directory
65  the file will be put in. base specifies the base part of the name
66  the <temporal field value> will be prepented to the name and gdat.gz
67  will be appended. The temporal field needs to be specified which
68  can be an uint, int, ullong or llong. The delta is an integer defining how
69  much the temoral value has to change before a new file is generated.
70  The same ftaapp_remote_fta function is used to remove these FTAs.
71  */
72 FTAID ftaapp_add_fta_print(FTAname name, gs_uint32_t reuse, gs_uint32_t reusable,
73                            gs_int32_t command, gs_int32_t sz,
74                            void *  data, gs_sp_t path,
75                            gs_sp_t basename, gs_sp_t temporal_field, gs_sp_t split_field,
76                            gs_uint32_t delta, gs_uint32_t split);
77
78 /* get the schema handle definition for the FTA associated with the streamid
79  the returned handle will be freed by the app library when the corresponding
80  fta is removed
81  */
82 gs_schemahandle_t ftaapp_get_fta_schema(FTAID f);
83
84 /* get a schema handle definition for the FTA associated with the FTA name
85  this handle has to be freed by the caller using the schema interface */
86 gs_schemahandle_t ftaapp_get_fta_schema_by_name(gs_sp_t name);
87
88 /* get an ascii representation of the schema definition
89  for the FTA associated with the FTA name. The ascii representation
90  is stored in a static buffer. The value will therefore change
91  after subsequent calls to this function and the function is not
92  multithread safe.*/
93 gs_sp_t ftaapp_get_fta_ascii_schema_by_name(gs_sp_t name);
94
95 /* control operations keyed of one to one mapping of stream id */
96 gs_retval_t ftaapp_control(FTAID f, gs_int32_t command, gs_int32_t sz, void *  data);
97
98 /* remove FTA keyed of stream id */
99 /* if recursive is true the children of f will get removed too */
100 gs_retval_t ftaapp_remove_fta(FTAID f, gs_uint32_t recursive);
101
102 /* same as sgroup_get_buffer just repeated to have a complet ftapp interface */
103 gs_retval_t ftaapp_get_tuple(FTAID * f, gs_uint32_t * size, void *tbuffer,
104                              gs_int32_t tbuf_size, gs_int32_t timeout);
105
106 #endif