Struct kanidmd_lib::entry::Entry

source ·
pub struct Entry<VALID, STATE> { /* private fields */ }
Expand description

Entry is the core data storage type of the server. Almost every aspect of the server is designed to read, handle and manipulate entries.

Entries store attribute value assertions, or AVA. These are sets of key-values.

Entries have a lifecycle within a single operation, and as part of replication. The lifecycle for operations is defined through state and valid types. Each entry has a pair Of these types at anytime. The first is the AVA schema and access control assertion state. This is represented by the type VALID as one of EntryValid, EntryInvalid or EntryReduced. Every entry starts as EntryInvalid, and when checked by the schema for correctness, transitions to EntryValid. While an entry is EntryValid it can not be altered - you must invalidate it to EntryInvalid, then modify, then check again. An entry that has had access controls applied moves from EntryValid to EntryReduced, to show that the AVAs have reduced to the valid read set of the current event user.

The second type of STATE represents the database commit state and internal db ID’s. A new entry that has never been committed is EntryNew, but an entry that has been retrieved from the database is EntryCommitted. This affects the operations you can apply IE modify or delete.

These types exist to prevent at compile time, mishandling of Entries, to ensure they are always handled with the correct lifecycles and processes.

Implementations§

source

pub fn from_proto_entry(
    e: &ProtoEntry,
    qs: &mut QueryServerWriteTransaction<'_>
) -> Result<Self, OperationError>

Consume a Protocol Entry from JSON, and validate and process the data into an internal Entry type.

source

pub fn from_proto_entry_str(
    es: &str,
    qs: &mut QueryServerWriteTransaction<'_>
) -> Result<Self, OperationError>

Given a proto entry in JSON formed as a serialised string, processed that string into an Entry.

Assign the Change Identifier to this Entry, allowing it to be modified and then written to the Backend

Compare this entry to another.

Add an attribute-value-assertion to this Entry.

Replace the existing content of an attribute set of this Entry, with a new set of Values.

source

pub fn from_repl_entry_v1(
    repl_entry: &ReplEntryV1
) -> Result<Self, OperationError>

Validate that this entry and its attribute-value sets are conformant to the system’s’ schema and the relevant syntaxes.

Convert this entry into a recycled entry, that is “in the recycle bin”.

Convert this entry into a recycled entry, that is “in the recycle bin”.

Given this validated and sealed entry, process it with a Backend ID number so that it can be then serialised to the database.

If this entry has ever been committed to disk, retrieve it’s database id number.

Insert a claim to this entry. This claim can NOT be persisted to disk, this is only used during a single Event session.

Serialise this entry to it’s Database format ready for storage.

Safety

This function bypasses the access control validation logic and should NOT be used without special care and attention to ensure that no private data is leaked incorrectly to clients. Generally this is ONLY used inside of the access control processing functions which correctly applies the reduction steps.

Given a set of attributes that are allowed to be seen on this entry, process and remove all other values that are NOT allowed in this query.

Convert this recycled entry, into a tombstone ready for reaping.

Given a current transaction change identifier, mark this entry as valid and committed.

Transform this reduced entry into a JSON protocol form that can be sent to clients.

Transform this reduced entry into an LDAP form that can be sent to clients.

Get an iterator over the current set of attribute names that this entry contains.

Get an iterator over the current set of values for an attribute name.

Return a reference to the current set of values that are associated to this attribute.

If possible, return an iterator over the set of values transformed into a &str.

If possible, return an iterator over the set of values transformed into a &str.

If possible, return an iterator over the set of values transformed into a Uuid.

If possible, return an iterator over the set of ssh key values transformed into a &str.

Return a single value of this attributes name, or None if it is NOT present, or there are multiple values present (ambiguous).

Return a single bool, if valid to transform this value into a boolean.

Return a single uint32, if valid to transform this value.

Return a single syntax type, if valid to transform this value.

Return a single credential, if valid to transform this value.

Get the set of passkeys on this account, if any are present.

Get the set of devicekeys on this account, if any are present.

Get the set of uihints on this account, if any are present.

Return a single secret value, if valid to transform this value.

Return a single datetime, if valid to transform this value.

Return a single &Url, if valid to transform this value.

Return a single protocol filter, if valid to transform this value.

Assert if an attribute of this name is present on this entry.

Assert if an attribute of this name is present, and one of it’s values contains the an exact match of this partial value.

Assert if an attribute of this name is present, and one of it’s values contains the following substring, if possible to perform the substring comparison.

Assert if an attribute of this name is present, and one of it’s values is less than the following partial value

Test if the following filter applies to and matches this entry.

Given this entry, generate a filter containing the requested attributes strings as equality components.

Given this entry, generate a modification list that would “assert” another entry is in the same/identical attribute state.

Determine if this entry is recycled or a tombstone, and map that to “None”. This allows filter_map to effectively remove entries that should not be considered as “alive”.

Determine if this entry is recycled, and map that to “None”. This allows filter_map to effectively remove entries that are recycled in some cases.

Determine if this entry is a tombstone, and map that to “None”. This allows filter_map to effectively remove entries that are tombstones in some cases.

Remove all values of this attribute from the entry, and return their content.

Replace the content of this attribute with a new value set. Effectively this is a a “purge and set”.

Apply the content of this modlist to this entry, enforcing the expressed state.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more