๐ป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 by clicking on Create New button as shown below:
Modules can also be created via the Policy editor UI in two ways: 1. By clicking on Create New Module button, 2. Converting policy to Module.
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.
Generic structure of Modules is the same as Policies, most of the functionality used for creation of Policies can be used in Modules.
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:
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.
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.
In the Policy Editor new modules can be created similarly to creating of a new block.
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.
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.
Modules added or created in the policy are โinstancesโ of the module and can only exist inside the policy until they are explicitly saved which adds them to the module library.