3 * An interface for DHTs
5 * @author Roland Haeder <webmaster@shipsimu.org>
7 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.shipsimu.org
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 interface Distributable extends FrameworkInterface {
26 * Initializes the distributable hash table (DHT)
33 * Bootstraps the DHT by sending out a message to all available nodes
34 * (including itself). This step helps the node to get to know more nodes
35 * which can be queried later for object distribution.
39 function bootstrapDht ();
42 * Updates/refreshes DHT data (e.g. status).
46 function updateDhtData ();
49 * Checks whether there are unpublished entries
51 * @return $hasUnpublished Whether there are unpublished entries
53 function hasUnpublishedEntries ();
56 * Initializes publication of DHT entries. This does only prepare
57 * publication. The next step is to pickup such prepared entries and publish
58 * them by uploading to other (recently appeared) DHT members.
62 function initEntryPublication ();
65 * Checks whether there are entries pending publication
67 * @return $isPending Whether there are entries pending publication
69 function hasEntriesPendingPublication ();
72 * Publishes next entry found in stack. This method shall also update the
73 * corresponding dabase entry.
77 function publishEntry ();
80 * Find recipients for given package data
82 * @param $packageData An array of valid package data
83 * @return $recipients An indexed array with DHT recipients
85 function findRecipientsByPackageData (array $packageData);
88 * Whether the DHT has fully bootstrapped (after state 'booting')
90 * @return $isFullyBooted Whether the DHT is fully booted
92 function hasFullyBootstrapped ();
95 * Whether this DHT's state is 'booting'
97 * @return $isBooting Whether this DHT is currently booting
99 function ifDhtIsBooting ();
102 * Finds DHT recipients by given key/value pair
104 * @param $key Key to search for
105 * @param $value Value to check on found key
106 * @return $recipientList Array with DHT recipients from given key/value pair
108 function findRecipientsByKey ($key, $value);
111 * Enable DHT bootstrap request acceptance for local node
115 function enableAcceptDhtBootstrap ();