File indexing completed on 2023-03-17 11:26:46
0001 #ifndef LSTORE_ADAPTOR_LSTORE_FILE_H
0002 #define LSTORE_ADAPTOR_LSTORE_FILE_H
0003
0004 #include "Utilities/StorageFactory/interface/Storage.h"
0005 #include "Utilities/StorageFactory/interface/IOFlags.h"
0006 #include <string>
0007 #include <pthread.h>
0008 namespace edm::storage {
0009 class LStoreFile : public Storage {
0010 public:
0011 LStoreFile(void);
0012 LStoreFile(void *fd);
0013 LStoreFile(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
0014 LStoreFile(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
0015 ~LStoreFile(void) override;
0016
0017 virtual void create(const char *name, bool exclusive = false, int perms = 0666);
0018 virtual void create(const std::string &name, bool exclusive = false, int perms = 0666);
0019 virtual void open(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
0020 virtual void open(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
0021
0022 using Storage::position;
0023 using Storage::read;
0024 using Storage::write;
0025
0026 IOSize read(void *into, IOSize n) override;
0027 IOSize write(const void *from, IOSize n) override;
0028
0029 IOOffset position(IOOffset offset, Relative whence = SET) override;
0030 void resize(IOOffset size) override;
0031
0032 void close(void) override;
0033 virtual void abort(void);
0034
0035 class MutexWrapper {
0036 public:
0037 MutexWrapper(pthread_mutex_t *lock);
0038 ~MutexWrapper();
0039 pthread_mutex_t *m_lock;
0040 };
0041
0042 static pthread_mutex_t m_dlopen_lock;
0043
0044 private:
0045
0046
0047 void loadLibrary();
0048 void closeLibrary();
0049
0050
0051
0052 void *m_fd;
0053 bool m_close;
0054 std::string m_name;
0055 void *m_library_handle;
0056 bool m_is_loaded;
0057
0058
0059
0060
0061 int32_t (*redd_init)();
0062 int64_t (*redd_read)(void *, char *, int64_t);
0063 int32_t (*redd_close)(void *);
0064 int64_t (*redd_lseek)(void *, int64_t, uint32_t);
0065 void *(*redd_open)(const char *, int32_t, int32_t);
0066 int64_t (*redd_write)(void *, const char *, int64_t);
0067 int32_t (*redd_term)();
0068 int32_t (*redd_errno)();
0069 const std::string &(*redd_strerror)();
0070 };
0071 }
0072 #endif