-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,4 @@ mod lock_manager; | |
mod transaction; | ||
mod transaction_manager; | ||
|
||
pub type TransactionId = u64; | ||
|
||
pub use transaction::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,33 @@ | ||
use crate::Tuple; | ||
|
||
pub type TransactionId = u64; | ||
pub const INVALID_TRANSACTION_ID: TransactionId = 0; | ||
|
||
pub enum TransactionState { | ||
Running, | ||
Tainted, | ||
Committed, | ||
Aborted, | ||
} | ||
|
||
pub struct Transaction {} | ||
|
||
/// Represents a link to a previous version of this tuple | ||
pub struct UndoLink { | ||
prev_txn: TransactionId, | ||
prev_log_idx: u32, | ||
} | ||
|
||
impl UndoLink { | ||
pub fn is_valid(&self) -> bool { | ||
self.prev_txn != INVALID_TRANSACTION_ID | ||
} | ||
} | ||
|
||
pub struct UndoLog { | ||
is_deleted: bool, | ||
modified_fields: Vec<bool>, | ||
tuple: Tuple, | ||
timestamp: u64, | ||
prev_version: UndoLink, | ||
} |