Skip to content

Commit

Permalink
Move walfile up one level
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Sep 23, 2024
1 parent eddcb19 commit 61e9466
Show file tree
Hide file tree
Showing 52 changed files with 231 additions and 174 deletions.
52 changes: 0 additions & 52 deletions src/include/wal/walfile/rm_storage.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#ifndef PGMONETA_PG_CONTROL_H
#define PGMONETA_PG_CONTROL_H

#include <wal/walfile/transaction.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/transaction.h>
#include <walfile/wal_reader.h>

#include <stdint.h>
#include <stdbool.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef PGMONETA_RELPATH_H
#define PGMONETA_RELPATH_H

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

typedef int backend_id; /* unique currently active backend identifier */

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

// WAL record definitions for BRIN's WAL operations
#define XLOG_BRIN_CREATE_INDEX 0x00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/transaction.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/transaction.h>
#include <walfile/wal_reader.h>

#include <stdint.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extern "C" {
#endif

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define TRANSACTION_STATUS_IN_PROGRESS 0x00 /**< Transaction is in progress */
#define TRANSACTION_STATUS_COMMITTED 0x01 /**< Transaction has been committed */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

/* XLOG stuff */
#define COMMIT_TS_ZEROPAGE 0x00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extern "C" {
#endif

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

// #define variables
#define XLOG_DBASE_CREATE 0x00 /**< Create database log type */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extern "C" {
#endif

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

typedef char* pointer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

#include <stdint.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

typedef xlog_rec_ptr gist_nsn;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

typedef oid reg_procedure;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

#include <stdint.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef PGMONETA_RM_LOGICALMSG_H
#define PGMONETA_RM_LOGICALMSG_H

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define XLOG_LOGICAL_MESSAGE 0x00

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef PGMONETA_RM_MXACT_H
#define PGMONETA_RM_MXACT_H

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00
#define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extern "C" {
#endif

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define XLOG_RELMAP_UPDATE 0x00 /**< XLOG opcode for relation map update. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extern "C" {
#endif

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define INVALID_REP_ORIGIN_ID 0 /**< Invalid replication origin ID. */
#define XLOG_REPLORIGIN_SET 0x00 /**< XLOG opcode for setting a replication origin. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extern "C" {
#endif

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define XLOG_SEQ_LOG 0x00 /**< XLOG opcode for sequence log operation. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
/*
* Copyright (C) 2024 The pgmoneta community
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may
* be used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef PGMONETA_RM_SPGIST_H
#define PGMONETA_RM_SPGIST_H

Expand All @@ -6,8 +34,8 @@ extern "C" {
#endif

/* Include pgmoneta-related headers */
#include <wal/walfile/rm.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/wal_reader.h>

/* Define macros */
#define XLOG_SPGIST_ADD_LEAF 0x10 /**< XLOG opcode for adding a leaf node in SPGiST. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
extern "C" {
#endif

#include <wal/walfile/rm.h>
#include <wal/walfile/sinval.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/sinval.h>
#include <walfile/wal_reader.h>

#include <stdbool.h>

Expand Down
80 changes: 80 additions & 0 deletions src/include/walfile/rm_storage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (C) 2024 The pgmoneta community
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may
* be used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef PGMONETA_RM_STORAGE_H
#define PGMONETA_RM_STORAGE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <walfile/wal_reader.h>

#define XLOG_SMGR_CREATE 0x10 /**< XLOG opcode for creating a storage manager file. */
#define XLOG_SMGR_TRUNCATE 0x20 /**< XLOG opcode for truncating a storage manager file. */

/**
* @struct xl_smgr_create
* @brief Represents a storage manager create operation in XLOG.
*
* Contains the relation file node and fork number for the created storage manager file.
*/
struct xl_smgr_create
{
struct rel_file_node rnode; /**< Relation file node information. */
enum fork_number forkNum; /**< Fork number for the created file. */
};

/**
* @struct xl_smgr_truncate
* @brief Represents a storage manager truncate operation in XLOG.
*
* Contains the block number, relation file node, and flags indicating which components are truncated.
*/
struct xl_smgr_truncate
{
block_number blkno; /**< Block number from where the truncation starts. */
struct rel_file_node rnode; /**< Relation file node information. */
int flags; /**< Flags indicating which components are truncated. */
};

/**
* @brief Describes a storage manager operation from a decoded XLOG record.
*
* @param buf The buffer to store the description.
* @param record The decoded XLOG record containing the storage manager operation.
* @return A pointer to the buffer containing the description.
*/
char*
pgmoneta_wal_storage_desc(char* buf, struct decoded_xlog_record* record);

#ifdef __cplusplus
}
#endif

#endif // PGMONETA_RM_STORAGE_H
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef PGMONETA_RM_TABLESPACE_H
#define PGMONETA_RM_TABLESPACE_H

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

/* XLOG stuff */
#define XLOG_TBLSPC_CREATE 0x00 /**< XLOG opcode for creating a tablespace. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
#ifndef PGMONETA_RM_XACT_H
#define PGMONETA_RM_XACT_H

#include <wal/walfile/rm.h>
#include <wal/walfile/rm_xlog.h>
#include <wal/walfile/sinval.h>
#include <wal/walfile/wal_reader.h>
#include <walfile/rm.h>
#include <walfile/rm_xlog.h>
#include <walfile/sinval.h>
#include <walfile/wal_reader.h>

#define GIDSIZE 200 /**< Maximum size of Global Transaction ID (including '\0'). */
#define XLOG_XACT_OPMASK 0x70 /**< Mask for filtering opcodes out of xl_info. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef PGMONETA_RM_XLOG_H
#define PGMONETA_RM_XLOG_H

#include <wal/walfile/wal_reader.h>
#include <walfile/wal_reader.h>

#define MAXFNAMELEN 64
#define MAXDATELEN 128
Expand Down
Loading

0 comments on commit 61e9466

Please sign in to comment.