• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

P_RecCore.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   Private record core declarations
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
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 // records, record hash-table, and hash-table rwlock
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 // records.config items
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 // Initialization
00053 //-------------------------------------------------------------------------
00054 
00055 int RecCoreInit(RecModeT mode_type, Diags * diags);
00056 
00057 //-------------------------------------------------------------------------
00058 // Registration/Insertion
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 // Setting/Getting
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 // Read/Sync to Disk
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 // Misc
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

Generated by  doxygen 1.7.1