wip: document constants, add KEY constant

feat/type-attributes
Tomáš Mládek 2023-06-18 17:23:48 +02:00 committed by Tomáš Mládek
parent 286abc5b7e
commit e6a1d3ba02
1 changed files with 10 additions and 1 deletions

View File

@ -1,15 +1,24 @@
use crate::addressing::Address;
use crate::database::entry::InvariantEntry;
/// Attribute denoting (hierarchical) relation, in the upwards direction. For example, a file `OF` a group, an image `OF` photos, etc.
pub const IS_OF_ATTR: &str = "OF";
/// Attribute denoting that an entry belongs to the set relating to a given (hierarchical) relation.
/// For example, a data blob may have a label entry, and to qualify that label within the context of belonging to a given hierarchical group, that label entry and the hierarchical entry will be linked with `BY`.
pub const ATTR_BY_ATTR: &str = "BY";
/// Attribute denoting a human readable label.
pub const LABEL_ATTR: &str = "LBL";
/// Attribute denoting the date & time an entity was noted in the database.
/// (TODO: This info can be trivially derived from existing entry timestamps, while at the same time the "Introduction problem" is still open.)
pub const ADDED_ATTR: &str = "ADDED";
/// Attribute for cross-vault unambiguous referencing of non-hashable (e.g. UUID) entities.
pub const KEY_ATTR: &str = "KEY";
lazy_static! {
pub static ref HIER_ROOT_INVARIANT: InvariantEntry = InvariantEntry {
attribute: String::from(IS_OF_ATTR),
attribute: String::from(KEY_ATTR),
value: "HIER_ROOT".into(),
};
pub static ref HIER_ROOT_ADDR: Address = HIER_ROOT_INVARIANT.entity().unwrap();