gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 03/03: dht/client: New analysis and construction procedu


From: gnunet
Subject: [gnunet-scheme] 03/03: dht/client: New analysis and construction procedures.
Date: Fri, 11 Feb 2022 20:38:12 +0100

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

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

commit f383c7235ee0b7b67978f22e8c23ba2847dcee28
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Fri Feb 11 19:36:18 2022 +0000

    dht/client: New analysis and construction procedures.
    
    * gnu/gnunet/dht/client.scm
      (construct-client-get-stop,analyse-client-get-stop): New procedures.
    * gnu/gnunet/dht/network.scm: Export them.
    * doc/distributed-hash-table.scm
      (construct-client-get-stop,analyse-client-get-stop): Document new
      procedures.
---
 doc/distributed-hash-table.tm | 11 +++++++++++
 gnu/gnunet/dht/client.scm     | 23 +++++++++++++++++++++++
 gnu/gnunet/dht/network.scm    |  2 ++
 3 files changed, 36 insertions(+)

diff --git a/doc/distributed-hash-table.tm b/doc/distributed-hash-table.tm
index b9f25fe..46eb5db 100644
--- a/doc/distributed-hash-table.tm
+++ b/doc/distributed-hash-table.tm
@@ -209,6 +209,12 @@
     \<#2018\>unique id\<#2019\> and <var|options> as options.
   </explain>
 
+  <\explain>
+    <scm|(construct-client-get-stop <var|key>
+    <var|unique-id>)><index|construct-client-get-stop>
+  </explain|Create a new <scm|/:msg:dht:client:get:stop> message for
+  cancelling a get request.>
+
   <\explain>
     <scm|(construct-client-put <var|insertion> #:optional (options
     0))><index|construct-client-put>
@@ -235,6 +241,11 @@
     <var|message>. Xqueries are currently unsupported.
   </explain>
 
+  <\explain>
+    <scm|(analyse-client-get-stop 
<var|message>)><index|analyse-client-get-stop>
+  </explain|Return the unique id and the key corresponding to the
+  <scm|/:msg:dht:client:stop> message <var|message>.>
+
   <\explain>
     <scm|(analyse-client-put <var|message>)><index|analyse-client-put>
   <|explain>
diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 12bd9d7..2520bf6 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -51,9 +51,11 @@
          ;; Network message manipulation procedures
          ;; (these belong to (gnu gnunet dht network)).
          (rename (construct-client-get #{ construct-client-get}#)
+                 (construct-client-get-stop #{ construct-client-get-stop}#)
                  (construct-client-put #{ construct-client-put}#)
                  (construct-client-result #{ construct-client-result}#)
                  (analyse-client-get #{ analyse-client-get}#)
+                 (analyse-client-get-stop #{ analyse-client-get-stop}#)
                  (analyse-client-put #{ analyse-client-put}#)
                  (analyse-client-result #{ analyse-client-result}#))
 
@@ -413,6 +415,21 @@ slices in @var{old} do not impact the new search result."
       (set%!/get '(unique-id) unique-id)
       s)
 
+    (define* (construct-client-get-stop key unique-id)
+      "Create a new @code{/:msg:dht:client:get:stop} message for cancelling a
+get request with @var{unique-id} as unique id and @var{key} as key."
+      (define s (make-slice/read-write (sizeof /:msg:dht:client:get:stop '())))
+      (define-syntax set%!/stop
+       (cut-syntax set%! /:msg:dht:client:get:stop <> s <>))
+      (set%!/stop '(header size) (slice-length s))
+      (set%!/stop '(header type)
+                 (value->index
+                  (symbol-value message-type msg:dht:client:get:stop)))
+      (set%!/stop '(reserved) 0)
+      (set%!/stop '(unique-id) unique-id)
+      (slice-copy! key (select /:msg:dht:client:get:stop '(key) s))
+      s)
+
     (define* (construct-client-put insertion #:optional (options 0))
       "Create a new @code{/:msg:dht:client:put} message for the insertion
 object insertion with @var{options} as options."
@@ -493,6 +510,12 @@ currently unsupported."
                            desired-replication-level)))
            (values query unique-id options)))
 
+    (define (analyse-client-get-stop message)
+      "Return the unique id and the key corresponding to the
+@code{/:msg:dht:client:stop} message @var{message}."
+      (values (read% /:msg:dht:client:get:stop '(unique-id) message)
+             (select /:msg:dht:client:get:stop '(key) message)))
+
     (define (analyse-client-put message)
       "Return the insertion object and options corresponding to the
 @code{/:msg:dht:client:put} message @var{message}."
diff --git a/gnu/gnunet/dht/network.scm b/gnu/gnunet/dht/network.scm
index 6dd4129..79b16fe 100644
--- a/gnu/gnunet/dht/network.scm
+++ b/gnu/gnunet/dht/network.scm
@@ -20,8 +20,10 @@
          analyse-client-get analyse-client-put analyse-client-result)
   (import (rename (gnu gnunet dht client)
                  (#{ construct-client-get}# construct-client-get)
+                 (#{ construct-client-get-stop}# construct-client-get-stop)
                  (#{ construct-client-put}# construct-client-put)
                  (#{ construct-client-result}# construct-client-result)
                  (#{ analyse-client-get}# analyse-client-get)
+                 (#{ analyse-client-get-stop}# analyse-client-get-stop)
                  (#{ analyse-client-put}# analyse-client-put)
                  (#{ analyse-client-result}# analyse-client-result))))

-- 
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]