3
Private record declarations
5
@section license License
7
Licensed to the Apache Software Foundation (ASF) under one
8
or more contributor license agreements. See the NOTICE file
9
distributed with this work for additional information
10
regarding copyright ownership. The ASF licenses this file
11
to you under the Apache License, Version 2.0 (the
12
"License"); you may not use this file except in compliance
13
with the License. You may obtain a copy of the License at
15
http://www.apache.org/licenses/LICENSE-2.0
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
24
#ifndef _P_REC_DEFS_H_
25
#define _P_REC_DEFS_H_
29
#include "I_RecDefs.h"
31
#define REC_CONFIG_FILE "records.config"
32
#define REC_SHADOW_EXT ".shadow"
33
#define REC_RAW_STATS_FILE "records.snap"
34
#define REC_PIPE_NAME "librecords_pipe"
36
#define REC_MESSAGE_ELE_MAGIC 0xF00DF00D
38
// This is for the internal stats and configs, as well as API stats. We currently use
39
// about 1600 stats + configs for the core, but we're allocating 2000 for some growth.
40
// TODO: if/when we switch to a new config system, we should make this run-time dynamic.
41
#define REC_MAX_RECORDS (2000 + TS_MAX_API_STATS)
43
#define REC_CONFIG_UPDATE_INTERVAL_SEC 3
44
#define REC_REMOTE_SYNC_INTERVAL_SEC 5
46
#define REC_RAW_STAT_SYNC_INTERVAL_SEC 5
47
#define REC_STAT_UPDATE_INTERVAL_SEC 10
49
//-------------------------------------------------------------------------
51
//-------------------------------------------------------------------------
53
#define REC_LOCAL_UPDATE_REQUIRED 1
54
#define REC_PROCESS_UPDATE_REQUIRED (REC_LOCAL_UPDATE_REQUIRED << 1)
55
#define REC_UPDATE_REQUIRED (REC_LOCAL_UPDATE_REQUIRED | REC_PROCESS_UPDATE_REQUIRED)
57
#define REC_DISK_SYNC_REQUIRED 1
58
#define REC_PEER_SYNC_REQUIRED (REC_DISK_SYNC_REQUIRED << 1)
59
#define REC_SYNC_REQUIRED (REC_DISK_SYNC_REQUIRED | REC_PEER_SYNC_REQUIRED)
68
struct RecConfigFileEntry
74
typedef struct RecConfigCbList_t
76
RecConfigUpdateCb update_cb;
78
struct RecConfigCbList_t *next;
79
} RecConfigUpdateCbList;
81
typedef struct RecStatUpdateFuncList_t
85
RecStatUpdateFunc update_func;
87
struct RecStatUpdateFuncList_t *next;
88
} RecStatUpdateFuncList;
93
RecRawStatSyncCb sync_cb;
94
RecRawStatBlock *sync_rsb;
96
RecPersistT persist_type;
101
unsigned char update_required;
102
RecConfigUpdateCbList *update_cb_list;
104
RecUpdateT update_type;
105
RecCheckT check_type;
107
RecAccessT access_type;
116
RecData data_default;
118
unsigned char sync_required;
122
RecStatMeta stat_meta;
123
RecConfigMeta config_meta;
129
// Used for cluster. TODO: Do we still need this?
136
//-------------------------------------------------------------------------
138
//-------------------------------------------------------------------------
152
RecMessageT msg_type;
157
int alignment; //needs to be 8 byte aligned
160
struct RecMessageEleHdr
168
RecMessageEleHdr *ele_hdr;
172
typedef RecMessageHdr RecMessage;
174
typedef void (*RecDumpEntryCb) (RecT rec_type, void *edata, int registered, const char *name, int data_type, RecData *datum);
176
typedef int (*RecMessageRecvCb) (RecMessage * msg, RecMessageT msg_type, void *cookie);