MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
vacuous_trx.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See 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
22class VacuousTrxKit : public TrxKit
23{
24public:
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
40class VacuousTrx : public Trx
41{
42public:
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
60{
61public:
62 VacuousTrxLogReplayer() = default;
63 virtual ~VacuousTrxLogReplayer() = default;
64
65 RC replay(const LogEntry &) override { return RC::SUCCESS; }
66};
一个DB实例负责管理一批表
Definition: db.h:46
描述一条日志
Definition: log_entry.h:44
对外提供服务的CLog模块
Definition: log_handler.h:40
日志回放接口类
Definition: log_replayer.h:26
表示一个记录
Definition: record.h:101
Definition: table.h:42
事务管理器
Definition: trx.h:99
事务接口
Definition: trx.h:141
Vacuous(真空的),顾名思义就是没有实现事务功能
Definition: vacuous_trx.h:23
Definition: vacuous_trx.h:60
RC replay(const LogEntry &) override
回放一条日志
Definition: vacuous_trx.h:65
Definition: vacuous_trx.h:41
@ VACUOUS
空的事务管理器,不做任何事情
Definition: trx.h:108