//--------------------------------------------------------------------------//
//	CRUSingleTableLockProtocol::LoadDataFileNameList()
//--------------------------------------------------------------------------//
void CRUSingleTableLockProtocol::
  LoadDataFileNameList(CUOFsIpcMessageTranslator &translator)
{
  Int32 size;
  translator.ReadBlock(&size,sizeof(Int32));

  pUsedTblFileNameList_ = new CDSStringList();

  for (Int32 i=0;i<size;i++)
  {
    Int32 stringSize;
    const Int32 bufSize = CUOFsSystem::IpcMaxGuardianPathNameLength;
    char buf[bufSize];
		
    translator.ReadBlock(&stringSize, sizeof(Int32));
		
    RUASSERT(bufSize > stringSize);

#pragma nowarn(1506)   // warning elimination 
    translator.ReadBlock(buf, stringSize);
#pragma warn(1506)  // warning elimination 
		
    CDSString *objName = new CDSString(buf);

    pUsedTblFileNameList_->AddTail(objName);
  }
}
void CRUSQLDynamicStatementContainer::DynamicStmt::
StoreData(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreData(translator);

	short size;
	
	if (NULL == sql_)
	{
		size = 0;
		translator.WriteBlock(&size, sizeof(short));
		return;
	}

#pragma nowarn(1506)   // warning elimination 
	size = strlen(sql_)+1;
#pragma warn(1506)  // warning elimination 
	translator.WriteBlock(&size, sizeof(short));
	
	translator.WriteBlock(&paramNum_, sizeof(Lng32));

	for (Int32 i=0;i<paramNum_;i++)
	{
		translator.WriteBlock(&(paramsPos_[i]), sizeof(Int32));
	}
		
	translator.WriteBlock(sql_, size);
}
void CRUAuditRefreshTaskExecutor::
	StoreRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreRequest(translator);

        translator.WriteBlock(&isPurgedata_, sizeof(BOOL));
	translator.WriteBlock(&isPopindex_, sizeof(BOOL));

	// Handle audit refresh executor sql dynamic container
	auditRefreshTEDynamicContainer_.StoreData(translator);
	
	// Handle isDeleteMultiTxnContext_ data member
	translator.WriteBlock(&isDeleteMultiTxnContext_,sizeof(BOOL));

        translator.WriteBlock(&numOfIndexes_, sizeof(TInt32));

	if (0 < numOfIndexes_)
	{
		pAuditPopIndexdynamicContainer_->StoreData(translator);
		pAuditAvailableIndeXdynamicContainer_->StoreData(translator);
		pAuditUnavailableIndeXdynamicContainer_->StoreData(translator);
                pAuditToggleOnIndexdynamicContainer_->StoreData(translator);
                pAuditToggleOffIndexdynamicContainer_->StoreData(translator);
	}

	translator.SetMessageType(CUOFsIpcMessageTranslator::
						RU_AUDIT_REFRESH_EXECUTOR);
}
void CRUUnAuditRefreshTaskExecutor::
	LoadRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadRequest(translator);

	translator.ReadBlock(&isPurgedata_, sizeof(BOOL));
	translator.ReadBlock(&isPopindex_, sizeof(BOOL));

	// Store the executor-specific SQL container
	unAuditRefreshTEDynamicContainer_.LoadData(translator);

	translator.ReadBlock(&numOfIndexes_, sizeof(TInt32));

	if (0 < numOfIndexes_)
	{
		pUnAuditPopIndexdynamicContainer_ = 
#pragma nowarn(1506)   // warning elimination 
			new CRUSQLDynamicStatementContainer(numOfIndexes_);
#pragma warn(1506)  // warning elimination 
		pUnAuditAvailableIndeXdynamicContainer_ =
#pragma nowarn(1506)   // warning elimination 
			new CRUSQLDynamicStatementContainer(numOfIndexes_);
#pragma warn(1506)  // warning elimination 
		pUnAuditUnavailableIndeXdynamicContainer_ = 
#pragma nowarn(1506)   // warning elimination 
			new CRUSQLDynamicStatementContainer(numOfIndexes_);
#pragma warn(1506)  // warning elimination 

		pUnAuditPopIndexdynamicContainer_->LoadData(translator);
		pUnAuditAvailableIndeXdynamicContainer_->LoadData(translator);
		pUnAuditUnavailableIndeXdynamicContainer_->LoadData(translator);
	}
}
//--------------------------------------------------------------------------//
//	CRULogCleanupTaskExecutor::LoadRequest()
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRULogCleanupTaskExecutor::
	LoadRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadRequest(translator);

	logCleanupTEDynamicContainer_.LoadData(translator);
	translator.ReadBlock(&hasRangeLog_,sizeof(BOOL));
	translator.ReadBlock(&noOfPartitions_,sizeof(Int32));
}
//--------------------------------------------------------------------------//
//	CRULogCleanupTaskExecutor::StoreRequest()
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRULogCleanupTaskExecutor::
	StoreRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreRequest(translator);

	logCleanupTEDynamicContainer_.StoreData(translator);
	translator.WriteBlock(&hasRangeLog_,sizeof(BOOL));
	translator.WriteBlock(&noOfPartitions_,sizeof(Int32));

	translator.SetMessageType(
		CUOFsIpcMessageTranslator::RU_LOG_CLEANUP_EXECUTOR);
}
void CRUEmpCheckVector::StoreData(CUOFsIpcMessageTranslator &translator)
{
	// Handle size_ data member
	translator.WriteBlock(&size_, sizeof(Lng32));

	// Handle final_ data member
	translator.WriteBlock(&isFinal_,sizeof(BOOL));
	
	// Handle pVec_ data member
	for (Int32 i=0; i<size_; i++)
	{
		translator.WriteBlock(&(pVec_[i].epoch_),sizeof(TInt32));
		translator.WriteBlock(&(pVec_[i].checkBitmap_), sizeof(Lng32));
	}
}
void CRUEmpCheck::StoreData(CUOFsIpcMessageTranslator &translator)
{
	pSQLContainer_->StoreData(translator);
	pVec_->StoreData(translator);

	translator.WriteBlock(&checkMask_, sizeof(Lng32));
}
//--------------------------------------------------------------------------//
//	CRURefreshTaskExecutor::LoadReply()
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRURefreshTaskExecutor::
	LoadReply(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadReply(translator);

	translator.ReadBlock(&isRecompute_,sizeof(BOOL));
}
void CRUTableSyncTaskExecutor::
	StoreRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreRequest(translator);

	Int32 stringSize = tableName_.GetLength() + 1;
	translator.WriteBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.WriteBlock(tableName_.c_string(), stringSize);;
