Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Apr 4, 2024
1 parent a36b802 commit f9e839a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/include/common/cast.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <typeinfo>

#include "common/assert.h"

namespace kuzu {
Expand Down
1 change: 0 additions & 1 deletion src/include/storage/wal/wal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <unordered_set>

#include "common/serializer/serializer.h"
#include "storage/buffer_manager/buffer_manager.h"
#include "storage/wal/wal_record.h"

Expand Down
46 changes: 24 additions & 22 deletions src/include/storage/wal/wal_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ std::string walRecordTypeToString(WALRecordType walRecordType);
struct WALRecord {
WALRecordType type;

WALRecord() {}
WALRecord(WALRecordType type) : type{type} {}
WALRecord() = default;
explicit WALRecord(WALRecordType type) : type{type} {}
virtual ~WALRecord() = default;

Check warning on line 72 in src/include/storage/wal/wal_record.h

View check run for this annotation

Codecov / codecov/patch

src/include/storage/wal/wal_record.h#L72

Added line #L72 was not covered by tests

virtual void serialize(common::Serializer& serializer) const;
static std::unique_ptr<WALRecord> deserialize(common::Deserializer& deserializer);
};

struct PageUpdateOrInsertRecord : public WALRecord {
struct PageUpdateOrInsertRecord final : public WALRecord {
DBFileID dbFileID;
// PageIdx in the file of updated storage structure, identified by the dbFileID field
uint64_t pageIdxInOriginalFile;
Expand All @@ -88,12 +88,12 @@ struct PageUpdateOrInsertRecord : public WALRecord {
: WALRecord{WALRecordType::PAGE_UPDATE_OR_INSERT_RECORD}, dbFileID{dbFileID},
pageIdxInOriginalFile{pageIdxInOriginalFile}, pageIdxInWAL{pageIdxInWAL}, isInsert{
isInsert} {}
void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<PageUpdateOrInsertRecord> deserialize(
common::Deserializer& deserializer);
};

struct CommitRecord : public WALRecord {
struct CommitRecord final : public WALRecord {
uint64_t transactionID;
// TODO: Keep it here for now, but it should be moved to a separate record.
common::offset_t walOffset;
Expand All @@ -103,32 +103,34 @@ struct CommitRecord : public WALRecord {
: WALRecord{WALRecordType::COMMIT_RECORD}, transactionID{transactionID}, walOffset{
walOffset} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<CommitRecord> deserialize(common::Deserializer& deserializer);
};

struct CreateTableRecord : public WALRecord {
struct CreateTableRecord final : public WALRecord {
common::table_id_t tableID;
common::TableType tableType;

CreateTableRecord() = default;
explicit CreateTableRecord(common::table_id_t tableID, common::TableType tableType)
: WALRecord{WALRecordType::CREATE_TABLE_RECORD}, tableID{tableID}, tableType{tableType} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<CreateTableRecord> deserialize(common::Deserializer& deserializer);
};

struct CatalogRecord : public WALRecord {
struct CatalogRecord final : public WALRecord {
CatalogRecord() : WALRecord{WALRecordType::CATALOG_RECORD} {}

void serialize(common::Serializer& serializer) const { WALRecord::serialize(serializer); }
void serialize(common::Serializer& serializer) const override {
WALRecord::serialize(serializer);
}
static std::unique_ptr<CatalogRecord> deserialize(common::Deserializer&) {
return std::make_unique<CatalogRecord>();
}
};

struct RdfGraphRecord : public WALRecord {
struct RdfGraphRecord final : public WALRecord {

Check warning on line 133 in src/include/storage/wal/wal_record.h

View check run for this annotation

Codecov / codecov/patch

src/include/storage/wal/wal_record.h#L133

Added line #L133 was not covered by tests
common::table_id_t tableID;
std::unique_ptr<WALRecord> resourceTableRecord;
std::unique_ptr<WALRecord> literalTableRecord;
Expand All @@ -147,44 +149,44 @@ struct RdfGraphRecord : public WALRecord {
resourceTripleTableRecord)},
literalTripleTableRecord{std::move(literalTripleTableRecord)} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<RdfGraphRecord> deserialize(common::Deserializer& deserializer);
};

struct CopyTableRecord : public WALRecord {
struct CopyTableRecord final : public WALRecord {
common::table_id_t tableID;

CopyTableRecord() = default;
explicit CopyTableRecord(common::table_id_t tableID)
: WALRecord{WALRecordType::COPY_TABLE_RECORD}, tableID{tableID} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<CopyTableRecord> deserialize(common::Deserializer& deserializer);
};

struct TableStatisticsRecord : public WALRecord {
struct TableStatisticsRecord final : public WALRecord {
common::TableType tableType;

TableStatisticsRecord() = default;
explicit TableStatisticsRecord(common::TableType tableType)
: WALRecord{WALRecordType::TABLE_STATISTICS_RECORD}, tableType{tableType} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<TableStatisticsRecord> deserialize(common::Deserializer& deserializer);
};

struct DropTableRecord : public WALRecord {
struct DropTableRecord final : public WALRecord {
common::table_id_t tableID;

DropTableRecord() = default;
explicit DropTableRecord(common::table_id_t tableID)
: WALRecord{WALRecordType::DROP_TABLE_RECORD}, tableID{tableID} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<DropTableRecord> deserialize(common::Deserializer& deserializer);
};

struct DropPropertyRecord : public WALRecord {
struct DropPropertyRecord final : public WALRecord {
common::table_id_t tableID;
common::property_id_t propertyID;

Expand All @@ -193,19 +195,19 @@ struct DropPropertyRecord : public WALRecord {
: WALRecord{WALRecordType::DROP_PROPERTY_RECORD}, tableID{tableID}, propertyID{propertyID} {
}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<DropPropertyRecord> deserialize(common::Deserializer& deserializer);
};

struct AddPropertyRecord : public WALRecord {
struct AddPropertyRecord final : public WALRecord {
common::table_id_t tableID;
common::property_id_t propertyID;

AddPropertyRecord() = default;
AddPropertyRecord(common::table_id_t tableID, common::property_id_t propertyID)
: WALRecord{WALRecordType::ADD_PROPERTY_RECORD}, tableID{tableID}, propertyID{propertyID} {}

void serialize(common::Serializer& serializer) const;
void serialize(common::Serializer& serializer) const override;
static std::unique_ptr<AddPropertyRecord> deserialize(common::Deserializer& deserializer);
};

Expand Down
1 change: 1 addition & 0 deletions src/storage/wal/wal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "common/file_system/virtual_file_system.h"
#include "common/serializer/buffered_file.h"
#include "common/serializer/deserializer.h"
#include "common/serializer/serializer.h"
#include "storage/storage_utils.h"

using namespace kuzu::common;
Expand Down

0 comments on commit f9e839a

Please sign in to comment.