gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 02/02: lost-and-found: Export and document the 'losable-


From: gnunet
Subject: [gnunet-scheme] 02/02: lost-and-found: Export and document the 'losable-lost-and-found'.
Date: Wed, 29 Jun 2022 23:31:49 +0200

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 1f78c1e1ef13db462c9ca833b48b19c41bdee607
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Jun 29 21:28:18 2022 +0000

    lost-and-found: Export and document the 'losable-lost-and-found'.
    
    This allows for simplify the DHT service a bit in the next commit.
    
    * doc/concurrency.tm (<losable>): Document it.
    * gnu/gnunet/concurrency/lost-and-found.scm (losable-lost-and-found):
      Rename to ...
      (%losable-lost-and-found): ... this, and define a wrapper ...
      (losable-lost-and-found): ... with a docstring.
---
 doc/concurrency.tm                        |  7 +++++++
 gnu/gnunet/concurrency/lost-and-found.scm | 12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/concurrency.tm b/doc/concurrency.tm
index 4bea13a..ab662e5 100644
--- a/doc/concurrency.tm
+++ b/doc/concurrency.tm
@@ -86,6 +86,13 @@
     </footnote>, subtypes must define the \<#2018\>protocol\<#2019\> (see
     (guile)R6RS Records), otherwise the object will not be added to the
     lost-and-found.
+
+    The lost-and-found to which the losable belongs can be retrieved with the
+    accessor <scm|losable-lost-and-found> \V however, when called on an
+    object of a subtype <scm|\<less\>losable\<gtr\>>, this is only supposed
+    to be done by the implementation of the subtype, such that the
+    implementation can assume it is the only party that adds or retrieves to
+    or from the lost-and-found.
   </explain>
 
   <\example>
diff --git a/gnu/gnunet/concurrency/lost-and-found.scm 
b/gnu/gnunet/concurrency/lost-and-found.scm
index 7465e7d..4d3be1f 100644
--- a/gnu/gnunet/concurrency/lost-and-found.scm
+++ b/gnu/gnunet/concurrency/lost-and-found.scm
@@ -19,7 +19,7 @@
 ;; Author: Maxime Devos
 (define-library (gnu gnunet concurrency lost-and-found)
   (export make-lost-and-found lost-and-found? collect-lost-and-found-operation
-         make-losable <losable> losable?
+         make-losable <losable> losable? losable-lost-and-found
          ;; exported for tests
          (rename (add-found! #{ add-found!}#)))
   (import (only (rnrs base)
@@ -218,7 +218,7 @@ wakeups where the empty list is returned are possible."
 
     ;; TODO: test the 'lost-and-found=#false' case.
     (define-record-type (<losable> make-losable losable?)
-      (fields (immutable lost-and-found losable-lost-and-found))
+      (fields (immutable lost-and-found %losable-lost-and-found))
       (sealed #false)
       (protocol (lambda (%make)
                  (lambda (lost-and-found)
@@ -228,6 +228,14 @@ wakeups where the empty list is returned are possible."
                        (*guard* object))
                      object)))))
 
+    (define (losable-lost-and-found losable)
+      "Retrieve the ‘lost and found’ to which @var{losable} belongs, if any.
+In case that @var{losable} is of a subtype of @var{<losable>}, it is only
+supposed to be used by the implementation of that subtype, unless documented
+otherwise.  TODO: would be nice if there was a simple way to encode that in the
+code ..."
+      (%losable-lost-and-found losable))
+
     (define (collect-lost)
       (define object (*guard*))
       (when object

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