pub enum ShortId {
LocallyUnique,
Fixed(NonZeroU32),
}
Expand description
A compressed form of an Application Identifier.
ShortIds are useful for more efficient operations with app identifiers within the kernel. They are guaranteed to be unique among all running processes on the same board. However, as they are only 32 bits they are not globally unique.
ShortIds are persistent across restarts of the same app (whereas ProcessIDs are not).
As ShortIds must be unique for each app on a board, and since not every
platform may have a use for ShortIds, the definition of a ShortId provides a
convenient mechanism for meeting the uniqueness requirement without actually
requiring assigning unique discrete values to each app. This is done with
the LocallyUnique
variant which is an abstract ID that is guaranteed to be
unique (i.e. an equality comparison with any other ShortId will always
return false
). Platforms which have a use for an actual number for a
ShortId
should use the Fixed(NonZeroU32)
variant. Note, for type space
efficiency, we disallow using the number 0 as a fixed ShortId.
ShortIds are assigned to the app as part of the credential checking process.
Specifically, an implementation of the process_checker::Compress
trait
assigns ShortIds.
Variants§
LocallyUnique
An abstract ShortId
that is always guaranteed to be unique. As this is
not an actual discrete value, it cannot be used for anything other than
meeting the uniqueness requirement.
Fixed(NonZeroU32)
A 32 bit number ShortId
. This fixed value is guaranteed to be unique
among all running processes as the kernel will not start two processes
with the same ShortId.