$this->getStackerInstance()->pushNamed(self::STACKER_NAME_INSERT_NODE, $nodeData);
} // END - foreach
}
+
+ /**
+ * Find recipients for given package data
+ *
+ * @param $packageData An array of valid package data
+ * @return $recipients An indexed array with DHT recipients
+ */
+ public function findRecipientsByPackageData (array $packageData) {
+ // Get max recipients
+ $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients');
+
+ // Query get a result instance back from DHT database wrapper.
+ $resultInstance = $this->getWrapperInstance()->getResultFromExcludedSender($packageData);
+
+ // Init array
+ $recipients = array();
+
+ // Search for all recipients
+ while ($resultInstance->next()) {
+ // Get current entry
+ $current = $resultInstance->current();
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: current=' . print_r($current, TRUE));
+
+ // Add instance to recipient list
+ array_push($recipients, $current);
+
+ // Has the maximum been reached?
+ if (count($recipients) == $maxRecipients) {
+ // Stop search here
+ break;
+ } // END - if
+ } // END - while
+
+ // Return filled array
+ return $recipients;
+ }
}
// [EOF]