💻Modules using UI
Last updated
Last updated
For a demo example of following steps, here is the policy timestamp: 1677851599.493646003
Policy Modules are large-scale components of the policy containing multiple blocks and internal events. Modules expose external interfaces through which they interoperate with the rest of the policy (blocks).
Modules are managed via the corresponding page in the Policies section.
Modules can be created via the Modules management page in the Guardian UI.
Modules can also be created via the Policy editor UI.
Modules can be imported from local file system or from IPFS via messageIds.
Modules can be exported as files or/and ‘published’ into IPFS. For published modules users can retrieve its messageId which can serve as a reference for import elsewhere.
Modules which have not been published can be deleted.
Modules which have not been published can be edited.
The ‘insides’ of modules are isolated from the rest of Policy it may be embedded into. The external view of a module is represented by Variables and Input\Output Events, which serve as an interface of the Module and transmit data into and out of the module.
2.1.1 Generic structure
Generic structure of Modules is the same as Policies, most of the functionality used for creation of Policies can be used in Modules.
2.1.2 Variables
Variable are part of the external interface of Modules, they are used to represent schemas/tokens/topics/roles inside the module, their values are assigned outside of the module in the Policy where the module is embedded.
Creating variables:
Using variables inside modules:
Assigning values to the (module) variables in Policy:
2.1.3 Input\Output Events
Similarly to Variables, Input\Output Events are the second part of the interface for Modules. Events define which events this module will receive from and send to other block in the Policy (external to the module).
Input Events – incoming events into the module. For the rest of the Policy this is the ingress endpoint for the module, from inside the module this is the point where all events appear to be generated.
Output Events – outgoing events from the module. From the rest of the policy this looks like the point of events generation, while inside the module this is the event sink.
2.2.1 Using existing modules
Saved modules can be found in the left-hand panel in the Modules section of the UI. They can be used similarly to the ordinary Policy blocks.
2.2.2 Creating new modules
In the Policy Editor new modules can be created similarly to creating of a new block.
2.2.3 Transforming blocks into modules
Selected block can be transformed into a module together with all its child components and events.
Important Note: Settings for roles, tokens, schemas and topics, as well as events which are external for the block will be lost during the conversion.
2.2.4 Editing modules
Module added to the policy can be freely edited and changed. Module can be opened for viewing and editing via the navigation panel or by double-clicking its icon in the Policy editor.
2.2.5 Saving modules
Modules added or created in the policy are ‘instances’ of the module and only exist inside the policy until they are explicitly saved which ads them to the module library.