summaryrefslogtreecommitdiffstats
path: root/source3/rpc_server/mdssvc/mdssvc_es.h
blob: 19797fa24f34f58627487fba084d797d1773dbc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
   Unix SMB/CIFS implementation.
   Main metadata server / Spotlight routines / HTTP/ES/JSON backend

   Copyright (C) Ralph Boehme			2019

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _MDSSVC_ES_H_
#define _MDSSVC_ES_H_

#include <jansson.h>

/*
 * Some global state
 */
struct mdssvc_es_ctx {
	struct mdssvc_ctx *mdssvc_ctx;
	struct cli_credentials *creds;
	json_t *mappings;
};

/*
 * Per mdssvc RPC bind state
 */
struct mds_es_ctx {
	/*
	 * Pointer to higher level mds_ctx
	 */
	struct mds_ctx *mds_ctx;

	/*
	 * Pointer to our global context
	 */
	struct mdssvc_es_ctx *mdssvc_es_ctx;

	/*
	 * The HTTP connection handle to the ES server
	 */
	struct http_conn *http_conn;

	/*
	 * List of pending searches
	 */
	struct sl_es_search *searches;
};

/* Per search request */
struct sl_es_search {
	/*
	 * List pointers
	 */
	struct sl_es_search *prev, *next;

	/*
	 * Search is being executed. Only the list head can be pending.
	 */
	bool pending;

	/*
	 * Shorthand to our tevent context
	 */
	struct tevent_context *ev;

	/*
	 * Pointer to the RPC connection ctx the request is using
	 */
	struct mds_es_ctx *mds_es_ctx;

	/*
	 * The upper mdssvc.c level query context
	 */
	struct sl_query *slq;

	/*
	 * Maximum number of results we process and total number of
	 * results of a query.
	 */
	size_t total;
	size_t max;

	/*
	 * For paging results
	 */
	size_t from;
	size_t size;

	/*
	 * The translated Es query
	 */
	char *es_query;
};

extern struct mdssvc_backend mdsscv_backend_es;

#endif /* _MDSSVC_ES_H_ */