bool ObjectDataIStream::getNextBuffer( uint32_t& compressor, uint32_t& nChunks,
                                       const void** chunkData, uint64_t& size )
{
    if( _commands.empty( ))
    {
        _usedCommand.clear();
        return false;
    }

    _usedCommand = _commands.front();
    _commands.pop_front();
    if( !_usedCommand.isValid( ))
        return false;

    LBASSERT( _usedCommand.getCommand() == CMD_OBJECT_INSTANCE ||
              _usedCommand.getCommand() == CMD_OBJECT_DELTA ||
              _usedCommand.getCommand() == CMD_OBJECT_SLAVE_DELTA );

    ObjectDataICommand command( _usedCommand );
    const uint64_t dataSize = command.getDataSize();

    if( dataSize == 0 ) // empty command
        return getNextBuffer( compressor, nChunks, chunkData, size );

    size = dataSize;
    compressor = command.getCompressor();
    nChunks = command.getChunks();
    switch( command.getCommand( ))
    {
      case CMD_OBJECT_INSTANCE:
        command.get< NodeID >();    // nodeID
        command.get< uint32_t >();  // instanceID
        break;
      case CMD_OBJECT_SLAVE_DELTA:
        command.get< UUID >();      // commit UUID
        break;
    }
    *chunkData = command.getRemainingBuffer( command.getRemainingBufferSize( ));

    setSwapping( command.isSwapping( ));
    return true;
}
示例#2
0
DataIStream& DataIStream::operator = ( const DataIStream& rhs )
{
    _reset();
    setSwapping( rhs.isSwapping( ));
    return *this;
}