gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 02/03: fs/uri: New procedure make-content-hash-key/share


From: gnunet
Subject: [gnunet-scheme] 02/03: fs/uri: New procedure make-content-hash-key/share.
Date: Wed, 30 Nov 2022 11:50:33 +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 7705ec2b72849b33d2c0b87d10939a28e057011a
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Nov 30 11:48:38 2022 +0100

    fs/uri: New procedure make-content-hash-key/share.
---
 gnu/gnunet/fs/uri.scm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gnu/gnunet/fs/uri.scm b/gnu/gnunet/fs/uri.scm
index ca3cb7a..978bd42 100644
--- a/gnu/gnunet/fs/uri.scm
+++ b/gnu/gnunet/fs/uri.scm
@@ -1,6 +1,6 @@
 ;#!r6rs
 ;;   This file is part of scheme-GNUnet, a partial Scheme port of GNUnet.
-;;   Copyright (C) 2003--2014, 2020 GNUnet e.V.
+;;   Copyright (C) 2003--2014, 2020, 2022 GNUnet e.V.
 ;;
 ;;   GNUnet is free software: you can redistribute it and/or modify it
 ;;   under the terms of the GNU Affero General Public License as published
@@ -79,17 +79,20 @@
 ;; module in the gnunetutil library and discussed there.
 
 (library (gnu gnunet fs uri (1 1))
-  (export chk? make-chk chk-key chk-query
+  (export chk? make-chk make-content-hash-key/share chk-key chk-query
           chk-uri? make-chk-uri chk-uri-file-length chk-uri-chk
          chk-uri-parse)
   (import (rnrs base)
           (rnrs records syntactic)
          (gnu gnunet hashcode)
          (gnu gnunet hashcode-ascii)
+         (only (gnu gnunet fs struct) /content-hash-key)
          ;; TODO portability
          (only (guile) make-regexp regexp-exec)
          (only (ice-9 regex) match:substring)
-         (only (srfi srfi-2) and-let*))
+         (only (srfi srfi-2) and-let*)
+         (only (gnu gnunet netstruct syntactic)
+               select))
 
   ;; Size of the individual blocks used for file-sharing.
   ;; TODO: what is the proper place to define this constant
@@ -110,6 +113,14 @@
     (assert (hashcode:512? query))
     (%make-content-hash-key key query))
 
+  (define (make-content-hash-key/share slice)
+    "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))))
+
   ;; Information needed to retrieve a file (content-hash-key
   ;; plus file size)
   (define-record-type (<chk-uri> %make-chk-uri chk-uri?)

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