]> git.mxchange.org Git - hub.git/blob - application/hub/interfaces/distributable/class_Distributable.php
50bd97aec72fa94cc4062ee9db39778a925d248f
[hub.git] / application / hub / interfaces / distributable / class_Distributable.php
1 <?php
2 /**
3  * An interface for DHTs
4  *
5  * @author              Roland Haeder <webmaster@shipsimu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.shipsimu.org
10  *
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.
15  *
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.
20  *
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/>.
23  */
24 interface Distributable extends FrameworkInterface {
25         /**
26          * Initializes the distributable hash table (DHT)
27          *
28          * @return      void
29          */
30         function initDht ();
31
32         /**
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.
36          *
37          * @return      void
38          */
39         function bootstrapDht ();
40
41         /**
42          * Updates/refreshes DHT data (e.g. status).
43          *
44          * @return      void
45          */
46         function updateDhtData ();
47
48         /**
49          * Checks whether there are unpublished entries
50          *
51          * @return      $hasUnpublished         Whether there are unpublished entries
52          */
53         function hasUnpublishedEntries ();
54
55         /**
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.
59          *
60          * @return      void
61          */
62         function initEntryPublication ();
63
64         /**
65          * Checks whether there are entries pending publication
66          *
67          * @return      $isPending      Whether there are entries pending publication
68          */
69         function hasEntriesPendingPublication ();
70
71         /**
72          * Publishes next entry found in stack. This method shall also update the
73          * corresponding dabase entry.
74          *
75          * @return      void
76          */
77         function publishEntry ();
78
79         /**
80          * Find recipients for given package data
81          *
82          * @param       $packageData    An array of valid package data
83          * @return      $recipients             An indexed array with DHT recipients
84          */
85         function findRecipientsByPackageData (array $packageData);
86
87         /**
88          * Whether the DHT has fully bootstrapped (after state 'booting')
89          *
90          * @return      $isFullyBooted  Whether the DHT is fully booted
91          */
92         function hasFullyBootstrapped ();
93 }
94
95 // [EOF]
96 ?>