gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 13/324: Include the plugin name in item meta-data


From: gnunet
Subject: [gnunet-scheme] 13/324: Include the plugin name in item meta-data
Date: Tue, 21 Sep 2021 13:20:53 +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 9cbb96a29ace417c0256cd7614ce9d905dd5ffff
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sun Nov 8 17:24:19 2020 +0000

    Include the plugin name in item meta-data
    
    Apparently, it is serialised on the wire
---
 gnu/gnunet/metadata.scm | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/gnu/gnunet/metadata.scm b/gnu/gnunet/metadata.scm
index 2430718..3980065 100644
--- a/gnu/gnunet/metadata.scm
+++ b/gnu/gnunet/metadata.scm
@@ -29,8 +29,6 @@
 ;; Brief: Storing of meta data
 
 ;; Deviations from upstream:
-;;  * the name of the plugin metadata has been extracted with
-;;    is not included.
 ;;  * file names in meta-data are not automatically POSIXified.
 
 ;; TODO: (de-)serialisation, dependencies, other procedures
@@ -46,8 +44,10 @@
 
   ;; Meta data item
   (define-record-type (<meta-item> %make-meta-item meta-item?)
-    ;; Mime-type of data (an ASCII string, or #f).
-    (fields (immutable mime-type meta-item-mime-type)
+    ;; Name of extracting plugin (an ASCII string, or #f)
+    (fields (immutable plugin-name meta-item-plugin)
+           ;; Mime-type of data (an ASCII string, or #f).
+           (immutable mime-type meta-item-mime-type)
            ;; The actual meta data (bytevector).
            (immutable data %meta-item-data)
            ;; Type of the meta data (<meta-type>).
@@ -68,14 +68,14 @@
     (assert (meta-item? y))
     (equal? x y))
 
-  (define (make-meta-item mime-type data type format)
+  (define (make-meta-item plugin-name mime-type data type format)
     "Construct a meta data item"
     ;; TODO: make strings read-only when running on Guile Scheme.
     ;; (RNRS scheme doesn't have a string-set! procedure,
     ;; so portable sandboxes can still use this module safely)
     (assert (or mime-type (string? mime-type)))
 
-    (%make-meta-item mime-type data type format))
+    (%make-meta-item plugin-name mime-type data type format))
 
   ;; Meta data to associate with a file, directory or namespace.
   (define-record-type (<meta-data> %make-meta-data meta-data?)
@@ -123,7 +123,7 @@ Warning: two equal MD are not necessarily @lisp{equal?} 
(TODO: yet)."
        (and (equal? (meta-data-items x)
                     (meta-data-items y)))))
 
-  (define (meta-data-extend meta type format data-mime-type data)
+  (define (meta-data-extend meta plugin-name type format data-mime-type data)
     "Extend metadata.  Note that the list of meta data items is
 sorted by size (largest first).
 
@@ -139,12 +139,17 @@ POSIX style ('/') for some meta data, this port doesn't.
 Entries are identified by @var{type} and @var{data}.
 
 @var{meta} metadata to extend
+@var{plugin-name} plugin_name name of the plugin that produced this value;
+special values can be used (i.e. '&lt;zlib&gt;' for zlib being
+used in the main libextractor library and yielding
+meta data) name of extracting plugin
 @var{type} libextractor-type describing the meta data
 @var{format} basic format information about data
 @var{data-mime-type} mime-ype of data (not of original file);
   can be @lisp{#f} (if mime-type is not known) (immutable)
 @var{data} actual meta-data found (bytevector)"
     (assert (meta-data? meta))
+    (assert (string? plugin-name)) ;; TODO perhaps check for \0 bytes
     (assert (extractor:metatype type))
     (assert (extractor:metaformat format))
     (assert (or (not data-mime-type) (string? data-mime-type)))
@@ -157,8 +162,9 @@ Entries are identified by @var{type} and @var{data}.
        (cond ((or (>= i items-length)
                   (< (meta-item-data-size (vector-ref items i))))
               ;; A new entry: insert at the end of the item vector,
-              ;; or earlier. TODO: read-only bytevectors
-              (let* ((meta-item (%make-meta-item data-mime-type
+              ;; or earlier. TODO: read-only bytevectors & strings
+              (let* ((meta-item (%make-meta-item plugin-name
+                                                 data-mime-type
                                                  (bytevector-copy data)
                                                  type
                                                  format))

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