| 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 |
int (*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_core_init(); |
|---|
| 86 |
|
|---|
| 87 |
API_EXPORT(void) |
|---|
| 88 |
stratcon_datastore_init(); |
|---|
| 89 |
|
|---|
| 90 |
API_EXPORT(int) |
|---|
| 91 |
stratcon_datastore_saveconfig(void *unused); |
|---|
| 92 |
|
|---|
| 93 |
/* Private'ish... called from IEP to populate IEP */ |
|---|
| 94 |
API_EXPORT(void) |
|---|
| 95 |
stratcon_datastore_iep_check_preload(); |
|---|
| 96 |
|
|---|
| 97 |
API_EXPORT(int) |
|---|
| 98 |
stratcon_datastore_get_enabled(); |
|---|
| 99 |
|
|---|
| 100 |
API_EXPORT(void) |
|---|
| 101 |
stratcon_datastore_set_enabled(int); |
|---|
| 102 |
|
|---|
| 103 |
API_EXPORT(void) |
|---|
| 104 |
stratcon_ingest_sweep_journals(int (*test)(const char *), |
|---|
| 105 |
int (*ingest)(const char *fullpath, |
|---|
| 106 |
const char *remote_str, |
|---|
| 107 |
const char *remote_cn, |
|---|
| 108 |
const char *id_str)); |
|---|
| 109 |
#endif |
|---|