Defines | Functions | Variables

P_RecCore.cc File Reference

Private record core definitions. More...

#include "TextBuffer.h"
#include "Tokenizer.h"
#include "ink_defs.h"
#include "ink_string.h"
#include "P_RecFile.h"
#include "P_RecUtils.h"
#include "P_RecMessage.h"
#include "P_RecCore.h"
Include dependency graph for P_RecCore.cc:

Go to the source code of this file.

Defines

#define REC_REGISTER_STAT_XXX(A, B)
#define REC_REGISTER_CONFIG_XXX(A, B)
#define TMP_FILENAME_EXT_STR   ".tmp"
#define TMP_FILENAME_EXT_LEN   (sizeof(TMP_FILENAME_EXT_STR) - 1)

Functions

static int send_reset_message (RecRecord *record)
static int send_set_message (RecRecord *record)
int send_register_message (RecRecord *record)
int send_push_message ()
int send_pull_message (RecMessageT msg_type)
int recv_message_cb (RecMessage *msg, RecMessageT msg_type, void *)
int _RecRegisterStatInt (RecT rec_type, const char *name, RecInt data_default, RecPersistT persist_type)
int _RecRegisterStatFloat (RecT rec_type, const char *name, RecFloat data_default, RecPersistT persist_type)
int _RecRegisterStatString (RecT rec_type, const char *name, RecString data_default, RecPersistT persist_type)
int _RecRegisterStatCounter (RecT rec_type, const char *name, RecCounter data_default, RecPersistT persist_type)
int RecRegisterConfigInt (RecT rec_type, const char *name, RecInt data_default, RecUpdateT update_type, RecCheckT check_type, const char *check_regex, RecAccessT access_type)
int RecRegisterConfigFloat (RecT rec_type, const char *name, RecFloat data_default, RecUpdateT update_type, RecCheckT check_type, const char *check_regex, RecAccessT access_type)
int RecRegisterConfigString (RecT rec_type, const char *name, const char *data_default_tmp, RecUpdateT update_type, RecCheckT check_type, const char *check_regex, RecAccessT access_type)
int RecRegisterConfigCounter (RecT rec_type, const char *name, RecCounter data_default, RecUpdateT update_type, RecCheckT check_type, const char *check_regex, RecAccessT access_type)
int RecSetRecord (RecT rec_type, const char *name, RecDataT data_type, RecData *data, RecRawStat *data_raw, bool lock, bool inc_version)
int RecSetRecordConvert (const char *name, const RecString rec_string, bool lock, bool inc_version)
int RecSetRecordInt (const char *name, RecInt rec_int, bool lock, bool inc_version)
int RecSetRecordFloat (const char *name, RecFloat rec_float, bool lock, bool inc_version)
int RecSetRecordString (const char *name, const RecString rec_string, bool lock, bool inc_version)
int RecSetRecordCounter (const char *name, RecCounter rec_counter, bool lock, bool inc_version)
int RecReadStatsFile ()
int RecSyncStatsFile ()
static void RecConsumeConfigEntry (RecT rec_type, RecDataT data_type, const char *name, const char *value, bool inc_version)
int RecReadConfigFile (bool inc_version)
int RecSyncConfigToTB (textBuffer *tb, bool *inc_version)
int RecExecConfigUpdateCbs (unsigned int update_required_type)
int RecResetStatRecord (const char *name)
int RecResetStatRecord (RecT type, bool all)
int RecSetSyncRequired (char *name, bool lock)
int RecWriteConfigFile (textBuffer *tb)

Variables

RecModeT g_mode_type = RECM_NULL

Detailed Description

Private record core definitions.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file P_RecCore.cc.


Define Documentation

#define REC_REGISTER_CONFIG_XXX (   A,
  B 
)
Value:
RecRecord *r; \
  RecData my_data_default; \
  my_data_default.A = data_default; \
  if ((r = RecRegisterConfig(rec_type, name, B, my_data_default, \
                             update_type, check_type,              \
                             check_regex, access_type)) != NULL) { \
    if (i_am_the_record_owner(r->rec_type)) { \
      r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED; \
    } else { \
      send_register_message(r); \
    } \
    return REC_ERR_OKAY; \
  } else { \
    return REC_ERR_FAIL; \
  }

Definition at line 322 of file P_RecCore.cc.

Referenced by RecRegisterConfigCounter(), RecRegisterConfigFloat(), RecRegisterConfigInt(), and RecRegisterConfigString().

#define REC_REGISTER_STAT_XXX (   A,
  B 
)
Value:
ink_assert((rec_type == RECT_NODE)    || \
                   (rec_type == RECT_CLUSTER) || \
                   (rec_type == RECT_PROCESS) || \
                   (rec_type == RECT_LOCAL)   || \
                   (rec_type == RECT_PLUGIN));   \
  RecRecord *r; \
  RecData my_data_default; \
  my_data_default.A = data_default; \
  if ((r = RecRegisterStat(rec_type, name, B, my_data_default, \
                           persist_type)) != NULL) { \
    if (i_am_the_record_owner(r->rec_type)) { \
      r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED; \
    } else { \
      send_register_message(r); \
    } \
    return REC_ERR_OKAY; \
  } else { \
    return REC_ERR_FAIL; \
  }

Definition at line 273 of file P_RecCore.cc.

Referenced by _RecRegisterStatCounter(), _RecRegisterStatFloat(), _RecRegisterStatInt(), and _RecRegisterStatString().

