pub struct LogicalFieldId { /* private fields */ }Expand description
Globally unique identifier for a column in the storage engine.
A LogicalFieldId combines three components into a single 64-bit value:
- Namespace (16 bits): Category of data (user, system, MVCC)
- Table ID (16 bits): Which table the column belongs to
- Field ID (32 bits): Which column within the table
This design prevents ID collisions across different tables and data categories while keeping identifiers compact and easy to pass around.
§Bit Layout
|-------- 64 bits total --------|
| namespace | table_id | field_id |
| 16 bits | 16 bits | 32 bits |§Construction
Use the constructor methods rather than directly manipulating bits:
LogicalFieldId::for_user- User-defined columnsLogicalFieldId::for_mvcc_created_by- MVCC created_by metadataLogicalFieldId::for_mvcc_deleted_by- MVCC deleted_by metadataLogicalFieldId::from_parts- Custom construction
§Thread Safety
LogicalFieldId is Copy and thread-safe.
Implementations§
Source§impl LogicalFieldId
impl LogicalFieldId
Sourcepub const fn into_bytes(self) -> [u8; 8]
pub const fn into_bytes(self) -> [u8; 8]
Sourcepub const fn from_bytes(bytes: [u8; 8]) -> Self
pub const fn from_bytes(bytes: [u8; 8]) -> Self
Converts the given bytes directly into the bitfield struct.
Source§impl LogicalFieldId
impl LogicalFieldId
Sourcepub fn field_id(&self) -> <B32 as Specifier>::InOut
pub fn field_id(&self) -> <B32 as Specifier>::InOut
Returns the value of field_id.
Column identifier within the table (32 bits).
Supports up to ~4.3 billion columns per table. Field ID 0 is reserved for
row ID columns.
Sourcepub fn field_id_or_err(
&self,
) -> Result<<B32 as Specifier>::InOut, InvalidBitPattern<<B32 as Specifier>::Bytes>>
pub fn field_id_or_err( &self, ) -> Result<<B32 as Specifier>::InOut, InvalidBitPattern<<B32 as Specifier>::Bytes>>
Returns the value of field_id.
§Errors
If the returned value contains an invalid bit pattern for field_id.
Column identifier within the table (32 bits).
Supports up to ~4.3 billion columns per table. Field ID 0 is reserved for
row ID columns.
Sourcepub fn with_field_id(self, new_val: <B32 as Specifier>::InOut) -> Self
pub fn with_field_id(self, new_val: <B32 as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of field_id set to the given value.
§Panics
If the given value is out of bounds for field_id.
Column identifier within the table (32 bits).
Supports up to ~4.3 billion columns per table. Field ID 0 is reserved for
row ID columns.
Sourcepub fn with_field_id_checked(
self,
new_val: <B32 as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_field_id_checked( self, new_val: <B32 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of field_id set to the given value.
§Errors
If the given value is out of bounds for field_id.
Column identifier within the table (32 bits).
Supports up to ~4.3 billion columns per table. Field ID 0 is reserved for
row ID columns.
Sourcepub fn set_field_id(&mut self, new_val: <B32 as Specifier>::InOut)
pub fn set_field_id(&mut self, new_val: <B32 as Specifier>::InOut)
Sets the value of field_id to the given value.
§Panics
If the given value is out of bounds for field_id.
Column identifier within the table (32 bits).
Supports up to ~4.3 billion columns per table. Field ID 0 is reserved for
row ID columns.
Sourcepub fn set_field_id_checked(
&mut self,
new_val: <B32 as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_field_id_checked( &mut self, new_val: <B32 as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of field_id to the given value.
§Errors
If the given value is out of bounds for field_id.
Column identifier within the table (32 bits).
Supports up to ~4.3 billion columns per table. Field ID 0 is reserved for
row ID columns.
Sourcepub fn table_id(&self) -> <B16 as Specifier>::InOut
pub fn table_id(&self) -> <B16 as Specifier>::InOut
Returns the value of table_id.
Table identifier (16 bits).
Supports up to 65,535 tables. Table ID 0 is reserved for the system catalog.
Sourcepub fn table_id_or_err(
&self,
) -> Result<<B16 as Specifier>::InOut, InvalidBitPattern<<B16 as Specifier>::Bytes>>
pub fn table_id_or_err( &self, ) -> Result<<B16 as Specifier>::InOut, InvalidBitPattern<<B16 as Specifier>::Bytes>>
Returns the value of table_id.
§Errors
If the returned value contains an invalid bit pattern for table_id.
Table identifier (16 bits).
Supports up to 65,535 tables. Table ID 0 is reserved for the system catalog.
Sourcepub fn with_table_id(self, new_val: <B16 as Specifier>::InOut) -> Self
pub fn with_table_id(self, new_val: <B16 as Specifier>::InOut) -> Self
Returns a copy of the bitfield with the value of table_id set to the given value.
§Panics
If the given value is out of bounds for table_id.
Table identifier (16 bits).
Supports up to 65,535 tables. Table ID 0 is reserved for the system catalog.
Sourcepub fn with_table_id_checked(
self,
new_val: <B16 as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_table_id_checked( self, new_val: <B16 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of table_id set to the given value.
§Errors
If the given value is out of bounds for table_id.
Table identifier (16 bits).
Supports up to 65,535 tables. Table ID 0 is reserved for the system catalog.
Sourcepub fn set_table_id(&mut self, new_val: <B16 as Specifier>::InOut)
pub fn set_table_id(&mut self, new_val: <B16 as Specifier>::InOut)
Sets the value of table_id to the given value.
§Panics
If the given value is out of bounds for table_id.
Table identifier (16 bits).
Supports up to 65,535 tables. Table ID 0 is reserved for the system catalog.
Sourcepub fn set_table_id_checked(
&mut self,
new_val: <B16 as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_table_id_checked( &mut self, new_val: <B16 as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of table_id to the given value.
§Errors
If the given value is out of bounds for table_id.
Table identifier (16 bits).
Supports up to 65,535 tables. Table ID 0 is reserved for the system catalog.
Sourcepub fn namespace(&self) -> <LogicalStorageNamespace as Specifier>::InOut
pub fn namespace(&self) -> <LogicalStorageNamespace as Specifier>::InOut
Returns the value of namespace.
Data category (16 bits).
Determines whether this ID refers to user data, system metadata, or MVCC tracking.
Sourcepub fn namespace_or_err(
&self,
) -> Result<<LogicalStorageNamespace as Specifier>::InOut, InvalidBitPattern<<LogicalStorageNamespace as Specifier>::Bytes>>
pub fn namespace_or_err( &self, ) -> Result<<LogicalStorageNamespace as Specifier>::InOut, InvalidBitPattern<<LogicalStorageNamespace as Specifier>::Bytes>>
Returns the value of namespace.
§Errors
If the returned value contains an invalid bit pattern for namespace.
Data category (16 bits).
Determines whether this ID refers to user data, system metadata, or MVCC tracking.
Sourcepub fn with_namespace(
self,
new_val: <LogicalStorageNamespace as Specifier>::InOut,
) -> Self
pub fn with_namespace( self, new_val: <LogicalStorageNamespace as Specifier>::InOut, ) -> Self
Returns a copy of the bitfield with the value of namespace set to the given value.
§Panics
If the given value is out of bounds for namespace.
Data category (16 bits).
Determines whether this ID refers to user data, system metadata, or MVCC tracking.
Sourcepub fn with_namespace_checked(
self,
new_val: <LogicalStorageNamespace as Specifier>::InOut,
) -> Result<Self, OutOfBounds>
pub fn with_namespace_checked( self, new_val: <LogicalStorageNamespace as Specifier>::InOut, ) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of namespace set to the given value.
§Errors
If the given value is out of bounds for namespace.
Data category (16 bits).
Determines whether this ID refers to user data, system metadata, or MVCC tracking.
Sourcepub fn set_namespace(
&mut self,
new_val: <LogicalStorageNamespace as Specifier>::InOut,
)
pub fn set_namespace( &mut self, new_val: <LogicalStorageNamespace as Specifier>::InOut, )
Sets the value of namespace to the given value.
§Panics
If the given value is out of bounds for namespace.
Data category (16 bits).
Determines whether this ID refers to user data, system metadata, or MVCC tracking.
Sourcepub fn set_namespace_checked(
&mut self,
new_val: <LogicalStorageNamespace as Specifier>::InOut,
) -> Result<(), OutOfBounds>
pub fn set_namespace_checked( &mut self, new_val: <LogicalStorageNamespace as Specifier>::InOut, ) -> Result<(), OutOfBounds>
Sets the value of namespace to the given value.
§Errors
If the given value is out of bounds for namespace.
Data category (16 bits).
Determines whether this ID refers to user data, system metadata, or MVCC tracking.
Source§impl LogicalFieldId
impl LogicalFieldId
Sourcepub fn from_parts(
namespace: LogicalStorageNamespace,
table_id: TableId,
field_id: FieldId,
) -> Self
pub fn from_parts( namespace: LogicalStorageNamespace, table_id: TableId, field_id: FieldId, ) -> Self
Construct a LogicalFieldId from individual components.
This is the most general constructor. Use the convenience methods
(for_user, for_mvcc_created_by, etc.)
for common cases.
Sourcepub fn for_user(table_id: TableId, field_id: FieldId) -> Self
pub fn for_user(table_id: TableId, field_id: FieldId) -> Self
Create an ID for a user-defined column.
This is the most common constructor for regular table columns. It uses the
UserData namespace.
Sourcepub fn for_user_table_0(field_id: FieldId) -> Self
pub fn for_user_table_0(field_id: FieldId) -> Self
Create an ID for a user column in table 0.
This is a convenience method for tests and examples that use the default table ID.
Sourcepub fn for_mvcc_created_by(table_id: TableId) -> Self
pub fn for_mvcc_created_by(table_id: TableId) -> Self
Create an ID for the MVCC created_by column of a table.
Each table has a created_by column that tracks which transaction inserted
each row. The field ID is always u32::MAX as a sentinel value.
Sourcepub fn for_mvcc_deleted_by(table_id: TableId) -> Self
pub fn for_mvcc_deleted_by(table_id: TableId) -> Self
Create an ID for the MVCC deleted_by column of a table.
Each table has a deleted_by column that tracks which transaction deleted
each row (or TXN_ID_NONE if not deleted). The field ID is always u32::MAX - 1
as a sentinel value.
Trait Implementations§
Source§impl CheckTotalSizeMultipleOf8 for LogicalFieldId
impl CheckTotalSizeMultipleOf8 for LogicalFieldId
type Size = TotalSize<BitCount</// Globally unique identifier for a column in the storage engine. /// /// A `LogicalFieldId` combines three components into a single 64-bit value: /// - **Namespace** (16 bits): Category of data (user, system, MVCC) /// - **Table ID** (16 bits): Which table the column belongs to /// - **Field ID** (32 bits): Which column within the table /// /// This design prevents ID collisions across different tables and data categories while /// keeping identifiers compact and easy to pass around. /// /// # Bit Layout /// /// ```text /// |-------- 64 bits total --------| /// | namespace | table_id | field_id | /// | 16 bits | 16 bits | 32 bits | /// ``` /// /// # Construction /// /// Use the constructor methods rather than directly manipulating bits: /// - [`LogicalFieldId::for_user`] - User-defined columns /// - [`LogicalFieldId::for_mvcc_created_by`] - MVCC created_by metadata /// - [`LogicalFieldId::for_mvcc_deleted_by`] - MVCC deleted_by metadata /// - [`LogicalFieldId::from_parts`] - Custom construction /// /// # Thread Safety /// /// `LogicalFieldId` is `Copy` and thread-safe. #[bitfield] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)] #[repr(u64)] pub struct LogicalFieldId { /// Column identifier within the table (32 bits). /// /// Supports up to ~4.3 billion columns per table. Field ID `0` is reserved for /// row ID columns. pub field_id: B32, /// Table identifier (16 bits). /// /// Supports up to 65,535 tables. Table ID `0` is reserved for the system catalog. pub table_id: B16, /// Data category (16 bits). /// /// Determines whether this ID refers to user data, system metadata, or MVCC tracking. pub namespace: LogicalStorageNamespace, }>>
Source§impl Clone for LogicalFieldId
impl Clone for LogicalFieldId
Source§fn clone(&self) -> LogicalFieldId
fn clone(&self) -> LogicalFieldId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more