예제 #1
0
 void MergeDispatcher::start_play(
     SeekRange const & range, 
     response_t const & seek_resp)
 {
     LOG_DEBUG("[start_play]");
     dispatch_io_svc().post(MergeTask(task_info(), sink_group(), range, seek_resp, 
         boost::bind(&MergeDispatcher::handle_play, this, _1), merger_));
 }
예제 #2
0
MergeResult ThreeWayMerge::mergeKeySet (const KeySet & base, const KeySet & ours, const KeySet & theirs, const Key & mergeRoot)
{
	Key ourkey = ours.head ().dup ();
	Key theirkey = theirs.head ().dup ();
	Key basekey = base.head ().dup ();

	MergeResult merged = mergeKeySet (
		MergeTask (BaseMergeKeys (base, basekey), OurMergeKeys (ours, ourkey), TheirMergeKeys (theirs, theirkey), mergeRoot));

	return merged;
}
예제 #3
0
int MergingKDB::synchronize (KeySet & returned, Key & parentKey, ThreeWayMerge & merger)
{
	try
	{
		// write our config
		int ret = KDB::set (returned, parentKey);

		// update our config (if no conflict)
		KDB::get (returned, parentKey);

		return ret;
	}
	catch (KDBException const &)
	{
		// a conflict occurred, see if we can solve it with the merger

		// refresh the key database
		KeySet theirs = returned.dup ();
		KDB::get (theirs, parentKey);

		// try to merge
		MergeResult result = merger.mergeKeySet (MergeTask (BaseMergeKeys (base, parentKey), OurMergeKeys (returned, parentKey),
								    TheirMergeKeys (theirs, parentKey), parentKey));

		if (!result.hasConflicts ())
		{
			// hurray, we solved the issue
			KeySet resultKeys = result.getMergedKeys ();
			int ret = KDB::set (resultKeys, parentKey);
			base = resultKeys;
			return ret;
		}
		else
		{
			// nothing we can do anymore
			KeySet conflictSet = result.getConflictSet ();
			throw MergingKDBException (parentKey, conflictSet);
		}
	}
}
예제 #4
0
	MergeTask reverse () const
	{
		return MergeTask (BaseMergeKeys (base, baseParent), OurMergeKeys (theirs, theirParent), TheirMergeKeys (ours, ourParent),
				  mergeRoot);
	}
예제 #5
0
 void MergeDispatcher::start_buffer()
 {
     LOG_DEBUG("[start_buffer]");
     dispatch_io_svc().post(MergeTask(task_info(), 
         boost::bind(&MergeDispatcher::handle_buffer, this, _1), merger_));
 }
예제 #6
0
파일: theory.hpp 프로젝트: imclab/pomagma
void schedule_merge (Ob dep) { schedule(MergeTask(dep)); }