link macro is a helper for creating
for use within the entry macro.
It has 5 component parts:
directiondefines if this entry type (in which the link is defined) points to another entry, or if it is referenced from another entry. The latter is needed in cases where the definition of the entry to link from is not accessible because it is a system entry type (AGENT_ADDRESS), or the other entry is defined in library zome. Must be of type LinkDirection, so either
other_typeis the entry type this link connects to. If direction is
tothis would be the link target, if direction is
fromthis defines the link's base type.
link_typeis the name of this association and thus the handle by which it can be retrieved if given to get_links() in conjunction with the base address.
- validation_package: Similar to entries, links have to be validated.
validation_packageis a special identifier, which declares which data is required from peers when attempting to validate entries of this type. Possible values are found within ValidationPackageDefinition
validationis a callback function which will be called any time that a (DHT) node processes or stores a link of this kind, triggered through the link actions link_entries and remove_link. It always expects three arguments, the first being the base and the second the target of the link. The third is the validation
context, which offers a variety of metadata useful for validation. See ValidationData for more details.