Пример #1
0
uint128_t FullMasterCM::commit( const uint32_t incarnation )
{
    Mutex mutex( _slaves );
#if 0
    EQLOG( LOG_OBJECTS ) << "commit v" << _version << " " << command 
                         << std::endl;
#endif
    EQASSERT( _version != VERSION_NONE );

    _updateCommitCount( incarnation );
    
    if( _object->isDirty( ))
    {
        InstanceData* instanceData = _newInstanceData();

        instanceData->os.enableCommit( _version + 1, *_slaves );
        _object->getInstanceData( instanceData->os );
        instanceData->os.disable();

        if( instanceData->os.hasSentData( ))
        {
            ++_version;
            EQASSERT( _version != VERSION_NONE );
#if 0
            EQINFO << "Committed v" << _version << "@" << _commitCount
                   << ", id " << _object->getID() << std::endl;
#endif
            _addInstanceData( instanceData );
        }
        else
            _instanceDataCache.push_back( instanceData );
    }
    _obsolete();
    return _version;
}
Пример #2
0
void FullMasterCM::init()
{
    LBASSERT( _commitCount == 0 );
    VersionedMasterCM::init();

    InstanceData* data = _newInstanceData();

    data->os.enableCommit( VERSION_FIRST, *_slaves );
    _object->getInstanceData( data->os );
    data->os.disable();

    _instanceDatas.push_back( data );
    ++_version;
    ++_commitCount;
}
Пример #3
0
void FullMasterCM::_commit()
{
    InstanceData* instanceData = _newInstanceData();
    instanceData->os.enableCommit( _version + 1, *_slaves );
    _object->getInstanceData( instanceData->os );
    instanceData->os.disable();

    if( instanceData->os.hasSentData( ))
    {
        ++_version;
        LBASSERT( _version != VERSION_NONE );
#if 0
        LBINFO << "Committed v" << _version << "@" << _commitCount << ", id "
               << _object->getID() << std::endl;
#endif
        _addInstanceData( instanceData );
    }
    else
        _instanceDataCache.push_back( instanceData );
}