Skip to content

Commit

Permalink
docs: update TableCode comments (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joeyscat authored Dec 23, 2023
1 parent 585dbeb commit f74f2ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/storage/table_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl TableCodec {
(op(BOUND_MIN_TAG), op(BOUND_MAX_TAG))
}

/// Key: TableName_Tuple_0_RowID(Sorted)
/// Key: {TableName}{TUPLE_TAG}{BOUND_MIN_TAG}{RowID}(Sorted)
/// Value: Tuple
pub fn encode_tuple(table_name: &str, tuple: &Tuple) -> Result<(Bytes, Bytes), TypeError> {
let tuple_id = tuple.id.clone().ok_or(TypeError::PrimaryKeyNotFound)?;
Expand All @@ -145,7 +145,7 @@ impl TableCodec {
Tuple::deserialize_from(columns, bytes)
}

/// Key: TableName_IndexMeta_0_IndexID
/// Key: {TableName}{INDEX_META_TAG}{BOUND_MIN_TAG}{IndexID}
/// Value: IndexMeta
pub fn encode_index_meta(
table_name: &str,
Expand All @@ -166,11 +166,11 @@ impl TableCodec {
}

/// NonUnique Index:
/// Key: TableName_Index_0_IndexID_0_DataValue1_DataValue2 ..
/// Key: {TableName}{INDEX_TAG}{BOUND_MIN_TAG}{IndexID}{BOUND_MIN_TAG}{DataValue1}{DataValue2} ..
/// Value: TupleIDs
///
/// Unique Index:
/// Key: TableName_Index_0_IndexID_0_DataValue
/// Key: {TableName}{INDEX_TAG}{BOUND_MIN_TAG}{IndexID}{BOUND_MIN_TAG}{DataValue}
/// Value: TupleIDs
///
/// Tips: The unique index has only one ColumnID and one corresponding DataValue,
Expand Down Expand Up @@ -205,7 +205,7 @@ impl TableCodec {
Ok(bincode::deserialize(bytes)?)
}

/// Key: TableName_Catalog_0_ColumnName_ColumnId
/// Key: {TableName}{COLUMN_TAG}{BOUND_MIN_TAG}{ColumnId}
/// Value: ColumnCatalog
///
/// Tips: the `0` for bound range
Expand All @@ -226,7 +226,7 @@ impl TableCodec {
Ok(bincode::deserialize::<ColumnCatalog>(bytes)?)
}

/// Key: RootCatalog_0_TableName
/// Key: Root{BOUND_MIN_TAG}{TableName}
/// Value: TableName
pub fn encode_root_table(table_name: &str) -> Result<(Bytes, Bytes), TypeError> {
let key = Self::encode_root_table_key(table_name);
Expand Down

0 comments on commit f74f2ce

Please sign in to comment.