changeset 1123:6c5a77637b23

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Sep 2014 15:59:04 +0200
parents 1d60316c3618
children 790ff7a5b3bf
files CMakeLists.txt Core/FileStorage/CompressedFileStorageAccessor.cpp Core/FileStorage/CompressedFileStorageAccessor.h Core/FileStorage/FileStorage.cpp Core/FileStorage/FileStorage.h Core/FileStorage/FileStorageAccessor.h Core/FileStorage/FilesystemStorage.cpp Core/FileStorage/FilesystemStorage.h Core/HttpServer/FilesystemHttpSender.cpp Core/HttpServer/FilesystemHttpSender.h OrthancServer/ServerContext.h UnitTestsSources/FileStorageTests.cpp
diffstat 12 files changed, 379 insertions(+), 379 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Sep 05 15:48:43 2014 +0200
+++ b/CMakeLists.txt	Fri Sep 05 15:59:04 2014 +0200
@@ -81,7 +81,7 @@
   Core/DicomFormat/DicomIntegerPixelAccessor.cpp
   Core/DicomFormat/DicomInstanceHasher.cpp
   Core/Enumerations.cpp
-  Core/FileStorage/FileStorage.cpp
+  Core/FileStorage/FilesystemStorage.cpp
   Core/FileStorage/StorageAccessor.cpp
   Core/FileStorage/CompressedFileStorageAccessor.cpp
   Core/FileStorage/FileStorageAccessor.cpp
--- a/Core/FileStorage/CompressedFileStorageAccessor.cpp	Fri Sep 05 15:48:43 2014 +0200
+++ b/Core/FileStorage/CompressedFileStorageAccessor.cpp	Fri Sep 05 15:59:04 2014 +0200
@@ -80,7 +80,7 @@
     }
   }
 
