2015-11-22 02:16:19 +08:00
|
|
|
#pragma once
|
2015-07-04 17:51:33 +08:00
|
|
|
|
|
|
|
#include <cstdlib>
|
2015-07-31 18:36:41 +08:00
|
|
|
#include <cstdint>
|
2015-07-04 17:51:33 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2015-11-22 02:16:19 +08:00
|
|
|
#include "mvcc/id.hpp"
|
2015-10-08 06:58:29 +08:00
|
|
|
#include "snapshot.hpp"
|
|
|
|
|
2015-10-04 15:47:15 +08:00
|
|
|
namespace tx
|
|
|
|
{
|
2015-07-31 18:36:41 +08:00
|
|
|
|
2015-07-04 17:51:33 +08:00
|
|
|
struct Transaction
|
|
|
|
{
|
2015-11-22 02:16:19 +08:00
|
|
|
Transaction(const Id& id, Snapshot<Id> snapshot)
|
2015-10-08 06:58:29 +08:00
|
|
|
: id(id), cid(1), snapshot(std::move(snapshot)) {}
|
2015-07-04 17:51:33 +08:00
|
|
|
|
|
|
|
// index of this transaction
|
2015-11-22 02:16:19 +08:00
|
|
|
Id id;
|
2015-07-04 17:51:33 +08:00
|
|
|
|
2015-07-07 22:18:26 +08:00
|
|
|
// index of the current command in the current transaction;
|
|
|
|
uint8_t cid;
|
|
|
|
|
2015-10-08 06:58:29 +08:00
|
|
|
// a snapshot of currently active transactions
|
2015-11-22 02:16:19 +08:00
|
|
|
Snapshot<Id> snapshot;
|
2015-07-04 17:51:33 +08:00
|
|
|
};
|
|
|
|
|
2015-10-04 15:47:15 +08:00
|
|
|
}
|