root/src/stratcon_datastore.h

Revision 5f816fc68a68eaeb73588d831044fdaadbafe5e9, 3.5 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

fixes #358

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  *       notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  *       copyright notice, this list of conditions and the following
13  *       disclaimer in the documentation and/or other materials provided
14  *       with the distribution.
15  *     * Neither the name OmniTI Computer Consulting, Inc. nor the names
16  *       of its contributors may be used to endorse or promote products
17  *       derived from this software without specific prior written
18  *       permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef _NOIT_STRATCON_DATASTORE_H
34 #define _NOIT_STRATCON_DATASTORE_H
35
36 #include "noit_defines.h"
37 #include "eventer/eventer.h"
38 #include "utils/noit_hash.h"
39 #include "stratcon_realtime_http.h"
40
41 #include <sys/types.h>
42 #include <sys/socket.h>
43
44 typedef struct {
45   void (*launch_file_ingestion)(const char *file, const char *ip,
46                                 const char *cn, const char *store);
47   void (*iep_check_preload)();
48   int (*storage_node_lookup)(const char *uuid_str, const char *remote_cn,
49                              int *sid_out, int *storagenode_id_out,
50                              const char **remote_cn_out,
51                              const char **fqdn_out, const char **dsn_out);
52   void (*submit_realtime_lookup)(struct realtime_tracker *rt,
53                                  eventer_t completion);
54   char *(*get_noit_config)(const char *cn);
55   int (*save_config)();
56 } ingestor_api_t;
57
58 API_EXPORT(int) stratcon_datastore_set_ingestor(ingestor_api_t *ni);
59
60 typedef struct {
61   char *remote_str;
62   char *remote_cn;
63   char *fqdn;
64   int storagenode_id;
65   int fd;
66   char *filename;
67 } interim_journal_t;
68
69 typedef enum {
70  DS_OP_INSERT = 1,
71  DS_OP_CHKPT = 2,
72  DS_OP_FIND_COMPLETE = 3
73 } stratcon_datastore_op_t;
74
75 API_EXPORT(void)
76   stratcon_datastore_push(stratcon_datastore_op_t,
77                           struct sockaddr *, const char *, void *, eventer_t);
78
79 API_EXPORT(void)
80   stratcon_datastore_register_onlooker(void (*f)(stratcon_datastore_op_t,
81                                                  struct sockaddr *,
82                                                  const char *, void *));
83
84 API_EXPORT(void)
85   stratcon_datastore_init();
86
87 API_EXPORT(int)
88   stratcon_datastore_saveconfig(void *unused);
89
90 /* Private'ish... called from IEP to populate IEP */
91 API_EXPORT(void)
92   stratcon_datastore_iep_check_preload();
93
94 API_EXPORT(int)
95   stratcon_datastore_get_enabled();
96
97 API_EXPORT(void)
98   stratcon_datastore_set_enabled(int);
99
100 #endif
Note: See TracBrowser for help on using the browser.