[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25687 - gnunet-update/src/gnunet_update
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25687 - gnunet-update/src/gnunet_update |
Date: |
Fri, 4 Jan 2013 12:45:11 +0100 |
Author: harsha
Date: 2013-01-04 12:45:11 +0100 (Fri, 04 Jan 2013)
New Revision: 25687
Modified:
gnunet-update/src/gnunet_update/hashtree.py
Log:
return full gnunet chk uri
Modified: gnunet-update/src/gnunet_update/hashtree.py
===================================================================
--- gnunet-update/src/gnunet_update/hashtree.py 2013-01-03 22:40:33 UTC (rev
25686)
+++ gnunet-update/src/gnunet_update/hashtree.py 2013-01-04 11:45:11 UTC (rev
25687)
@@ -37,9 +37,14 @@
CHK_QUERY_SIZE = CHK_HASH_SIZE # Again a SHA-512 hash
+GNUNET_FS_URI_PREFIX = "gnunet://fs/" # FS CHK URI prefix
+
+GNUNET_FS_URI_CHK_INFIX = "chk/" # FS CHK URI infix
+
class Chk:
key = None
query = None
+ fsize = None
def __init__(self, key, query):
assert (len(key) == CHK_HASH_SIZE)
@@ -47,6 +52,16 @@
self.key = key
self.query = query
+ def setSize(self, size):
+ self.fsize = size
+
+ def uri(self):
+ return GNUNET_FS_URI_PREFIX + GNUNET_FS_URI_CHK_INFIX + \
+ util.encode_data_to_string(bytearray(self.key)) + "." + \
+ util.encode_data_to_string(bytearray(self.query)) + "." + \
+ repr(self.fsize)
+
+
def compute_depth_(size):
"""Computes the depth of the tree.
@@ -147,6 +162,8 @@
logging.debug("Encoding done, reading CHK `"+ chks[off].query + \
"' from "+ repr(off) +"\n")
uri_chk = chks[off]
+ assert (size == read_offset)
+ uri_chk.setSize (size)
return uri_chk
if (0 == current_depth):
pt_size = min(DBLOCK_SIZE, size - read_offset);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25687 - gnunet-update/src/gnunet_update,
gnunet <=