1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00
Files
pgbackrest/src/storage/write.h
David Steele f1eea23121 Add macros for object free functions.
Most of the *Free() functions are pretty generic so add macros to make creating them as easy as possible.

Create a distinction between *Free() functions that the caller uses to free memory and callbacks that free third-party resources.  There are a number of cases where a driver needs to free resources but does not need a normal *Free() because it is handled by the interface.

Add common/object.h for macros that make object maintenance easier.  This pattern can also be used for many more object functions.
2019-05-03 18:52:54 -04:00

53 lines
3.0 KiB
C

/***********************************************************************************************************************************
Storage Write Interface
***********************************************************************************************************************************/
#ifndef STORAGE_WRITE_H
#define STORAGE_WRITE_H
/***********************************************************************************************************************************
Object type
***********************************************************************************************************************************/
#define STORAGE_WRITE_TYPE StorageWrite
#define STORAGE_WRITE_PREFIX storageWrite
typedef struct StorageWrite StorageWrite;
#include "common/io/write.h"
#include "common/type/buffer.h"
#include "common/type/string.h"
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
StorageWrite *storageWriteMove(StorageWrite *this, MemContext *parentNew);
/***********************************************************************************************************************************
Getters
***********************************************************************************************************************************/
bool storageWriteAtomic(const StorageWrite *this);
bool storageWriteCreatePath(const StorageWrite *this);
IoWrite *storageWriteIo(const StorageWrite *this);
mode_t storageWriteModeFile(const StorageWrite *this);
mode_t storageWriteModePath(const StorageWrite *this);
const String *storageWriteName(const StorageWrite *this);
bool storageWriteSyncFile(const StorageWrite *this);
bool storageWriteSyncPath(const StorageWrite *this);
const String *storageWriteType(const StorageWrite *this);
/***********************************************************************************************************************************
Destructor
***********************************************************************************************************************************/
void storageWriteFree(StorageWrite *this);
/***********************************************************************************************************************************
Macros for function logging
***********************************************************************************************************************************/
String *storageWriteToLog(const StorageWrite *this);
#define FUNCTION_LOG_STORAGE_WRITE_TYPE \
StorageWrite *
#define FUNCTION_LOG_STORAGE_WRITE_FORMAT(value, buffer, bufferSize) \
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, storageWriteToLog, buffer, bufferSize)
#endif