gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] branch master updated (908fa9d -> 6b5ff8d)


From: gnunet
Subject: [gnunet-scheme] branch master updated (908fa9d -> 6b5ff8d)
Date: Tue, 20 Dec 2022 14:40:27 +0100

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a change to branch master
in repository gnunet-scheme.

    from 908fa9d  Simplify structure analysis.
     new 40a17ea  fs: Normalise names.
     new 6b5ff8d  fs/network: Fix argument order of 
'construct-request-loc-signature'.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 gnu/gnunet/fs/network.scm    | 11 ++++++-----
 gnu/gnunet/fs/quickcheck.scm |  7 +++++--
 gnu/gnunet/fs/uri.scm        | 21 ++++++++++++---------
 tests/file-sharing.scm       | 12 ++++++------
 4 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/gnu/gnunet/fs/network.scm b/gnu/gnunet/fs/network.scm
index 65648a8..3519aae 100644
--- a/gnu/gnunet/fs/network.scm
+++ b/gnu/gnunet/fs/network.scm
@@ -29,8 +29,8 @@
          (only (gnu gnunet fs struct)
                /content-hash-key /:msg:fs:request-loc-signature)
          (only (gnu gnunet fs uri)
-               chk-key ;; TODO rename
-               chk-query
+               content-hash-key-key ;; TODO rename
+               content-hash-key-query
                make-content-hash-key/share)
          (only (gnu gnunet hashcode)
                hashcode:512->slice)
@@ -42,7 +42,8 @@
     ;; (see gnunet-signatures/gnunet_signatures.rst)
     (define %purpose-peer-placement 5)
 
-    (define* (construct-request-loc-signature content-hash-key file-length
+    (define* (construct-request-loc-signature file-length
+                                             content-hash-key
                                              expiration-time
                                              #:key
                                              (purpose %purpose-peer-placement))
@@ -63,10 +64,10 @@ expiring at @var{expiration-time} (TODO type), for 
@var{purpose}
       (set%!* '(purpose) purpose)
       (set%!* '(expiration-time) expiration-time)
       (slice-copy!
-       (hashcode:512->slice (chk-key content-hash-key))
+       (hashcode:512->slice (content-hash-key-key content-hash-key))
        (select* '(content-hash-key key)))
       (slice-copy!
-       (hashcode:512->slice (chk-query content-hash-key))
+       (hashcode:512->slice (content-hash-key-query content-hash-key))
        (select* '(content-hash-key query)))
       (set%!* '(file-length) file-length)
       s)
diff --git a/gnu/gnunet/fs/quickcheck.scm b/gnu/gnunet/fs/quickcheck.scm
index c7e1b4d..9fa622d 100644
--- a/gnu/gnunet/fs/quickcheck.scm
+++ b/gnu/gnunet/fs/quickcheck.scm
@@ -21,12 +21,15 @@
   (import (only (rnrs base) begin define)
          (only (quickcheck arbitrary) $record $natural)
          (only (gnu gnunet fs uri)
-               make-chk chk-key chk-query
+               make-content-hash-key content-hash-key-key
+               content-hash-key-query
                make-chk-uri chk-uri-file-length chk-uri-chk)
          (only (gnu gnunet hashcode quickcheck) $hashcode:512))
   (begin
     (define $content-hash-key
-      ($record make-chk (chk-key $hashcode:512) (chk-query $hashcode:512)))
+      ($record make-content-hash-key
+              (content-hash-key-key $hashcode:512)
+              (content-hash-key-query $hashcode:512)))
 
     ;; Can produce some impossible chk URIs, e.g. multiple
     ;; chk URIs for length=0.
diff --git a/gnu/gnunet/fs/uri.scm b/gnu/gnunet/fs/uri.scm
index 978bd42..ce3b5dd 100644
--- a/gnu/gnunet/fs/uri.scm
+++ b/gnu/gnunet/fs/uri.scm
@@ -79,7 +79,8 @@
 ;; module in the gnunetutil library and discussed there.
 
 (library (gnu gnunet fs uri (1 1))
-  (export chk? make-chk make-content-hash-key/share chk-key chk-query
+  (export content-hash-key? make-content-hash-key make-content-hash-key/share
+         content-hash-key-key content-hash-key-query
           chk-uri? make-chk-uri chk-uri-file-length chk-uri-chk
          chk-uri-parse)
   (import (rnrs base)
@@ -99,15 +100,16 @@
   #;(define DBLOCK_SIZE (* 32 1024))
 
   ;; Content hash key
-  (define-record-type (<content-hash-key> %make-content-hash-key chk?)
+  (define-record-type (<content-hash-key> %make-content-hash-key
+                                         content-hash-key?)
     (fields ;; Hash of the original content, used for encryption.
             ;; Of type <hashcode:512>.
-            (immutable key chk-key)
+            (immutable key content-hash-key-key)
             ;; Hash of the encrypted content, used for querying.
             ;; Of type <hashcode:512>
-            (immutable query chk-query)))
+            (immutable query content-hash-key-query)))
 
-  (define (make-chk key query)
+  (define (make-content-hash-key key query)
     "Construct a <content-hash-key>"
     (assert (hashcode:512? key))
     (assert (hashcode:512? query))
@@ -117,9 +119,10 @@
     "Construct a <content-hash-key> corresponding to the
 @code{/content-hash-key} @var{slice}.  @var{slice} may not be modified
 while the content hash key is in use."
-    (make-chk (make-hashcode:512/share (select /content-hash-key '(key) slice))
-             (make-hashcode:512/share
-              (select /content-hash-key '(query) slice))))
+    (make-content-hash-key
+     (make-hashcode:512/share (select /content-hash-key '(key) slice))
+     (make-hashcode:512/share
+      (select /content-hash-key '(query) slice))))
 
   ;; Information needed to retrieve a file (content-hash-key
   ;; plus file size)
@@ -140,7 +143,7 @@ while the content hash key is in use."
                 (integer? file-length)))
     (assert (and (<= 0 file-length)
                 (< file-length file-length-limit)))
-    (assert (chk? chk))
+    (assert (content-hash-key? chk))
     (%make-chk-uri file-length chk))
 
   ;; TODO: location URIs, ksk URIs?
diff --git a/tests/file-sharing.scm b/tests/file-sharing.scm
index b3cdbf0..fc3839e 100644
--- a/tests/file-sharing.scm
+++ b/tests/file-sharing.scm
@@ -32,10 +32,10 @@
 (define (normalise list)
   (pk list)
   (map (match-lambda
-       ((? chk? #;content-hash-key? k)
-        (make-chk
-         (copy-hashcode:512 (chk-key k))
-         (copy-hashcode:512 (chk-query k))))
+       ((? content-hash-key? k)
+        (make-content-hash-key
+         (copy-hashcode:512 (content-hash-key-key k))
+         (copy-hashcode:512 (content-hash-key-query k))))
        (foo foo))
        list))
 
@@ -46,12 +46,12 @@
 (define $file-length $natural) ; TODO bounds
 (define $purpose $natural) ; TODO bounds
 (define $expiration-time $natural) ; TODO bounds
-(test-expect-fail 1)
+
 (test-roundtrip "analyse + construct round-trips (request-loc-signature)"
                analyse-request-loc-signature construct-request-loc-signature*
                normalise
-               (content-hash-key $content-hash-key)
                (file-length $file-length)
+               (content-hash-key $content-hash-key)
                (expiration-time $expiration-time)
                (purpose $purpose))
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]