Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:eile/codash

  • Loading branch information...
commit 96aa4a6647481be5c5ac4119f781deb7e72bcf41 2 parents 5c0d1fc + 6afa62f
@eile authored
View
2  CMakeLists.txt
@@ -40,7 +40,7 @@ include_directories(${LUNCHBOX_INCLUDE_DIRS})
include(InstallSymlink)
add_subdirectory(codash)
add_subdirectory(tests)
-#add_subdirectory(doc)
+add_subdirectory(doc)
include(DoxygenRule)
include(CTest)
View
2  codash/api.h
@@ -22,7 +22,7 @@
#define CODASH_API_H
/**
- * @file codash/api.h
+ * @file api.h
*
* Defines shared library symbol visibility macros.
*/
View
2  codash/detail/communicator.cpp
@@ -37,7 +37,6 @@ Communicator::Communicator( int argc, char** argv,
, context_()
, localNode_()
, objectMap_( 0 )
- , objectMapVersion_( co::VERSION_FIRST )
, factory_()
{
if( conn && co::init( argc, argv ))
@@ -56,7 +55,6 @@ Communicator::Communicator( co::LocalNodePtr localNode )
, context_()
, localNode_( localNode )
, objectMap_( new co::ObjectMap( *localNode_, factory_ ))
- , objectMapVersion_( co::VERSION_FIRST )
, factory_()
{}
View
7 codash/detail/communicator.h
@@ -52,16 +52,15 @@ class Communicator : public co::Serializable
enum DirtyBits
{
- DIRTY_NODES = co::Serializable::DIRTY_CUSTOM << 0,
- DIRTY_COMMIT = co::Serializable::DIRTY_CUSTOM << 1,
- DIRTY_COMMIT_VERSION = co::Serializable::DIRTY_CUSTOM << 2
+ DIRTY_NODES = co::Serializable::DIRTY_CUSTOM << 0,
+ DIRTY_COMMIT = co::Serializable::DIRTY_CUSTOM << 1,
+ DIRTY_OBJECTMAP = co::Serializable::DIRTY_CUSTOM << 2
};
bool owner_;
dash::Context context_;
co::LocalNodePtr localNode_;
co::ObjectMap* objectMap_;
- uint128_t objectMapVersion_;
ObjectFactory factory_;
};
View
25 codash/detail/receiver.cpp
@@ -44,6 +44,7 @@ Receiver::Receiver( int argc, char** argv, co::ConnectionDescriptionPtr conn )
, nodes_()
, commit_()
, queuedVersions_()
+ , objectMapVersion_( co::VERSION_FIRST )
{
localNode_->registerPushHandler( groupID_,
boost::bind( &Receiver::handleInit_, this, _1, _2, _3, _4 ));
@@ -56,6 +57,7 @@ Receiver::Receiver( co::LocalNodePtr localNode )
, nodes_()
, commit_()
, queuedVersions_()
+ , objectMapVersion_( co::VERSION_FIRST )
{
localNode_->registerPushHandler( groupID_,
boost::bind( &Receiver::handleInit_, this, _1, _2, _3, _4 ));
@@ -81,6 +83,7 @@ bool Receiver::connect( co::ConnectionDescriptionPtr conn )
proxyNode_->send( packet );
monitor.waitEQ( true );
processMappings_();
+ objectMapVersion_ = objectMap_->getVersion();
return true;
}
@@ -163,8 +166,7 @@ bool Receiver::sync()
return false;
}
else
- LBWARN << "Got timeout while waiting for new data"
- << std::endl;
+ LBWARN << "Got timeout while waiting for new data" << std::endl;
}
Communicator::sync( version );
@@ -181,14 +183,6 @@ void Receiver::serialize( co::DataOStream& os, const uint64_t dirtyBits )
void Receiver::deserialize( co::DataIStream& is, const uint64_t dirtyBits )
{
- if( dirtyBits == co::Serializable::DIRTY_ALL )
- {
- uint128_t id;
- is >> id;
- mapQueue_.push_back( boost::bind( &co::LocalNode::mapObject,
- localNode_.get(), objectMap_, id, co::VERSION_OLDEST ));
- }
-
if( dirtyBits & DIRTY_NODES )
{
uint64_t size;
@@ -205,8 +199,15 @@ void Receiver::deserialize( co::DataIStream& is, const uint64_t dirtyBits )
}
if( dirtyBits & DIRTY_COMMIT )
is >> commit_;
- if( dirtyBits & DIRTY_COMMIT_VERSION )
- is >> objectMapVersion_;
+ if( dirtyBits & DIRTY_OBJECTMAP )
+ {
+ co::ObjectVersion ov;
+ is >> ov;
+ objectMapVersion_ = ov.version;
+ if( !objectMap_->isAttached( ))
+ mapQueue_.push_back( boost::bind( &co::LocalNode::mapObject,
+ localNode_.get(), objectMap_, ov ));
+ }
Communicator::deserialize( is, dirtyBits );
}
View
1  codash/detail/receiver.h
@@ -74,6 +74,7 @@ class Receiver : public Communicator
IDVector nodes_;
uint128_t commit_;
lunchbox::MTQueue< uint128_t > queuedVersions_;
+ uint128_t objectMapVersion_;
};
}
View
18 codash/detail/sender.cpp
@@ -62,8 +62,8 @@ void Sender::init_()
if( !localNode_ )
return;
- localNode_->registerObject( this );
localNode_->registerObject( objectMap_ );
+ localNode_->registerObject( this );
localNode_->registerCommandHandler( initCmd_,
boost::bind( &Sender::cmdConnect_, this, _1 ),
localNode_->getCommandThreadQueue( ));
@@ -110,21 +110,15 @@ void Sender::commit()
else
commit_->setValue( newCommit );
- const uint128_t& newVersion = objectMap_->commit();
- if( objectMapVersion_ != newVersion )
- {
- objectMapVersion_ = newVersion;
- setDirty( DIRTY_COMMIT_VERSION );
- }
+ const uint128_t oldVersion = objectMap_->getVersion();
+ if( objectMap_->commit() > oldVersion )
+ setDirty( DIRTY_OBJECTMAP );
Communicator::commit();
}
void Sender::serialize( co::DataOStream& os, const uint64_t dirtyBits )
{
- if( dirtyBits == co::Serializable::DIRTY_ALL )
- os << objectMap_->getID();
-
if( dirtyBits & DIRTY_NODES )
{
os << static_cast< uint64_t >( nodeMap_.size( ));
@@ -135,8 +129,8 @@ void Sender::serialize( co::DataOStream& os, const uint64_t dirtyBits )
}
if( dirtyBits & DIRTY_COMMIT )
os << (commit_ ? commit_->getID() : uint128_t::ZERO);
- if( dirtyBits & DIRTY_COMMIT_VERSION )
- os << objectMapVersion_;
+ if( dirtyBits & DIRTY_OBJECTMAP )
+ os << co::ObjectVersion( objectMap_ );
Communicator::serialize( os, dirtyBits );
}
View
5 doc/CMakeLists.txt
@@ -1,5 +1,2 @@
-# Copyright (c) 2012 Stefan Eilemann <eile@eyescale.ch>
-
-install(FILES ../AUTHORS.txt ../ACKNOWLEDGEMENTS.txt ../LGPL.txt
- ../LICENSE.txt DESTINATION share/Lunchbox/doc COMPONENT doc)
+install(FILES ../AUTHORS ../COPYING DESTINATION share/codash/doc COMPONENT doc)
View
2  doc/Doxyfile
@@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = Codash
+PROJECT_NAME = codash
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
Please sign in to comment.
Something went wrong with that request. Please try again.