const DB_COLUMN_NODE_LIST = 'node_list';
const DB_COLUMN_PUBLICATION_STATUS = 'publication_status';
const DB_COLUMN_ANSWER_STATUS = 'answer_status';
+ const DB_COLUMN_ACCEPT_BOOTSTRAP = 'accept_bootstrap';
// Publication status'
const PUBLICATION_STATUS_PENDING = 'PENDING';
// Assert on required array field
assert(isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER]));
+ // Get max recipients
+ $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients');
+
// First creata a search instance
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Then exclude 'sender' field as the sender is the current (*this*) node
$searchInstance->addExcludeCriteria(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID, $packageData[NetworkPackage::PACKAGE_DATA_SENDER]);
+ // Set limit to maximum DHT recipients
+ $searchInstance->setLimit($maxRecipients);
+
+ // Get a result instance back from DHT database wrapper.
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Return result instance
+ return $resultInstance;
+ }
+
+ /**
+ * Find recopients by given key/value pair. First look for the key and if it
+ * matches, compare the value.
+ *
+ * @param $key Key to look for
+ * @param $value Value to compare if key matches
+ * @return $recipients An indexed array with DHT recipients
+ */
+ public function getResultFromKeyValue ($key, $value) {
+ // Get max recipients
+ $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients');
+
+ // First creata a search instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Find the key/value pair
+ $searchInstance->addCriteria($key, $value);
+
// Get a result instance back from DHT database wrapper.
$resultInstance = $this->doSelectByCriteria($searchInstance);