#pragma warn(1506)  // warning elimination 
	
	syncTableDynamicContainer_.StoreData(translator);

	translator.SetMessageType(CUOFsIpcMessageTranslator::
							  RU_TABLE_SYNC_EXECUTOR);
}
//--------------------------------------------------------------------------//
//--------------------------------------------------------------------------//
void CRUSingleTableLockProtocol::StoreData(CUOFsIpcMessageTranslator &translator)
{
  StoreDataFileNameList(translator);
  pEmpCheck_->StoreData(translator);

  translator.WriteBlock(&endEpoch_, sizeof(TInt32));
}
//--------------------------------------------------------------------------//
//--------------------------------------------------------------------------//
void CRUSingleTableLockProtocol::LoadData(CUOFsIpcMessageTranslator &translator)
{
  LoadDataFileNameList(translator);

  pEmpCheck_ = new CRUEmpCheck();
  pEmpCheck_->LoadData(translator);

  translator.ReadBlock(&endEpoch_,sizeof(TInt32));
}
//--------------------------------------------------------------------------//
//	CRUEmpCheckTaskExecutor::StoreRequest()
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRUEmpCheckTaskExecutor::
StoreRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreRequest(translator);

	pEmpCheck_->StoreData(translator);

	translator.SetMessageType(CUOFsIpcMessageTranslator::
							  RU_EMP_CHECK_EXECUTOR);
}
void CRUEmpCheckVector::LoadData(CUOFsIpcMessageTranslator &translator)
{
	// Handle size_ data member
	translator.ReadBlock(&size_, sizeof(Lng32));

	// Handle final_ data member
	translator.ReadBlock(&isFinal_,sizeof(BOOL));

	if (NULL == pVec_)
	{
		pVec_ = new Elem[size_];
	}

	// Handle pVec_ data member
	for (Int32 i=0; i<size_; i++)
	{
		translator.ReadBlock(&(pVec_[i].epoch_),sizeof(TInt32));
		translator.ReadBlock(&(pVec_[i].checkBitmap_), sizeof(Lng32));
	}
}
//--------------------------------------------------------------------------//
//	CRUSingleTableLockProtocol::StoreDataFileNameList()
//--------------------------------------------------------------------------//
void CRUSingleTableLockProtocol::StoreDataFileNameList(CUOFsIpcMessageTranslator &translator)
{
  Int32 size = pUsedTblFileNameList_->GetCount();
  translator.WriteBlock(&size,sizeof(Int32));

  DSListPosition pos = pUsedTblFileNameList_->GetHeadPosition();
  while (NULL != pos)
  {
    Int32 stringSize;

    CDSString &str = *(pUsedTblFileNameList_->GetNext(pos));
		
    stringSize = str.GetLength() + 1;
    translator.WriteBlock(&stringSize, sizeof(Int32));

#pragma nowarn(1506)   // warning elimination 
    translator.WriteBlock(str.c_string(), stringSize);
#pragma warn(1506)  // warning elimination 
  }
}
void CRUAuditRefreshTaskExecutor::
	LoadRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadRequest(translator);

        translator.ReadBlock(&isPurgedata_, sizeof(BOOL));
	translator.ReadBlock(&isPopindex_, sizeof(BOOL));

	// Handle refresh executor sql dynamic container
	auditRefreshTEDynamicContainer_.LoadData(translator);
	
	// Handle isDeleteMultiTxnContext_ data member
	translator.ReadBlock(&isDeleteMultiTxnContext_,sizeof(BOOL));

        translator.ReadBlock(&numOfIndexes_, sizeof(TInt32));

	if (0 < numOfIndexes_)
	{
		pAuditPopIndexdynamicContainer_ =  
			new CRUSQLDynamicStatementContainer(numOfIndexes_);

		pAuditAvailableIndeXdynamicContainer_ =
			new CRUSQLDynamicStatementContainer(numOfIndexes_);

                pAuditUnavailableIndeXdynamicContainer_ = 
			new CRUSQLDynamicStatementContainer(numOfIndexes_);

		pAuditToggleOnIndexdynamicContainer_ = 
			new CRUSQLDynamicStatementContainer(numOfIndexes_);

		pAuditToggleOffIndexdynamicContainer_ = 
			new CRUSQLDynamicStatementContainer(numOfIndexes_);


		pAuditPopIndexdynamicContainer_->LoadData(translator);
		pAuditAvailableIndeXdynamicContainer_->LoadData(translator);
		pAuditUnavailableIndeXdynamicContainer_->LoadData(translator);
                pAuditToggleOnIndexdynamicContainer_->LoadData(translator);
                pAuditToggleOffIndexdynamicContainer_->LoadData(translator);
	}
}
void CRUTableSyncTaskExecutor::
	LoadRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadRequest(translator);

	Int32 stringSize;
	Int32 const maxStringSize = CUOFsIpcMessageTranslator::MaxMsgSize;
	char buffer[maxStringSize];

	translator.ReadBlock(&stringSize, sizeof(Int32));
	
	RUASSERT(maxStringSize > stringSize);

