Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Function context

Returns instance of context manager which should be assigned to variable in With item block. Accepts context_name which specifies used name and parameters of context and ID variable which distinguishes different context instances of the same name.

  • Context name is required and currently specifies TTL of context.
  • Context id can be anything with stable textual representation.

Contexts are represented as an dictionary structure containing users data. This structure is shared with all other parsing instances running on the same node.

Implementation limitations

Stored data structure is accessed parallelly!
  • User specified substructures can be only one level deep
  • Lists do not guarantee items order
  • Numeric values can be in some cases incorrect

Due to parallel access to stored data content of structure can look like it’s sometimes incorrect. However this is only result of such parallel access.

To store numeric values there is computed difference to read value and that value is added to stored value. Due to this computed value can be sometimes different to expected value, especially in cases multiplication or division have been used on the value. It is recommended to use only addition or subtraction.

Users should not use comparison to exact value even in cases value is used as an simple counter. Value can be changed (e.g. incremented) in parallel access to structure and therefore contain higher value than expected in serialized access pattern.

During storage of context added or removed values from list are calculated and removed or added to stored structure without respect to indices. This access can result in incorrect order of list elements. Therefore lists should be considered as unordered in difference to normal lists behavior.

Context is allocated or fetched from repository on entering to with statement and is updated in repository on exiting statement. Therefore any modifications to context after leaving statement is ignored and users are discouraged to perform such actions.

Block XML representation

XML representation of function_context block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="function_context">
    <field name="NAME">bd0e8ea7-002a-4d5e-87af-6c623daf4b60</field>
    <value name="VALUE">
      <block type="text">
        <field name="TEXT">default</field>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "Function context"

Block “Function context”