From f063f78242d3dc429fa6b6177aa7456bbf33f3af Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Wed, 23 Jan 2019 14:12:57 -0600 Subject: [PATCH] Fixed some linker errors, integrated the cloudio factory into idbfactory. --- utils/cloudio/SMComm.cpp | 8 ++++++++ utils/cloudio/SMDataFile.cpp | 4 ++++ utils/cloudio/SMFileSystem.cpp | 10 +++++++--- utils/cloudio/SMFileSystem.h | 7 ++++--- utils/idbdatafile/CMakeLists.txt | 5 ++--- utils/idbdatafile/IDBFactory.cpp | 5 ++++- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/utils/cloudio/SMComm.cpp b/utils/cloudio/SMComm.cpp index 59314cc52..7c01a203b 100644 --- a/utils/cloudio/SMComm.cpp +++ b/utils/cloudio/SMComm.cpp @@ -67,6 +67,14 @@ SMComm * SMComm::get() } \ } +SMComm::SMComm() +{ +} + +SMComm::~SMComm() +{ +} + int SMComm::open(const string &filename, const int mode, struct stat *statbuf) { ByteStream *command = buffers.getByteStream(); diff --git a/utils/cloudio/SMDataFile.cpp b/utils/cloudio/SMDataFile.cpp index 7f1346eab..c2e600165 100644 --- a/utils/cloudio/SMDataFile.cpp +++ b/utils/cloudio/SMDataFile.cpp @@ -24,6 +24,10 @@ using namespace std; namespace idbdatafile { +SMDataFile::~SMDataFile() +{ +} + SMDataFile::SMDataFile(const char *name, int _openmode, const struct stat &_stat) : IDBDataFile(name) { diff --git a/utils/cloudio/SMFileSystem.cpp b/utils/cloudio/SMFileSystem.cpp index 97ae01736..02341fa46 100644 --- a/utils/cloudio/SMFileSystem.cpp +++ b/utils/cloudio/SMFileSystem.cpp @@ -30,7 +30,11 @@ SMFileSystem::SMFileSystem() : IDBFileSystem(IDBFileSystem::CLOUD) SMComm::get(); // get SMComm running } -int SMFileSystem::mkdir(const char *path) const +SMFileSystem::~SMFileSystem() +{ +} + +int SMFileSystem::mkdir(const char *path) { return 0; } @@ -53,13 +57,13 @@ off64_t SMFileSystem::compressedSize(const char *filename) const throw NotImplementedYet(__func__); } -int SMFileSystem::remove(const char *filename) const +int SMFileSystem::remove(const char *filename) { SMComm *comm = SMComm::get(); return comm->unlink(filename); } -int SMFileSystem::rename(const char *oldFile, const char *newFile) const +int SMFileSystem::rename(const char *oldFile, const char *newFile) { // This will actually be pretty expensive to do b/c we store the filename in // the key in cloud. If we do this a lot, we'll have to implement copy() in the SM. diff --git a/utils/cloudio/SMFileSystem.h b/utils/cloudio/SMFileSystem.h index f843e5c3b..4726d0f1d 100644 --- a/utils/cloudio/SMFileSystem.h +++ b/utils/cloudio/SMFileSystem.h @@ -33,11 +33,12 @@ class SMFileSystem : public IDBFileSystem, boost::noncopyable SMFileSystem(); virtual ~SMFileSystem(); - int mkdir(const char* pathname) const; + // why are some of these const and some not const in IDBFileSystem? + int mkdir(const char* pathname); off64_t size(const char* path) const; off64_t compressedSize(const char* path) const; - int remove(const char* pathname) const; - int rename(const char* oldpath, const char* newpath) const; + int remove(const char* pathname); + int rename(const char* oldpath, const char* newpath); bool exists(const char* pathname) const; int listDirectory(const char* pathname, std::list& contents) const; bool isDir(const char* pathname) const; diff --git a/utils/idbdatafile/CMakeLists.txt b/utils/idbdatafile/CMakeLists.txt index e06bf1fc8..cf809ffec 100644 --- a/utils/idbdatafile/CMakeLists.txt +++ b/utils/idbdatafile/CMakeLists.txt @@ -1,6 +1,5 @@ -include_directories( ${ENGINE_COMMON_INCLUDES} ) - +include_directories( ${ENGINE_COMMON_INCLUDES} ../cloudio) ########### next target ############### @@ -16,7 +15,7 @@ set(idbdatafile_LIB_SRCS add_library(idbdatafile SHARED ${idbdatafile_LIB_SRCS}) -target_link_libraries(idbdatafile ${NETSNMP_LIBRARIES}) +target_link_libraries(idbdatafile ${NETSNMP_LIBRARIES} cloudio) set_target_properties(idbdatafile PROPERTIES VERSION 1.0.0 SOVERSION 1) diff --git a/utils/idbdatafile/IDBFactory.cpp b/utils/idbdatafile/IDBFactory.cpp index 8e8a04b16..d15998c9f 100644 --- a/utils/idbdatafile/IDBFactory.cpp +++ b/utils/idbdatafile/IDBFactory.cpp @@ -30,6 +30,8 @@ #include "BufferedFileFactory.h" #include "UnbufferedFileFactory.h" #include "PosixFileSystem.h" +#include "SMFileSystem.h" +#include "SMFileFactory.h" #include "IDBLogger.h" using namespace std; @@ -50,7 +52,8 @@ bool IDBFactory::installDefaultPlugins() s_plugins[IDBDataFile::BUFFERED] = FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(), new PosixFileSystem()); s_plugins[IDBDataFile::UNBUFFERED] = FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered", new UnbufferedFileFactory(), new PosixFileSystem()); - + s_plugins[IDBDataFile::CLOUD] = FileFactoryEnt(IDBDataFile::CLOUD, "cloud", new SMFileFactory(), new SMFileSystem()); + return false; }