[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6176 - GNUnet/src/applications/fs/gap
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6176 - GNUnet/src/applications/fs/gap |
Date: |
Wed, 6 Feb 2008 22:16:19 -0700 (MST) |
Author: grothoff
Date: 2008-02-06 22:16:18 -0700 (Wed, 06 Feb 2008)
New Revision: 6176
Modified:
GNUnet/src/applications/fs/gap/Makefile.am
GNUnet/src/applications/fs/gap/TODO
GNUnet/src/applications/fs/gap/plan.c
Log:
more calculation stuff
Modified: GNUnet/src/applications/fs/gap/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/gap/Makefile.am 2008-02-06 23:38:42 UTC (rev
6175)
+++ GNUnet/src/applications/fs/gap/Makefile.am 2008-02-07 05:16:18 UTC (rev
6176)
@@ -19,7 +19,7 @@
shared.c shared.h
libgnunetmodule_fs_la_LDFLAGS = \
- -export-dynamic -avoid-version -module
+ -export-dynamic -avoid-version -module -lm
libgnunetmodule_fs_la_LIBADD = \
$(top_builddir)/src/applications/fs/libecrs_core.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/fs/gap/TODO
===================================================================
--- GNUnet/src/applications/fs/gap/TODO 2008-02-06 23:38:42 UTC (rev 6175)
+++ GNUnet/src/applications/fs/gap/TODO 2008-02-07 05:16:18 UTC (rev 6176)
@@ -1,22 +1,3 @@
-HARD STUFF:
-1) priority determination
- - theoretically unbounded (important not to have a max!)
- - bound by inbound priorities for forwarded queries
- - start with priorities similar to current inbound priorities for our own
requests
-2) TTL determination
- - if priority non-zero, use maximum permitted TTL (for ours as well as
forwarded;
- make sure to decrement forwarded priority by at least one; one trust unit
- should correspond to TTL_DECREMENT loss in max TTL)
- - if priority is zero:
- - decrement inbound TTL randomly
- - use single random TTL decrement for local queries (especially for the
first run if we are initiator)
-3) implement PLAN_request target count calculation
- Strategy:
- - if entropy of ratings is high, increase #targets
- - make it possible (even likely) that we only pick one target (keeping most
of the priority!)
-4) implement PLAN_request peer ranking calculation
-
-
DETAILS:
1) make sure that anonymity-level zero content is pushed into
the DHT by both fs (on insert/index) and by migration (for refresh)
Modified: GNUnet/src/applications/fs/gap/plan.c
===================================================================
--- GNUnet/src/applications/fs/gap/plan.c 2008-02-06 23:38:42 UTC (rev
6175)
+++ GNUnet/src/applications/fs/gap/plan.c 2008-02-07 05:16:18 UTC (rev
6176)
@@ -25,6 +25,7 @@
*/
#include "platform.h"
+#include <math.h>
#include "gnunet_protocols.h"
#include "plan.h"
#include "pid_table.h"
@@ -181,6 +182,11 @@
static struct ClientInfoList *clients;
/**
+ * Log_e(2).
+ */
+static double LOG_2;
+
+/**
* Find the entry in the client list corresponding
* to the given client information. If no such entry
* exists, create one.
@@ -452,6 +458,8 @@
unsigned int total_peers;
unsigned long long total_score;
unsigned long long selector;
+ double entropy;
+ double prob;
GNUNET_mutex_lock (GNUNET_FS_lock); /* needed? */
info = clients;
@@ -466,11 +474,7 @@
/* use request type, priority, system load and
entropy of ranking to determine number of peers
to queue */
- target_count = 2; /* FIXME */
-
- if (target_count > total_peers)
- target_count = total_peers;
-
+
/* use biased random selection to select
peers according to ranking; add requests */
total_score = 0;
@@ -481,6 +485,27 @@
total_score += rank->score;
rank = rank->next;
}
+
+ entropy = 0;
+ rank = rpc.rankings;
+ while (rank != NULL)
+ {
+ prob = 1.0 * rank->score / total_score;
+ if (prob > 0.000000001)
+ entropy -= prob * log(prob) / LOG_2;
+ rank = rank->next;
+ }
+
+ if (entropy < 0.001)
+ entropy = 0.001; /* should only be possible if we have virtually only one
choice */
+ target_count = (unsigned int) ceil(entropy);
+ /* limit target count based on value of the reqeust */
+ if (target_count > 2 * request->value + 3)
+ target_count = 2 * request->value + 3;
+
+ if (target_count > total_peers)
+ target_count = total_peers;
+
/* select target_count peers */
for (i = 0; i < target_count; i++)
{
@@ -809,6 +834,7 @@
int
GNUNET_FS_PLAN_init (GNUNET_CoreAPIForPlugins * capi)
{
+ LOG_2 = log(2);
coreAPI = capi;
GNUNET_GE_ASSERT (capi->ectx,
GNUNET_SYSERR !=
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6176 - GNUnet/src/applications/fs/gap,
gnunet <=