MiniOB
1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
src
observer
storage
trx
vacuous_trx.h
1
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2
miniob is licensed under Mulan PSL v2.
3
You can use this software according to the terms and conditions of the Mulan PSL v2.
4
You may obtain a copy of Mulan PSL v2 at:
5
http://license.coscl.org.cn/MulanPSL2
6
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9
See the Mulan PSL v2 for more details. */
10
11
//
12
// Created by Wangyunlai on 2023/4/24.
13
//
14
15
#pragma once
16
17
#include "storage/trx/trx.h"
18
22
class
VacuousTrxKit
:
public
TrxKit
23
{
24
public
:
25
VacuousTrxKit
() =
default
;
26
virtual
~VacuousTrxKit
() =
default
;
27
28
RC init()
override
;
29
const
vector<FieldMeta> *trx_fields()
const override
;
30
31
Trx
*create_trx(
LogHandler
&log_handler)
override
;
32
Trx
*create_trx(
LogHandler
&log_handler, int32_t trx_id)
override
;
33
void
all_trxes(vector<Trx *> &trxes)
override
;
34
35
void
destroy_trx(
Trx
*trx)
override
;
36
37
LogReplayer
*create_log_replayer(
Db
&db,
LogHandler
&log_handler)
override
;
38
};
39
40
class
VacuousTrx
:
public
Trx
41
{
42
public
:
43
VacuousTrx
() :
Trx
(
TrxKit::Type::VACUOUS
) {}
44
virtual
~VacuousTrx
() =
default
;
45
46
RC insert_record(
Table
*table,
Record
&record)
override
;
47
RC delete_record(
Table
*table,
Record
&record)
override
;
48
RC update_record(
Table
*table,
Record
&old_record,
Record
&new_record)
override
{
return
RC::UNIMPLEMENTED; }
49
RC visit_record(
Table
*table,
Record
&record, ReadWriteMode mode)
override
;
50
RC start_if_need()
override
;
51
RC commit()
override
;
52
RC rollback()
override
;
53
54
RC redo(
Db
*db,
const
LogEntry
&log_entry)
override
;
55
56
int32_t id()
const override
{
return
0; }
57
};
58
59
class
VacuousTrxLogReplayer
:
public
LogReplayer
60
{
61
public
:
62
VacuousTrxLogReplayer
() =
default
;
63
virtual
~VacuousTrxLogReplayer
() =
default
;
64
65
RC
replay
(
const
LogEntry
&)
override
{
return
RC::SUCCESS; }
66
};
Db
一个DB实例负责管理一批表
Definition:
db.h:46
LogEntry
描述一条日志
Definition:
log_entry.h:44
LogHandler
对外提供服务的CLog模块
Definition:
log_handler.h:40
LogReplayer
日志回放接口类
Definition:
log_replayer.h:26
Record
表示一个记录
Definition:
record.h:101
Table
表
Definition:
table.h:42
TrxKit
事务管理器
Definition:
trx.h:99
Trx
事务接口
Definition:
trx.h:141
VacuousTrxKit
Vacuous(真空的),顾名思义就是没有实现事务功能
Definition:
vacuous_trx.h:23
VacuousTrxLogReplayer
Definition:
vacuous_trx.h:60
VacuousTrxLogReplayer::replay
RC replay(const LogEntry &) override
回放一条日志
Definition:
vacuous_trx.h:65
VacuousTrx
Definition:
vacuous_trx.h:41
TrxKit::VACUOUS
@ VACUOUS
空的事务管理器,不做任何事情
Definition:
trx.h:108
制作者
1.9.5