Browse Source

Minor fixes for Grayspread.

Stefano Cossu 3 years ago
parent
commit
e01d1999f7

+ 1 - 1
lakesuperior/__init__.py

@@ -49,7 +49,7 @@ class Env:
             manually before passing it to the setup.
         """
         if hasattr(self, 'app_globals'):
-            logger.warning('The environment is already set up.')
+            logger.info('The environment is already set up.')
             return
 
         if not config:

+ 1 - 1
lakesuperior/config_parser.py

@@ -53,7 +53,7 @@ def parse_config(config_dir=None):
     # This will hold a dict of all configuration values.
     _config = {}
 
-    logger.info(f'Reading configuration at {config_dir}')
+    print(f'Reading configuration at {config_dir}')
 
     for cname in configs:
         fname = path.join(config_dir, f'{cname}.yml')

+ 48 - 48
lakesuperior/etc.defaults/application.yml

@@ -126,54 +126,54 @@ messaging:
     #   List of channels to send messages to.
     #
     #   Each channel must define the `endpoint` and the `level` parameters.
-    routes:
+    routes: []
 
         ###
         #   Output handler. Currently only ``StompHandler`` is supported.
-        - handler: StompHandler
-
-          ###
-          #   Activate this route.
-          #
-          #   If ``False``, no messages will be emitted for this route.
-          active: True
-
-          ###
-          #   Protocol version. One of ``10``, ``11`` or ``12``.
-          protocol: '11'
-
-          ###
-          #   Host IP address.
-          host: 127.0.0.1
-
-          ###
-          #   Host port.
-          port: 61613
-
-          ###
-          #   User name for authentication.
-          #
-          #   Credentials are optional.
-          username:
-
-          ###
-          #   Password for authentication.
-          password:
-
-          ###
-          #   Message topic.
-          destination: '/topic/fcrepo'
-
-          ###
-          #   Message format: at the moment the following are supported:
-          #
-          #   - ``ASResourceFormatter``: Sends information about a resource
-          #     being created, updated or deleted, by who and when, with no
-          #     further information about what changed.
-          #
-          #   - ``ASDeltaFormatter``:
-          #     Sends the same information as ``ASResourceFormatter`` with the
-          #     addition of the triples that were added and the ones that were
-          #     removed in the request. This may be used to send rich provenance
-          #     data to a preservation system.
-          formatter: ASResourceFormatter
+        #- handler: StompHandler
+
+        #  ###
+        #  #   Activate this route.
+        #  #
+        #  #   If ``False``, no messages will be emitted for this route.
+        #  active: True
+
+        #  ###
+        #  #   Protocol version. One of ``10``, ``11`` or ``12``.
+        #  protocol: '12'
+
+        #  ###
+        #  #   Host IP address.
+        #  host: 127.0.0.1
+
+        #  ###
+        #  #   Host port.
+        #  port: 61613
+
+        #  ###
+        #  #   User name for authentication.
+        #  #
+        #  #   Credentials are optional.
+        #  username:
+
+        #  ###
+        #  #   Password for authentication.
+        #  password:
+
+        #  ###
+        #  #   Message topic.
+        #  destination: '/topic/fcrepo'
+
+        #  ###
+        #  #   Message format: at the moment the following are supported:
+        #  #
+        #  #   - ``ASResourceFormatter``: Sends information about a resource
+        #  #     being created, updated or deleted, by who and when, with no
+        #  #     further information about what changed.
+        #  #
+        #  #   - ``ASDeltaFormatter``:
+        #  #     Sends the same information as ``ASResourceFormatter`` with the
+        #  #     addition of the triples that were added and the ones that were
+        #  #     removed in the request. This may be used to send rich provenance
+        #  #     data to a preservation system.
+        #  formatter: ASResourceFormatter

+ 8 - 6
lakesuperior/model/ldp/ldpr.py

@@ -807,12 +807,14 @@ class Ldpr(metaclass=ABCMeta):
                 elif actor is None and t[1] == nsc['fcrepo'].createdBy:
                     actor = t[2]
 
-        env.app_globals.changelog.append((set(remove_trp), set(add_trp), {
-            'ev_type': ev_type,
-            'timestamp': thread_env.timestamp.format(),
-            'rsrc_type': rsrc_type,
-            'actor': actor,
-        }))
+        # Do not append messages if there are no routes to consume them.
+        if env.app_globals.config['application']['messaging']['routes']:
+            env.app_globals.changelog.append((set(remove_trp), set(add_trp), {
+                'ev_type': ev_type,
+                'timestamp': thread_env.timestamp.format(),
+                'rsrc_type': rsrc_type,
+                'actor': actor,
+            }))
 
 
     def _check_ref_int(self, config):

+ 1 - 3
lakesuperior/model/rdf/graph.pyx

@@ -74,9 +74,7 @@ cdef class Graph:
         """
         Initialize the graph, optionally from Python/RDFlib data.
 
-        An instance of this class is always tied to an underlying store because
-        it only keeps index keys of the graph terms. This allows for very fast
-        `lookup and manipulation sucha as boolean operations.
+        The data of a Graph object are an in-memory copy from the LMDB store.
 
         When initializing a non-empty Graph, a store transaction must be
         opened::

+ 2 - 1
lakesuperior/store/ldp_rs/lmdb_triplestore.pyx

@@ -49,6 +49,7 @@ INT_DUP_MASK = (
 )
 
 cdef:
+    # Term key to serialized term
     DbLabel DB_T_ST = 't:st___',
     # Joined triple keys to context key
     DbLabel DB_SPO_C = 'spo:c__',
@@ -60,7 +61,7 @@ cdef:
     # Indices
     # Namespace to prefix
     DbLabel DB_NS_PFX = 'ns:pfx_',
-    # Term hash to triple key
+    # Term hash to term key
     DbLabel DB_TH_T = 'th:t___',
     # 1-bound lookups
     DbLabel DB_S_PO = 's:po___',

+ 1 - 1
setup.py

@@ -16,7 +16,7 @@ from os import path
 import lakesuperior
 
 # Use this version to build C files from .pyx sources.
-CYTHON_VERSION='0.29.6'
+CYTHON_VERSION='0.29.22'
 
 KLEN = 5 # TODO Move somewhere else (config?)