Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _P_REC_CORE_H_
00025 #define _P_REC_CORE_H_
00026
00027 #include "ink_thread.h"
00028 #include "ink_hash_table.h"
00029 #include "ink_llqueue.h"
00030 #include "ink_rwlock.h"
00031 #include "TextBuffer.h"
00032
00033 #include "I_RecCore.h"
00034 #include "P_RecDefs.h"
00035 #include "P_RecTree.h"
00036
00037
00038 extern RecRecord *g_records;
00039 extern InkHashTable *g_records_ht;
00040 extern ink_rwlock g_records_rwlock;
00041 extern int g_num_records;
00042 extern RecModeT g_mode_type;
00043 extern RecTree *g_records_tree;
00044
00045
00046 extern const char *g_rec_config_fpath;
00047 extern LLQ *g_rec_config_contents_llq;
00048 extern InkHashTable *g_rec_config_contents_ht;
00049 extern ink_mutex g_rec_config_lock;
00050
00051
00052
00053
00054
00055 int RecCoreInit(RecModeT mode_type, Diags * diags);
00056
00057
00058
00059
00060
00061 RecRecord *RecRegisterStat(RecT rec_type, const char *name, RecDataT data_type,
00062 RecData data_default, RecPersistT persist_type);
00063
00064 RecRecord *RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type,
00065 RecData data_default, RecUpdateT update_type,
00066 RecCheckT check_type, const char *check_regex, RecAccessT access_type = RECA_NULL);
00067
00068 RecRecord *RecForceInsert(RecRecord * record);
00069
00070
00071
00072
00073
00074 int RecSetRecord(RecT rec_type, const char *name, RecDataT data_type,
00075 RecData *data, RecRawStat *raw_stat, bool lock = true, bool inc_version = true);
00076
00077 int RecGetRecord_Xmalloc(const char *name, RecDataT data_type, RecData * data, bool lock = true);
00078
00079
00080
00081
00082
00083 int RecReadStatsFile();
00084 int RecSyncStatsFile();
00085 int RecReadConfigFile(bool inc_version);
00086 int RecWriteConfigFile(textBuffer *tb);
00087 int RecSyncConfigToTB(textBuffer * tb, bool *inc_version = NULL);
00088
00089
00090
00091
00092
00093 bool i_am_the_record_owner(RecT rec_type);
00094 int send_push_message();
00095 int send_pull_message(RecMessageT msg_type);
00096 int send_register_message(RecRecord * record);
00097 int recv_message_cb(RecMessage * msg, RecMessageT msg_type, void *cookie);
00098 int RecExecConfigUpdateCbs(unsigned int update_required_type);
00099 int RecExecStatUpdateFuncs();
00100 int RecExecRawStatUpdateFuncs();
00101
00102 void RecDumpRecordsHt(RecT rec_type = RECT_NULL);
00103
00104 void
00105 RecDumpRecords(RecT rec_type, RecDumpEntryCb callback, void *edata);
00106
00107 #endif