#define TMP_FILENAME_EXT_LEN   (sizeof(TMP_FILENAME_EXT_STR) - 1)
#define TMP_FILENAME_EXT_STR   ".tmp"

Referenced by RecWriteConfigFile().


Function Documentation

int _RecRegisterStatCounter ( RecT  rec_type,
const char *  name,
RecCounter  data_default,
RecPersistT  persist_type 
)

Definition at line 313 of file P_RecCore.cc.

References REC_REGISTER_STAT_XXX, and RECD_COUNTER.

int _RecRegisterStatFloat ( RecT  rec_type,
const char *  name,
RecFloat  data_default,
RecPersistT  persist_type 
)

Definition at line 301 of file P_RecCore.cc.

References REC_REGISTER_STAT_XXX, and RECD_FLOAT.

int _RecRegisterStatInt ( RecT  rec_type,
const char *  name,
RecInt  data_default,
RecPersistT  persist_type 
)

Definition at line 295 of file P_RecCore.cc.

References REC_REGISTER_STAT_XXX, and RECD_INT.

int _RecRegisterStatString ( RecT  rec_type,
const char *  name,
RecString  data_default,
RecPersistT  persist_type 
)

Definition at line 307 of file P_RecCore.cc.

References REC_REGISTER_STAT_XXX, and RECD_STRING.

static void RecConsumeConfigEntry ( RecT  rec_type,
RecDataT  data_type,
const char *  name,
const char *  value,
bool  inc_version 
) [static]

Definition at line 629 of file P_RecCore.cc.

References RecDataClear(), RecDataSetFromString(), and RecSetRecord().

Referenced by RecReadConfigFile().

int RecExecConfigUpdateCbs ( unsigned int  update_required_type  ) 
int RecReadConfigFile ( bool  inc_version  ) 
int RecReadStatsFile (  ) 
int RecRegisterConfigCounter ( RecT  rec_type,
const char *  name,
RecCounter  data_default,
RecUpdateT  update_type,
RecCheckT  check_type,
const char *  check_regex,
RecAccessT  access_type 
)

Definition at line 369 of file P_RecCore.cc.

References ink_assert, REC_REGISTER_CONFIG_XXX, RECD_COUNTER, RECT_CONFIG, and RECT_LOCAL.

int RecRegisterConfigFloat ( RecT  rec_type,
const char *  name,
RecFloat  data_default,
RecUpdateT  update_type,
RecCheckT  check_type,
const char *  check_regex,
RecAccessT  access_type 
)

Definition at line 349 of file P_RecCore.cc.

References ink_assert, REC_REGISTER_CONFIG_XXX, RECD_FLOAT, RECT_CONFIG, and RECT_LOCAL.

int RecRegisterConfigInt ( RecT  rec_type,
const char *  name,
RecInt  data_default,
RecUpdateT  update_type,
RecCheckT  check_type,
const char *  check_regex,
RecAccessT  access_type 
)
int RecRegisterConfigString ( RecT  rec_type,
const char *  name,
const char *  data_default_tmp,
RecUpdateT  update_type,
RecCheckT  check_type,
const char *  check_regex,
RecAccessT  access_type 
)
int RecResetStatRecord ( const char *  name  ) 
int RecResetStatRecord ( RecT  type,
bool  all 
)
int RecSetRecord ( RecT  rec_type,
const char *  name,
RecDataT  data_type,
RecData data,
RecRawStat data_raw,
bool  lock,
bool  inc_version 
)
int RecSetRecordConvert ( const char *  name,
const RecString  rec_string,
bool  lock,
bool  inc_version 
)

Definition at line 487 of file P_RecCore.cc.

References RecData::rec_string, RECD_NULL, RecSetRecord(), and RECT_NULL.

int RecSetRecordCounter ( const char *  name,
RecCounter  rec_counter,
bool  lock,
bool  inc_version 
)

Definition at line 519 of file P_RecCore.cc.

References RecData::rec_counter, RECD_COUNTER, RecSetRecord(), and RECT_NULL.

int RecSetRecordFloat ( const char *  name,
RecFloat  rec_float,
bool  lock,
bool  inc_version 
)

Definition at line 503 of file P_RecCore.cc.

References RecData::rec_float, RECD_FLOAT, RecSetRecord(), and RECT_NULL.

int RecSetRecordInt ( const char *  name,
RecInt  rec_int,
bool  lock,
bool  inc_version 
)

Definition at line 495 of file P_RecCore.cc.

References RecData::rec_int, RECD_INT, RecSetRecord(), and RECT_NULL.

Referenced by CB_After_Cache_Init().

int RecSetRecordString ( const char *  name,
const RecString  rec_string,
bool  lock,
bool  inc_version 
)

Definition at line 511 of file P_RecCore.cc.

References RecData::rec_string, RECD_STRING, RecSetRecord(), and RECT_NULL.

int RecSetSyncRequired ( char *  name,
bool  lock 
)
int RecSyncConfigToTB ( textBuffer tb,
bool *  inc_version 
)
int RecSyncStatsFile (  ) 
int recv_message_cb ( RecMessage msg,
RecMessageT  msg_type,
void *   
)
int RecWriteConfigFile ( textBuffer tb  ) 
int send_pull_message ( RecMessageT  msg_type  ) 
int send_push_message (  ) 
int send_register_message ( RecRecord record  ) 
static int send_reset_message ( RecRecord record  )  [static]
static int send_set_message ( RecRecord record  )  [static]

Variable Documentation

RecModeT g_mode_type = RECM_NULL