2021-07-26 21:00:05 +02:00
use crate ::addressing ::Address ;
2022-03-02 01:14:23 +01:00
use crate ::database ::entry ::InvariantEntry ;
2021-07-26 21:00:05 +02:00
2023-06-18 17:23:48 +02:00
/// Attribute denoting (hierarchical) relation, in the upwards direction. For example, a file `OF` a group, an image `OF` photos, etc.
2023-06-09 13:33:36 +02:00
pub const IS_OF_ATTR : & str = " OF " ;
2023-06-18 17:23:48 +02:00
/// 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`.
2023-06-09 13:33:36 +02:00
pub const ATTR_BY_ATTR : & str = " BY " ;
2021-12-02 21:30:11 +01:00
2023-06-18 17:23:48 +02:00
/// Attribute denoting a human readable label.
2021-12-02 21:30:11 +01:00
pub const LABEL_ATTR : & str = " LBL " ;
2023-06-18 17:23:48 +02:00
/// 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.)
2022-02-09 20:34:52 +01:00
pub const ADDED_ATTR : & str = " ADDED " ;
2021-08-18 11:06:36 +02:00
2023-06-18 17:23:48 +02:00
/// Attribute for cross-vault unambiguous referencing of non-hashable (e.g. UUID) entities.
pub const KEY_ATTR : & str = " KEY " ;
2021-07-26 21:00:05 +02:00
lazy_static! {
2023-06-09 13:33:36 +02:00
pub static ref HIER_ROOT_INVARIANT : InvariantEntry = InvariantEntry {
2023-06-18 17:23:48 +02:00
attribute : String ::from ( KEY_ATTR ) ,
2023-06-09 13:33:36 +02:00
value : " HIER_ROOT " . into ( ) ,
2021-08-18 11:06:36 +02:00
} ;
2023-06-09 13:33:36 +02:00
pub static ref HIER_ROOT_ADDR : Address = HIER_ROOT_INVARIANT . entity ( ) . unwrap ( ) ;
2023-06-18 19:49:26 +02:00
pub static ref TYPE_HASH_ADDRESS : Address = Address ::Hash ( crate ::util ::hash ::Hash ( vec! [ ] ) ) ;
pub static ref TYPE_UUID_ADDRESS : Address = Address ::Uuid ( uuid ::Uuid ::nil ( ) ) ;
pub static ref TYPE_ATTRIBUTE_ADDRESS : Address = Address ::Attribute ( " " . to_string ( ) ) ;
pub static ref TYPE_URL_ADDRESS : Address = Address ::Url ( url ::Url ::parse ( " up: " ) . unwrap ( ) ) ;
2021-07-26 21:00:05 +02:00
}