-  CompressedFileStorageAccessor::CompressedFileStorageAccessor(FileStorage& storage) : 
+  CompressedFileStorageAccessor::CompressedFileStorageAccessor(FilesystemStorage& storage) : 
     storage_(storage)
   {
     compressionType_ = CompressionType_None;
--- a/Core/FileStorage/CompressedFileStorageAccessor.h	Fri Sep 05 15:48:43 2014 +0200
+++ b/Core/FileStorage/CompressedFileStorageAccessor.h	Fri Sep 05 15:59:04 2014 +0200
@@ -33,7 +33,7 @@
 #pragma once
 
 #include "StorageAccessor.h"
-#include "FileStorage.h"
+#include "FilesystemStorage.h"
 #include "../Compression/ZlibCompressor.h"
 
 namespace Orthanc
@@ -41,7 +41,7 @@
   class CompressedFileStorageAccessor : public StorageAccessor
   {
   private:
-    FileStorage& storage_;
+    FilesystemStorage& storage_;
     ZlibCompressor zlib_;
     CompressionType compressionType_;
 
@@ -51,7 +51,7 @@
                                    FileContentType type);
 
   public: 
-    CompressedFileStorageAccessor(FileStorage& storage);
+    CompressedFileStorageAccessor(FilesystemStorage& storage);
 
     void SetCompressionForNextOperations(CompressionType compression)
     {
--- a/Core/FileStorage/FileStorage.cpp	Fri Sep 05 15:48:43 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,279 +0,0 @@
-/**
- * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
- * Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * In addition, as a special exception, the copyright holders of this
- * program give permission to link the code of its release with the
- * OpenSSL project's "OpenSSL" library (or with modified versions of it
- * that use the same license as the "OpenSSL" library), and distribute
- * the linked executables. You must obey the GNU General Public License
- * in all respects for all of the code used other than "OpenSSL". If you
- * modify file(s) with this exception, you may extend this exception to
- * your version of the file(s), but you are not obligated to do so. If
- * you do not wish to do so, delete this exception statement from your
- * version. If you delete this exception statement from all source files
- * in the program, then also delete it here.
- * 
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-#include "../PrecompiledHeaders.h"
-#include "FileStorage.h"
-
-// http://stackoverflow.com/questions/1576272/storing-large-number-of-files-in-file-system
-// http://stackoverflow.com/questions/446358/storing-a-large-number-of-images
-
-#include "../OrthancException.h"
-#include "../Toolbox.h"
-#include "../Uuid.h"
-
-#include <boost/filesystem/fstream.hpp>
-#include <glog/logging.h>
-
-static std::string ToString(const boost::filesystem::path& p)
-{
-#if BOOST_HAS_FILESYSTEM_V3 == 1
-  return p.filename().string();
-#else
-  return p.filename();
-#endif
-}
-
-
-namespace Orthanc
-{
-  boost::filesystem::path FileStorage::GetPath(const std::string& uuid) const
-  {
-    namespace fs = boost::filesystem;
-
-    if (!Toolbox::IsUuid(uuid))
-    {
-      throw OrthancException(ErrorCode_ParameterOutOfRange);
-    }
-
-    fs::path path = root_;
-
-    path /= std::string(&uuid[0], &uuid[2]);
-    path /= std::string(&uuid[2], &uuid[4]);
-    path /= uuid;
-
-#if BOOST_HAS_FILESYSTEM_V3 == 1
-    path.make_preferred();
-#endif
-
-    return path;
-  }
-
-  FileStorage::FileStorage(std::string root)
-  {
-    //root_ = boost::filesystem::absolute(root).string();
-    root_ = root;
-
-    Toolbox::CreateDirectory(root);
-  }
-
-  std::string FileStorage::Create(const void* content, size_t size)
-  {
-    std::string uuid;
-    boost::filesystem::path path;
-    
-    for (;;)
-    {
-      uuid = Toolbox::GenerateUuid();
-      path = GetPath(uuid);
-
-      if (!boost::filesystem::exists(path))
-      {
-        // OK, this is indeed a new file
-        break;
-      }
-
-      // Extremely improbable case: This Uuid has already been created
-      // in the past. Try again.
-    }
-
-    if (boost::filesystem::exists(path.parent_path()))
-    {
-      if (!boost::filesystem::is_directory(path.parent_path()))
-      {
-        throw OrthancException("The subdirectory to be created is already occupied by a regular file");        
-      }
-    }
-    else
-    {
-      if (!boost::filesystem::create_directories(path.parent_path()))
-      {
-        throw OrthancException("Unable to create a subdirectory in the file storage");        
-      }
-    }
-
-    boost::filesystem::ofstream f;
-    f.open(path, std::ofstream::out | std::ios::binary);
-    if (!f.good())
-    {
-      throw OrthancException("Unable to create a new file in the file storage");
-    }
-
-    if (size != 0)
-    {
-      f.write(static_cast<const char*>(content), size);
-      if (!f.good())
-      {
-        f.close();
-        throw OrthancException("Unable to write to the new file in the file storage");
-      }
-    }
-
-    f.close();
-
-    return uuid;
-  }
-
-
-  std::string FileStorage::Create(const std::vector<uint8_t>& content)
-  {
-    if (content.size() == 0)
-      return Create(NULL, 0);
-    else
-      return Create(&content[0], content.size());
-  }
-
-  std::string FileStorage::Create(const std::string& content)
-  {
-    if (content.size() == 0)
-      return Create(NULL, 0);
-    else
-      return Create(&content[0], content.size());
-  }
-
-  void FileStorage::Read(std::string& content,
-                         const std::string& uuid) const
-  {
-    content.clear();
-    Toolbox::ReadFile(content, GetPath(uuid).string());
-  }
-
-
-  uintmax_t FileStorage::GetSize(const std::string& uuid) const
-  {
-    boost::filesystem::path path = GetPath(uuid);
-    return boost::filesystem::file_size(path);
-  }
-
-
-
-  void FileStorage::ListAllFiles(std::set<std::string>& result) const
-  {
-    namespace fs = boost::filesystem;
-
-    result.clear();
-
-    if (fs::exists(root_) && fs::is_directory(root_))
-    {
-      for (fs::recursive_directory_iterator current(root_), end; current != end ; ++current)
-      {
-        if (fs::is_regular_file(current->status()))
-        {
-          try
-          {
-            fs::path d = current->path();
-            std::string uuid = ToString(d);
-            if (Toolbox::IsUuid(uuid))
-            {
-              fs::path p0 = d.parent_path().parent_path().parent_path();
-              std::string p1 = ToString(d.parent_path().parent_path());
-              std::string p2 = ToString(d.parent_path());
-              if (p1.length() == 2 &&
-                  p2.length() == 2 &&
-                  p1 == uuid.substr(0, 2) &&
-                  p2 == uuid.substr(2, 2) &&
-                  p0 == root_)
-              {
-                result.insert(uuid);
-              }
-            }
-          }
-          catch (fs::filesystem_error)
-          {
-          }
-        }
-      }
-    }
-  }
-
-
-  void FileStorage::Clear()
-  {
-    namespace fs = boost::filesystem;
-    typedef std::set<std::string> List;
-
-    List result;
-    ListAllFiles(result);
-
-    for (List::const_iterator it = result.begin(); it != result.end(); ++it)
-    {
-      Remove(*it);
-    }
-  }
-
-
-  void FileStorage::Remove(const std::string& uuid)
-  {
-    LOG(INFO) << "Deleting file " << uuid;
-    namespace fs = boost::filesystem;
-
-    fs::path p = GetPath(uuid);
-
-    try
-    {
-      fs::remove(p);
-    }
-    catch (...)
-    {
-      // Ignore the error
-    }
-
-    // Remove the two parent directories, ignoring the error code if
-    // these directories are not empty
-
-    try
-    {
-#if BOOST_HAS_FILESYSTEM_V3 == 1
-      boost::system::error_code err;
-      fs::remove(p.parent_path(), err);
-      fs::remove(p.parent_path().parent_path(), err);
-#else
-      fs::remove(p.parent_path());
-      fs::remove(p.parent_path().parent_path());
-#endif
-    }
-    catch (...)
-    {
-      // Ignore the error
-    }
-  }
-
-
-  uintmax_t FileStorage::GetCapacity() const
-  {
-    return boost::filesystem::space(root_).capacity;
-  }
-
-  uintmax_t FileStorage::GetAvailableSpace() const
-  {
-    return boost::filesystem::space(root_).available;
-  }
-}
--- a/Core/FileStorage/FileStorage.h	Fri Sep 05 15:48:43 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/**
- * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
- * Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * In addition, as a special exception, the copyright holders of this
- * program give permission to link the code of its release with the
- * OpenSSL project's "OpenSSL" library (or with modified versions of it
- * that use the same license as the "OpenSSL" library), and distribute
- * the linked executables. You must obey the GNU General Public License
- * in all respects for all of the code used other than "OpenSSL". If you
- * modify file(s) with this exception, you may extend this exception to
- * your version of the file(s), but you are not obligated to do so. If
- * you do not wish to do so, delete this exception statement from your
- * version. If you delete this exception statement from all source files
- * in the program, then also delete it here.
- * 
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-#pragma once
-
-#include <boost/filesystem.hpp>
-#include <set>
-
-namespace Orthanc
-{
-  class FileStorage : public boost::noncopyable
-  {
-    // TODO REMOVE THIS
-    friend class FilesystemHttpSender;
-    friend class FileStorageAccessor;
-
-  private:
-    boost::filesystem::path root_;
-
-    boost::filesystem::path GetPath(const std::string& uuid) const;
-
-  public:
-    FileStorage(std::string root);
-
-    std::string Create(const void* content, size_t size);
-
-    std::string Create(const std::vector<uint8_t>& content);
-
-    std::string Create(const std::string& content);
-
-    void Read(std::string& content,
-              const std::string& uuid) const;
-
-    void ListAllFiles(std::set<std::string>& result) const;
-
-    uintmax_t GetSize(const std::string& uuid) const;
-
-    void Clear();
-
-    void Remove(const std::string& uuid);
-
-    uintmax_t GetCapacity() const;
-
-    uintmax_t GetAvailableSpace() const;
-  };
-}
--- a/Core/FileStorage/FileStorageAccessor.h	Fri Sep 05 15:48:43 2014 +0200
+++ b/Core/FileStorage/FileStorageAccessor.h	Fri Sep 05 15:59:04 2014 +0200
@@ -33,7 +33,7 @@
 #pragma once
 
 #include "StorageAccessor.h"
-#include "FileStorage.h"
+#include "FilesystemStorage.h"
 #include "../HttpServer/FilesystemHttpSender.h"
 
 namespace Orthanc
@@ -41,7 +41,7 @@
   class FileStorageAccessor : public StorageAccessor
   {
   private:
-    FileStorage& storage_;
+    FilesystemStorage& storage_;
     
   protected:
     virtual FileInfo WriteInternal(const void* data,
@@ -49,7 +49,7 @@
                                    FileContentType type);
 
   public:
-    FileStorageAccessor(FileStorage& storage) : storage_(storage)
+    FileStorageAccessor(FilesystemStorage& storage) : storage_(storage)
     {
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/FileStorage/FilesystemStorage.cpp	Fri Sep 05 15:59:04 2014 +0200
@@ -0,0 +1,279 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#include "../PrecompiledHeaders.h"
+#include "FilesystemStorage.h"
+
+// http://stackoverflow.com/questions/1576272/storing-large-number-of-files-in-file-system
+// http://stackoverflow.com/questions/446358/storing-a-large-number-of-images
+
+#include "../OrthancException.h"
+#include "../Toolbox.h"
+#include "../Uuid.h"
+
+#include <boost/filesystem/fstream.hpp>
+#include <glog/logging.h>
+
+static std::string ToString(const boost::filesystem::path& p)
+{
+#if BOOST_HAS_FILESYSTEM_V3 == 1
+  return p.filename().string();
+#else
+  return p.filename();
+#endif
+}
+
+
+namespace Orthanc
+{
+  boost::filesystem::path FilesystemStorage::GetPath(const std::string& uuid) const
+  {
+    namespace fs = boost::filesystem;
+
+    if (!Toolbox::IsUuid(uuid))
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
+    fs::path path = root_;
+
+    path /= std::string(&uuid[0], &uuid[2]);
+    path /= std::string(&uuid[2], &uuid[4]);
+    path /= uuid;
+
+#if BOOST_HAS_FILESYSTEM_V3 == 1
+    path.make_preferred();
+#endif
+
+    return path;
+  }
+
+  FilesystemStorage::FilesystemStorage(std::string root)
+  {
+    //root_ = boost::filesystem::absolute(root).string();
+    root_ = root;
+
+    Toolbox::CreateDirectory(root);
+  }
+
+  std::string FilesystemStorage::Create(const void* content, size_t size)
+  {
+    std::string uuid;
+    boost::filesystem::path path;
+    
+    for (;;)
+    {
+      uuid = Toolbox::GenerateUuid();
+      path = GetPath(uuid);
+
+      if (!boost::filesystem::exists(path))
+      {
+        // OK, this is indeed a new file
+        break;
+      }
+
+      // Extremely improbable case: This Uuid has already been created
+      // in the past. Try again.
+    }
+
+    if (boost::filesystem::exists(path.parent_path()))
+    {
+      if (!boost::filesystem::is_directory(path.parent_path()))
+      {
+        throw OrthancException("The subdirectory to be created is already occupied by a regular file");        
+      }
+    }
+    else
+    {
+      if (!boost::filesystem::create_directories(path.parent_path()))
+      {
+        throw OrthancException("Unable to create a subdirectory in the file storage");        
+      }
+    }
+
+    boost::filesystem::ofstream f;
+    f.open(path, std::ofstream::out | std::ios::binary);
+    if (!f.good())
+    {
+      throw OrthancException("Unable to create a new file in the file storage");
+    }
+
+    if (size != 0)
+    {
+      f.write(static_cast<const char*>(content), size);
+      if (!f.good())
+      {
+        f.close();
+        throw OrthancException("Unable to write to the new file in the file storage");
+      }
+    }
+
+    f.close();
+
+    return uuid;
+  }
+
+
+  std::string FilesystemStorage::Create(const std::vector<uint8_t>& content)
+  {
+    if (content.size() == 0)
+      return Create(NULL, 0);
+    else
+      return Create(&content[0], content.size());
+  }
+
+  std::string FilesystemStorage::Create(const std::string& content)
+  {
+    if (content.size() == 0)
+      return Create(NULL, 0);
+    else
+      return Create(&content[0], content.size());
+  }
+
+  void FilesystemStorage::Read(std::string& content,
+                         const std::string& uuid) const
+  {
+    content.clear();
+    Toolbox::ReadFile(content, GetPath(uuid).string());
+  }
+
+
+  uintmax_t FilesystemStorage::GetSize(const std::string& uuid) const
+  {
+    boost::filesystem::path path = GetPath(uuid);
+    return boost::filesystem::file_size(path);
+  }
+
+
+
+  void FilesystemStorage::ListAllFiles(std::set<std::string>& result) const
+  {
+    namespace fs = boost::filesystem;
+
+    result.clear();
+
+    if (fs::exists(root_) && fs::is_directory(root_))
+    {
+      for (fs::recursive_directory_iterator current(root_), end; current != end ; ++current)
+      {
+        if (fs::is_regular_file(current->status()))
+        {
+          try
+          {
+            fs::path d = current->path();
+            std::string uuid = ToString(d);
+            if (Toolbox::IsUuid(uuid))
+            {
+              fs::path p0 = d.parent_path().parent_path().parent_path();
+              std::string p1 = ToString(d.parent_path().parent_path());
+              std::string p2 = ToString(d.parent_path());
+              if (p1.length() == 2 &&
+                  p2.length() == 2 &&
+                  p1 == uuid.substr(0, 2) &&
+                  p2 == uuid.substr(2, 2) &&
+                  p0 == root_)
+              {
+                result.insert(uuid);
+              }
+            }
+          }
+          catch (fs::filesystem_error)
+          {
+          }
+        }
+      }
+    }
+  }
+
+
+  void FilesystemStorage::Clear()
+  {
+    namespace fs = boost::filesystem;
+    typedef std::set<std::string> List;
+
+    List result;
+    ListAllFiles(result);
+
+    for (List::const_iterator it = result.begin(); it != result.end(); ++it)
+    {
+      Remove(*it);
+    }
+  }
+
+
+  void FilesystemStorage::Remove(const std::string& uuid)
+  {
+    LOG(INFO) << "Deleting file " << uuid;
+    namespace fs = boost::filesystem;
+
+    fs::path p = GetPath(uuid);
+
+    try
+    {
+      fs::remove(p);
+    }
+    catch (...)
+    {
+      // Ignore the error
+    }
+
+    // Remove the two parent directories, ignoring the error code if
+    // these directories are not empty
+
+    try
+    {
+#if BOOST_HAS_FILESYSTEM_V3 == 1
+      boost::system::error_code err;
+      fs::remove(p.parent_path(), err);
+      fs::remove(p.parent_path().parent_path(), err);
+#else
+      fs::remove(p.parent_path());
+      fs::remove(p.parent_path().parent_path());
+#endif
+    }
+    catch (...)
+    {
+      // Ignore the error
+    }
+  }
+
+
+  uintmax_t FilesystemStorage::GetCapacity() const
+  {
+    return boost::filesystem::space(root_).capacity;
+  }
+
+  uintmax_t FilesystemStorage::GetAvailableSpace() const
+  {
+    return boost::filesystem::space(root_).available;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/FileStorage/FilesystemStorage.h	Fri Sep 05 15:59:04 2014 +0200
@@ -0,0 +1,75 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include <boost/filesystem.hpp>
+#include <set>
+
+namespace Orthanc
+{
+  class FilesystemStorage : public boost::noncopyable
+  {
+    // TODO REMOVE THIS
+    friend class FilesystemHttpSender;
+    friend class FileStorageAccessor;
+
+  private:
+    boost::filesystem::path root_;
+
+    boost::filesystem::path GetPath(const std::string& uuid) const;
+
+  public:
+    FilesystemStorage(std::string root);
+
+    std::string Create(const void* content, size_t size);
+
+    std::string Create(const std::vector<uint8_t>& content);
+
+    std::string Create(const std::string& content);
+
+    void Read(std::string& content,
+              const std::string& uuid) const;
+
+    void ListAllFiles(std::set<std::string>& result) const;
+
+    uintmax_t GetSize(const std::string& uuid) const;
+
+    void Clear();
+
+    void Remove(const std::string& uuid);
+
+    uintmax_t GetCapacity() const;
+
+    uintmax_t GetAvailableSpace() const;
+  };
+}
--- a/Core/HttpServer/FilesystemHttpSender.cpp	Fri Sep 05 15:48:43 2014 +0200
+++ b/Core/HttpServer/FilesystemHttpSender.cpp	Fri Sep 05 15:59:04 2014 +0200
@@ -94,7 +94,7 @@
     Setup();
   }
 
-  FilesystemHttpSender::FilesystemHttpSender(const FileStorage& storage,
+  FilesystemHttpSender::FilesystemHttpSender(const FilesystemStorage& storage,
                                              const std::string& uuid)
   {
     path_ = storage.GetPath(uuid).string();
--- a/Core/HttpServer/FilesystemHttpSender.h	Fri Sep 05 15:48:43 2014 +0200
+++ b/Core/HttpServer/FilesystemHttpSender.h	Fri Sep 05 15:59:04 2014 +0200
@@ -32,7 +32,7 @@
 #pragma once
 
 #include "HttpFileSender.h"
-#include "../FileStorage/FileStorage.h"
+#include "../FileStorage/FilesystemStorage.h"
 
 namespace Orthanc
 {
@@ -53,7 +53,7 @@
 
     FilesystemHttpSender(const boost::filesystem::path& path);
 
-    FilesystemHttpSender(const FileStorage& storage,
+    FilesystemHttpSender(const FilesystemStorage& storage,
                          const std::string& uuid);
   };
 }
--- a/OrthancServer/ServerContext.h	Fri Sep 05 15:48:43 2014 +0200
+++ b/OrthancServer/ServerContext.h	Fri Sep 05 15:59:04 2014 +0200
@@ -34,7 +34,7 @@
 
 #include "../Core/Cache/MemoryCache.h"
 #include "../Core/FileStorage/CompressedFileStorageAccessor.h"
-#include "../Core/FileStorage/FileStorage.h"
+#include "../Core/FileStorage/FilesystemStorage.h"
 #include "../Core/RestApi/RestApiOutput.h"
 #include "../Core/Lua/LuaContext.h"
 #include "ServerIndex.h"
@@ -75,7 +75,7 @@
                                   const Json::Value& simplifiedDicom,
                                   const Json::Value& metadata);
 
-    FileStorage storage_;
+    FilesystemStorage storage_;
     ServerIndex index_;
     CompressedFileStorageAccessor accessor_;
     bool compressionEnabled_;
--- a/UnitTestsSources/FileStorageTests.cpp	Fri Sep 05 15:48:43 2014 +0200
+++ b/UnitTestsSources/FileStorageTests.cpp	Fri Sep 05 15:59:04 2014 +0200
@@ -36,7 +36,7 @@
 #include <ctype.h>
 #include <glog/logging.h>
 
-#include "../Core/FileStorage/FileStorage.h"
+#include "../Core/FileStorage/FilesystemStorage.h"
 #include "../OrthancServer/ServerIndex.h"
 #include "../Core/Toolbox.h"
 #include "../Core/OrthancException.h"
@@ -58,9 +58,9 @@
 }
 
 
-TEST(FileStorage, Basic)
+TEST(FilesystemStorage, Basic)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
 
   std::string data = Toolbox::GenerateUuid();
   std::string uid = s.Create(data);
@@ -71,9 +71,9 @@
   ASSERT_EQ(s.GetSize(uid), data.size());
 }
 
-TEST(FileStorage, Basic2)
+TEST(FilesystemStorage, Basic2)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
 
   std::vector<uint8_t> data;
   StringToVector(data, Toolbox::GenerateUuid());
@@ -85,9 +85,9 @@
   ASSERT_EQ(s.GetSize(uid), data.size());
 }
 
-TEST(FileStorage, EndToEnd)
+TEST(FilesystemStorage, EndToEnd)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
   s.Clear();
 
   std::list<std::string> u;
@@ -120,7 +120,7 @@
 
 TEST(FileStorageAccessor, Simple)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
   FileStorageAccessor accessor(s);
 
   std::string data = "Hello world";
@@ -139,7 +139,7 @@
 
 TEST(FileStorageAccessor, NoCompression)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
   CompressedFileStorageAccessor accessor(s);
 
   accessor.SetCompressionForNextOperations(CompressionType_None);
@@ -159,7 +159,7 @@
 
 TEST(FileStorageAccessor, NoCompression2)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
   CompressedFileStorageAccessor accessor(s);
 
   accessor.SetCompressionForNextOperations(CompressionType_None);
@@ -180,7 +180,7 @@
 
 TEST(FileStorageAccessor, Compression)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
   CompressedFileStorageAccessor accessor(s);
 
   accessor.SetCompressionForNextOperations(CompressionType_Zlib);
@@ -199,7 +199,7 @@
 
 TEST(FileStorageAccessor, Mix)
 {
-  FileStorage s("UnitTestsStorage");
+  FilesystemStorage s("UnitTestsStorage");
   CompressedFileStorageAccessor accessor(s);
 
   std::string r;