#pragma nowarn(1506)   // warning elimination 
	translator.ReadBlock(buffer, stringSize);
#pragma warn(1506)  // warning elimination 
	
	tableName_ = CDSString(buffer);

	syncTableDynamicContainer_.LoadData(translator);
}
//--------------------------------------------------------------------------//
//	CRUTableLockProtocol::StoreData()
//
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRUTableLockProtocol::StoreData(CUOFsIpcMessageTranslator &translator)
{
  // Store the NothingToLock_ flag
  translator.WriteBlock(&NothingToLock_, sizeof(BOOL));
  if (NothingToLock_)
    return;

  // Store the number of elements in the lock list
  Lng32 count = LocksList_->GetCount();
  translator.WriteBlock(&count, sizeof(Lng32));

  // Store the lock elements.
  CRUSingleTableLockProtocol *thisLock = NULL;
  DSListPosition pos = LocksList_->GetHeadPosition();
  while (pos != NULL)
  {
    thisLock = LocksList_->GetNext(pos);
    thisLock->StoreData(translator);
  } 

}
void CRUEmpCheck::LoadData(CUOFsIpcMessageTranslator &translator)
{
	pSQLContainer_->LoadData(translator);

	if (NULL == pVec_)
	{
		pVec_ = new CRUEmpCheckVector();
	}
	
	pVec_->LoadData(translator);

	translator.ReadBlock(&checkMask_, sizeof(Lng32));
}
//--------------------------------------------------------------------------//
//	CRUTableLockProtocol::LoadData()
//
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRUTableLockProtocol::LoadData(CUOFsIpcMessageTranslator &translator)
{
  // Load the NothingToLock_ flag
  translator.ReadBlock(&NothingToLock_, sizeof(BOOL));
  if (NothingToLock_)
    return;

  // Load the number of elements in the lock list
  Lng32 count;
  translator.ReadBlock(&count, sizeof(Lng32));

  // Load the lock elements.
  LocksList_ = new LocksList();
  for (Lng32 i=0; i<count; i++)
  {
    // Alloc a new lock object, init it and add it to the list.
    CRUSingleTableLockProtocol *thisLock = new CRUSingleTableLockProtocol();
    thisLock->LoadData(translator);
    LocksList_->AddTail(thisLock);

  }

}
void CRUUnAuditRefreshTaskExecutor::
	StoreRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreRequest(translator);

	translator.WriteBlock(&isPurgedata_, sizeof(BOOL));
	translator.WriteBlock(&isPopindex_, sizeof(BOOL));

	// Store the executor-specific SQL container
	unAuditRefreshTEDynamicContainer_.StoreData(translator);

	translator.WriteBlock(&numOfIndexes_, sizeof(TInt32));

	if (0 < numOfIndexes_)
	{
		pUnAuditPopIndexdynamicContainer_->StoreData(translator);
		pUnAuditAvailableIndeXdynamicContainer_->StoreData(translator);
		pUnAuditUnavailableIndeXdynamicContainer_->StoreData(translator);
	}

	translator.SetMessageType(
		CUOFsIpcMessageTranslator::RU_UNAUDIT_REFRESH_EXECUTOR
	);
}
void CRUSQLDynamicStatementContainer::DynamicStmt::
	LoadData(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadData(translator);

	short size;
	translator.ReadBlock(&size,sizeof(short));

	if (0 == size)
	{
		return;
	}

	translator.ReadBlock(&paramNum_, sizeof(Lng32));

	for (Int32 i=0;i<paramNum_;i++)
	{
		translator.ReadBlock(&(paramsPos_[i]), sizeof(Int32));
	}

	sql_ = new char[size];

	translator.ReadBlock(sql_,size);
}
//--------------------------------------------------------------------------//
//	CRURefreshTaskExecutor::StoreRequest()
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRURefreshTaskExecutor::
	StoreRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::StoreRequest(translator);

	translator.WriteBlock(&isRecompute_,sizeof(BOOL));

	Int32 stringSize = rootMVName_.GetLength() + 1;
	translator.WriteBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.WriteBlock(rootMVName_.c_string(), stringSize);
