void node::set_steps(stream_size_type steps) { switch (get_state()) { case STATE_FRESH: case STATE_IN_PREPARE: case STATE_IN_PROPAGATE: break; case STATE_IN_BEGIN: log_error() << "set_steps in begin(); use set_steps in propagate() instead." << std::endl; throw call_order_exception("set_steps"); default: log_error() << "set_steps in unknown state " << get_state() << std::endl; throw call_order_exception("set_steps"); } m_parameters.stepsTotal = m_stepsLeft = steps; }
void node::add_pull_source(const node_token & dest) { if (get_state() != STATE_FRESH) { throw call_order_exception("add_pull_source called too late"); } bits::node_map::ptr m = token.map_union(dest); m->add_relation(token.id(), dest.id(), bits::pulls); }
void node::forward_any(std::string key, boost::any value) { switch (get_state()) { case STATE_FRESH: case STATE_IN_PREPARE: case STATE_AFTER_PREPARE: // Allowed since forward() is allowed in prepare() break; case STATE_IN_PROPAGATE: case STATE_AFTER_PROPAGATE: // Allowed since forward() is allowed in propagate() break; case STATE_IN_BEGIN: throw call_order_exception("forward"); case STATE_AFTER_BEGIN: case STATE_IN_END: case STATE_AFTER_END: // Allowed since forward() is allowed in end() break; default: log_debug() << "forward in unknown state " << get_state() << std::endl; break; } add_forwarded_data(key, value, true); bits::node_map::ptr nodeMap = get_node_map()->find_authority(); typedef node_token::id_t id_t; std::vector<id_t> successors; nodeMap->get_successors(get_id(), successors, true); for (size_t i = 0; i < successors.size(); ++i) { nodeMap->get(successors[i])->add_forwarded_data(key, value, false); } }
void node::set_memory_fraction(double f) { switch (get_state()) { case STATE_IN_PROPAGATE: case STATE_AFTER_PROPAGATE: case STATE_FRESH: case STATE_IN_PREPARE: break; default: throw call_order_exception("set_memory_fraction"); } m_parameters.memoryFraction = f; }
void node::set_maximum_memory(memory_size_type maximumMemory) { switch (get_state()) { case STATE_IN_PROPAGATE: case STATE_AFTER_PROPAGATE: case STATE_FRESH: case STATE_IN_PREPARE: break; default: throw call_order_exception("set_maximum_memory"); } m_parameters.maximumMemory = maximumMemory; }
node::node(node && other) : token(other.token, this) , m_parameters(std::move(other.m_parameters)) , m_buckets(std::move(other.m_buckets)) , m_stepsLeft(std::move(other.m_stepsLeft)) , m_pi(std::move(other.m_pi)) , m_state(std::move(other.m_state)) , m_plotOptions(std::move(other.m_plotOptions)) { if (m_state != STATE_FRESH) throw call_order_exception( "Tried to move pipeline node after prepare had been called"); }
node::node(const node & other) : token(other.token, this) , m_parameters(other.m_parameters) , m_availableMemory(other.m_availableMemory) , m_flushPriority(other.m_flushPriority) , m_stepsLeft(other.m_stepsLeft) , m_pi(other.m_pi) , m_state(other.m_state) , m_plotOptions(other.m_plotOptions) { if (m_state != STATE_FRESH) throw call_order_exception( "Tried to copy pipeline node after prepare had been called"); }
node::node(node && other) : token(std::move(other.token), this) , m_parameters(std::move(other.m_parameters)) , m_availableMemory(std::move(other.m_availableMemory)) , m_flushPriority(std::move(other.m_flushPriority)) , m_stepsLeft(std::move(other.m_stepsLeft)) , m_pi(std::move(other.m_pi)) , m_state(std::move(other.m_state)) , m_plotOptions(std::move(other.m_plotOptions)) { if (m_state != STATE_FRESH) throw call_order_exception( "Tried to move pipeline node after prepare had been called"); }
void node::add_push_destination(const node & dest) { if (get_state() != STATE_FRESH) { throw call_order_exception("add_push_destination called too late"); } add_push_destination(dest.token); }