1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/src/storage/storage.h
David Steele eb452c8add Improvements to Storage object.
* storagePath() and storageList() commands
* Helper functions for local and spool storag
2018-01-16 13:38:37 -05:00

37 lines
2.3 KiB
C

/***********************************************************************************************************************************
Storage Manager
***********************************************************************************************************************************/
#ifndef STORAGE_LOCAL_H
#define STORAGE_LOCAL_H
#include "common/type/buffer.h"
#include "common/type/string.h"
/***********************************************************************************************************************************
Default file and path modes
***********************************************************************************************************************************/
#define STORAGE_FILE_MODE_DEFAULT 0640
#define STORAGE_PATH_MODE_DEFAULT 0750
/***********************************************************************************************************************************
Storage object
***********************************************************************************************************************************/
typedef struct Storage Storage;
/***********************************************************************************************************************************
Path expression callback function type - used to modify paths base on expressions enclosed in <>
***********************************************************************************************************************************/
typedef String *(*StoragePathExpressionCallback)(const String *expression, const String *path);
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
Storage *storageNew(const String *path, int mode, size_t bufferSize, StoragePathExpressionCallback pathExpressionFunction);
Buffer *storageGet(const Storage *storage, const String *fileExp, bool ignoreMissing);
StringList *storageList(const Storage *storage, const String *pathExp, const String *expression, bool ignoreMissing);
String *storagePath(const Storage *storage, const String *pathExp);
void storagePut(const Storage *storage, const String *fileExp, const Buffer *buffer);
#endif