#pragma warn(1506)  // warning elimination 

	stringSize = rootMVSchema_.GetLength() + 1;
	translator.WriteBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.WriteBlock(rootMVSchema_.c_string(), stringSize);
#pragma warn(1506)  // warning elimination 

	stringSize = rootMVCatalog_.GetLength() + 1;
	translator.WriteBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.WriteBlock(rootMVCatalog_.c_string(), stringSize);
#pragma warn(1506)  // warning elimination 

	translator.WriteBlock(&rootMVUID_, sizeof(TInt64));

	translator.WriteBlock(&rootMVType_, sizeof(Int32));

	translator.WriteBlock(&forceFlags_, sizeof(TInt32));

	if (NO_FORCE != forceFlags_)
	{
		translator.WriteBlock(&numOfStmtInContainer_, sizeof(TInt32));
		
		// Handle refresh executor sql dynamic container
		pRefreshTEDynamicContainer_->StoreData(translator);
	}

	// Handle lock table dynamic container
	short lockTable;
	if (NULL != tableLockProtocol_ )
	{
		lockTable = 1;
		translator.WriteBlock(&lockTable, sizeof(short));
		
		tableLockProtocol_->StoreData(translator);
	}
	else
	{
		lockTable = 0;
		translator.WriteBlock(&lockTable, sizeof(short));
	}

}
//--------------------------------------------------------------------------//
//	CRURefreshTaskExecutor::LoadRequest()
//--------------------------------------------------------------------------//
// LCOV_EXCL_START :cnu
void CRURefreshTaskExecutor::
	LoadRequest(CUOFsIpcMessageTranslator &translator)
{
	inherited::LoadRequest(translator);

	translator.ReadBlock(&isRecompute_,sizeof(BOOL));

	Int32 stringSize;
	char buffer[CUOFsIpcMessageTranslator::MaxMsgSize];

	translator.ReadBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.ReadBlock(buffer, stringSize);
#pragma warn(1506)  // warning elimination 

	rootMVName_ = CDSString(buffer);

	translator.ReadBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.ReadBlock(buffer, stringSize);
#pragma warn(1506)  // warning elimination 

	rootMVSchema_ = CDSString(buffer);

	translator.ReadBlock(&stringSize, sizeof(Int32));
#pragma nowarn(1506)   // warning elimination 
	translator.ReadBlock(buffer, stringSize);
#pragma warn(1506)  // warning elimination 

	rootMVCatalog_ = CDSString(buffer);
	
	translator.ReadBlock(&rootMVUID_, sizeof(TInt64));
	
	translator.ReadBlock(&rootMVType_, sizeof(Int32));

	translator.ReadBlock(&forceFlags_, sizeof(TInt32));

	if (NO_FORCE != forceFlags_)
	{
		translator.ReadBlock(&numOfStmtInContainer_, sizeof(TInt32));
		
		pRefreshTEDynamicContainer_ = 
#pragma nowarn(1506)   // warning elimination 
			new CRUSQLDynamicStatementContainer(numOfStmtInContainer_);		
#pragma warn(1506)  // warning elimination 
		// Handle refresh executor sql dynamic container
		pRefreshTEDynamicContainer_->LoadData(translator);
	}
	
	// Handle lock table dynamic container
	short lockTable;
	translator.ReadBlock(&lockTable, sizeof(short));
	
	if (1 == lockTable)
	{
	  tableLockProtocol_ = new CRUTableLockProtocol();
	  tableLockProtocol_->LoadData(translator);
	}
}