Line data Source code
1 :
2 : /* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Cedric Stalder <cedric.stalder@gmail.com>
4 : * Daniel Nachbaur <danielnachbaur@gmail.com>
5 : *
6 : * This file is part of Collage <https://github.com/Eyescale/Collage>
7 : *
8 : * This library is free software; you can redistribute it and/or modify it under
9 : * the terms of the GNU Lesser General Public License version 2.1 as published
10 : * by the Free Software Foundation.
11 : *
12 : * This library is distributed in the hope that it will be useful, but WITHOUT
13 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 : * details.
16 : *
17 : * You should have received a copy of the GNU Lesser General Public License
18 : * along with this library; if not, write to the Free Software Foundation, Inc.,
19 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 : */
21 :
22 : #include "objectSlaveDataOStream.h"
23 :
24 : #include "log.h"
25 : #include "object.h"
26 : #include "objectCommand.h"
27 : #include "objectDataIStream.h"
28 : #include "objectDataOCommand.h"
29 : #include "versionedMasterCM.h"
30 :
31 : namespace co
32 : {
33 34 : ObjectSlaveDataOStream::ObjectSlaveDataOStream(const ObjectCM* cm)
34 : : ObjectDataOStream(cm)
35 34 : , _commit(servus::make_UUID())
36 : {
37 34 : }
38 :
39 34 : ObjectSlaveDataOStream::~ObjectSlaveDataOStream()
40 : {
41 34 : }
42 :
43 0 : void ObjectSlaveDataOStream::enableSlaveCommit(NodePtr node)
44 : {
45 0 : _version = servus::make_UUID();
46 0 : _setupConnection(node, false /* useMulticast */);
47 0 : _enable();
48 0 : }
49 :
50 0 : void ObjectSlaveDataOStream::sendData(const void* data, const uint64_t size,
51 : const bool last)
52 : {
53 0 : send(CMD_OBJECT_SLAVE_DELTA, COMMANDTYPE_OBJECT,
54 0 : _cm->getObject()->getMasterInstanceID(), data, size, last)
55 0 : << _commit;
56 :
57 0 : if (last)
58 0 : _commit = servus::make_UUID();
59 0 : }
60 63 : }
|