All unit tests compile, but crash. This is the most horrifying commit I've ever made.

This commit is contained in:
Pavel Kirienko
2015-07-01 14:55:24 +03:00
parent feb7600f17
commit 8a2e22046e
42 changed files with 421 additions and 587 deletions
@@ -237,15 +237,15 @@ public:
, allocation_pub_(node)
{ }
int init()
int init(const TransferPriority priority)
{
int res = allocation_pub_.init();
if (res < 0)
{
return res;
}
(void)allocation_pub_.setPriority(TransferPriorityLow);
allocation_pub_.setTxTimeout(MonotonicDuration::fromMSec(Allocation::DEFAULT_REQUEST_PERIOD_MS));
allocation_pub_.setPriority(priority);
allocation_pub_.setTxTimeout(MonotonicDuration::fromMSec(1000 /* TODO FIXME ALLOCATION RANDOMIZATION */));
res = allocation_sub_.start(AllocationCallback(this, &AllocationRequestManager::handleAllocation));
if (res < 0)
@@ -135,7 +135,8 @@ public:
, storage_(storage)
{ }
int init(const UniqueID& own_unique_id)
int init(const UniqueID& own_unique_id,
const TransferPriority priority = TransferPriority::OneHigherThanLowest)
{
/*
* Initializing storage first, because the next step requires it to be loaded
@@ -173,13 +174,13 @@ public:
/*
* Misc
*/
res = allocation_request_manager_.init();
res = allocation_request_manager_.init(priority);
if (res < 0)
{
return res;
}
res = node_discoverer_.init();
res = node_discoverer_.init(priority);
if (res < 0)
{
return res;
@@ -207,7 +207,7 @@ public:
* storage backend using key 'cluster_size'.
* Returns negative error code.
*/
int init(uint8_t init_cluster_size = ClusterSizeUnknown)
int init(const uint8_t init_cluster_size, const TransferPriority priority)
{
/*
* Figuring out the cluster size
@@ -263,7 +263,7 @@ public:
{
return res;
}
(void)discovery_pub_.setPriority(TransferPriorityLow);
discovery_pub_.setPriority(priority);
res = discovery_sub_.start(DiscoveryCallback(this, &ClusterManager::handleDiscovery));
if (res < 0)
@@ -727,7 +727,7 @@ public:
* value from the persistent storage will be used. If not set and there's no such key
* in the persistent storage, initialization will fail.
*/
int init(uint8_t cluster_size = ClusterManager::ClusterSizeUnknown)
int init(const uint8_t cluster_size, const TransferPriority priority)
{
/*
* Initializing state variables
@@ -748,7 +748,7 @@ public:
return res;
}
res = cluster_.init(cluster_size);
res = cluster_.init(cluster_size, priority);
if (res < 0)
{
return res;
@@ -246,12 +246,14 @@ public:
, node_discoverer_(node, tracer, *this)
{ }
int init(const UniqueID& own_unique_id, const uint8_t cluster_size = ClusterManager::ClusterSizeUnknown)
int init(const UniqueID& own_unique_id,
const uint8_t cluster_size = ClusterManager::ClusterSizeUnknown,
const TransferPriority priority = TransferPriority::OneHigherThanLowest)
{
/*
* Initializing Raft core first, because the next step requires Log to be loaded
*/
int res = raft_core_.init(cluster_size);
int res = raft_core_.init(cluster_size, priority);
if (res < 0)
{
return res;
@@ -276,13 +278,13 @@ public:
/*
* Misc
*/
res = allocation_request_manager_.init();
res = allocation_request_manager_.init(priority);
if (res < 0)
{
return res;
}
res = node_discoverer_.init();
res = node_discoverer_.init(priority);
if (res < 0)
{
return res;
@@ -309,8 +309,10 @@ public:
, node_status_sub_(node)
{ }
int init()
int init(const TransferPriority priority)
{
// TODO FIXME set priority
(void)priority;
int res = get_node_info_client_.init();
if (res < 0)
{