pub fn upsert_entity<F: Fs>(
db: &mut GraphDb<F>,
key: &str,
label: Option<&str>,
row: BTreeMap<String, Value>,
aliases: &[String],
) -> Result<UpsertOutcome>Expand description
Create or update one entity by key, with the policy every surface shares.
idis never taken fromrow: on a create it is set tokey, and on an update it is left alone.- A create needs
label. An update never changes one: alabelthat differs from the stored one is refused before anything is written, so nothing inrowis applied either. - A
rowentrynsequal to the namespace the node is already in is the engine’s no-op and is not counted as an update; a different one is the engine’sNamespaceImmutablerefusal. - Aliases are maintained and a provisional mark is cleared, as
describe_entity_with_aliasesdoes. - A
keythat is empty or only whitespace is refused before anything is read or written, whether or not a node is stored under it. - A create under a
labelthat is empty or only whitespace is refused before anything is written, bydescribe_entity_with_aliases. On an update such a label is the relabel refusal above, like any other label the node does not carry.
Reads and writes on the one &mut handle, so the existence check and the
write cannot be separated by another writer.
§Errors
GraphError::IngestError for the four policy refusals, with the whole
sentence in detail; any engine refusal, as it came.