irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

filesystem.hpp
Go to the documentation of this file.
1 #ifndef IRODS_FILESYSTEM_FILESYSTEM_HPP
2 #define IRODS_FILESYSTEM_FILESYSTEM_HPP
3 
4 #include "filesystem/config.hpp"
9 #include "filesystem/detail.hpp"
10 
11 #include "rcConnect.h"
12 
13 #ifdef IRODS_FILESYSTEM_ENABLE_SERVER_SIDE_API
15 #else
17 #endif // IRODS_FILESYSTEM_ENABLE_SERVER_SIDE_API
18 
19 #include "json.hpp"
20 
21 #include <cstdint>
22 #include <string>
23 #include <chrono>
24 #include <vector>
25 #include <type_traits>
26 #include <algorithm>
27 
28 #include <boost/variant.hpp>
29 
31 {
32  class path;
33 
34  using object_time_type = std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>;
35 
36  enum class remove_options
37  {
38  none,
39  no_trash
40  };
41 
42  struct checksum
43  {
45  std::string value;
46  std::uintmax_t size;
48  };
49 
50  enum class replica_number
51  {
52  all
53  };
54 
56  {
57  none,
58  if_empty,
59  always
60  };
61 
62  struct metadata
63  {
64  std::string attribute;
65  std::string value;
66  std::string units;
67  };
68 
69  namespace NAMESPACE_IMPL
70  {
71  // Operational functions
72 
73  auto copy(rxComm& _comm, const path& _from, const path& _to, copy_options _options = copy_options::none) -> void;
74  auto copy_data_object(rxComm& _comm, const path& _from, const path& _to, copy_options _options = copy_options::none) -> bool;
75 
76  auto create_collection(rxComm& _comm, const path& _p) -> bool;
77  auto create_collection(rxComm& _comm, const path& _p, const path& _existing_p) -> bool;
78  auto create_collections(rxComm& _comm, const path& _p) -> bool;
79 
80  auto exists(object_status _s) noexcept -> bool;
81  auto exists(rxComm& _comm, const path& _p) -> bool;
82 
83  auto equivalent(rxComm& _comm, const path& _p1, const path& _p2) -> bool;
84 
85  auto data_object_size(rxComm& _comm, const path& _p) -> std::uintmax_t;
86 
87  auto is_collection(object_status _s) noexcept -> bool;
88  auto is_collection(rxComm& _comm, const path& _p) -> bool;
89 
90  auto is_empty(rxComm& _comm, const path& _p) -> bool;
91 
92  auto is_other(object_status _s) noexcept -> bool;
93  auto is_other(rxComm& _comm, const path& _p) -> bool;
94 
95  auto is_data_object(object_status _s) noexcept -> bool;
96  auto is_data_object(rxComm& _comm, const path& _p) -> bool;
97 
98  auto last_write_time(rxComm& _comm, const path& _p) -> object_time_type;
99  auto last_write_time(rxComm& _comm, const path& _p, object_time_type _new_time) -> void;
100 
101  auto remove(rxComm& _comm, const path& _p, remove_options _opts = remove_options::none) -> bool;
102  auto remove_all(rxComm& _comm, const path& _p, remove_options _opts = remove_options::none) -> std::uintmax_t;
103 
104  auto permissions(rxComm& _comm, const path& _p, const std::string& _user_or_group, perms _prms) -> void;
105 
106  auto rename(rxComm& _comm, const path& _from, const path& _to) -> void;
107 
108  auto status(rxComm& _comm, const path& _p) -> object_status;
109 
110  auto status_known(object_status _s) noexcept -> bool;
111 
112  auto data_object_checksum(rxComm& _comm,
113  const path& _path,
114  const boost::variant<int, replica_number>& _replica_number,
115  verification_calculation _calculation = verification_calculation::none) -> std::vector<checksum>;
116 
117  auto get_metadata(rxComm& _comm, const path& _path) -> std::vector<metadata>;
118 
119  auto set_metadata(rxComm& _comm, const path& _path, const metadata& _metadata) -> void;
120 
121  auto add_metadata(rxComm& _comm, const path& _path, const metadata& _metadata) -> void;
122 
123  template <typename Iterator>
124  auto add_metadata(rxComm& _comm, const path& _path, Iterator _first, Iterator _last) -> void;
125 
126  template <typename Container,
127  typename = decltype(std::begin(std::declval<Container>())),
128  typename = std::enable_if_t<std::is_same_v<std::decay_t<typename Container::value_type>, metadata>>>
129  auto add_metadata(rxComm& _comm, const path& _path, const Container& _container) -> void;
130 
131  auto remove_metadata(rxComm& _comm, const path& _path, const metadata& _metadata) -> void;
132 
133  template <typename Iterator>
134  auto remove_metadata(rxComm& _comm, const path& _path, Iterator _first, Iterator _last) -> void;
135 
136  template <typename Container,
137  typename = decltype(std::begin(std::declval<Container>())),
138  typename = std::enable_if_t<std::is_same_v<std::decay_t<typename Container::value_type>, metadata>>>
139  auto remove_metadata(rxComm& _comm, const path& _path, const Container& _container) -> void;
140 
141  #include "filesystem/filesystem.tpp"
142  } // namespace NAMESPACE_IMPL
143 } // namespace irods::experimental::filesystem
144 
145 #endif // IRODS_FILESYSTEM_FILESYSTEM_HPP
filesystem_error.hpp
irods::experimental::filesystem::client::get_metadata
auto get_metadata(rcComm_t &_comm, const path &_path) -> std::vector< metadata >
Definition: filesystem.cpp:1012
irods::experimental::filesystem::path
Definition: path.hpp:15
config.hpp
irods::experimental::filesystem::checksum
Definition: filesystem.hpp:43
irods::experimental::filesystem::client::is_data_object
auto is_data_object(rcComm_t &_comm, const path &_p) -> bool
Definition: filesystem.cpp:640
irods::experimental::filesystem::checksum::is_up_to_date
bool is_up_to_date
Definition: filesystem.hpp:47
irods.six.Iterator
Iterator
Definition: six.py:534
rcConnect.h
NAMESPACE_IMPL
#define NAMESPACE_IMPL
Definition: default_transport.hpp:36
irods::experimental::filesystem::replica_number
replica_number
Definition: filesystem.hpp:51
rxComm
#define rxComm
Definition: default_transport.hpp:38
object_status.hpp
irods::experimental::filesystem::checksum::value
std::string value
Definition: filesystem.hpp:45
irods::experimental::filesystem::client::data_object_size
auto data_object_size(rcComm_t &_comm, const path &_p) -> std::uintmax_t
Definition: filesystem.cpp:581
irods::experimental::filesystem::client::permissions
auto permissions(rcComm_t &_comm, const path &_p, const std::string &_user_or_group, perms _prms) -> void
Definition: filesystem.cpp:746
atomic_apply_metadata_operations.h
irods::experimental::filesystem::client::last_write_time
auto last_write_time(rcComm_t &_comm, const path &_p, object_time_type _new_time) -> void
Definition: filesystem.cpp:656
irods::experimental::filesystem::checksum::size
std::uintmax_t size
Definition: filesystem.hpp:46
copy_options.hpp
permissions.hpp
irods::experimental::filesystem::client::add_metadata
auto add_metadata(rcComm_t &_comm, const path &_path, const Container &_container) -> void
irods::experimental::filesystem::client::begin
auto begin(collection_iterator _iter) noexcept -> collection_iterator
Definition: collection_iterator.hpp:83
irods::experimental::filesystem::verification_calculation::none
@ none
irods::experimental::filesystem::client::copy_data_object
auto copy_data_object(rcComm_t &_comm, const path &_from, const path &_to, copy_options _options=copy_options::none) -> bool
Definition: filesystem.cpp:425
irods::experimental::filesystem
Definition: collection_entry.hpp:12
irods::experimental::filesystem::client::copy
auto copy(rcComm_t &_comm, const path &_from, const path &_to, copy_options _options=copy_options::none) -> void
Definition: filesystem.cpp:370
irods::experimental::filesystem::verification_calculation
verification_calculation
Definition: filesystem.hpp:56
irods::experimental::filesystem::metadata::attribute
std::string attribute
Definition: filesystem.hpp:64
irods::experimental::filesystem::object_time_type
std::chrono::time_point< std::chrono::system_clock, std::chrono::seconds > object_time_type
Definition: filesystem.hpp:34
irods::experimental::filesystem::client::is_empty
auto is_empty(rcComm_t &_comm, const path &_p) -> bool
Definition: filesystem.cpp:610
irods::experimental::filesystem::client::create_collections
auto create_collections(rcComm_t &_comm, const path &_p) -> bool
Definition: filesystem.cpp:527
irods::experimental::filesystem::remove_options::no_trash
@ no_trash
irods::experimental::filesystem::client::remove_metadata
auto remove_metadata(rcComm_t &_comm, const path &_path, const Container &_container) -> void
irods::experimental::filesystem::client::is_other
auto is_other(rcComm_t &_comm, const path &_p) -> bool
Definition: filesystem.cpp:630
irods::experimental::filesystem::client::exists
auto exists(rcComm_t &_comm, const path &_p) -> bool
Definition: filesystem.cpp:547
irods::experimental::filesystem::client::is_collection
auto is_collection(rcComm_t &_comm, const path &_p) -> bool
Definition: filesystem.cpp:605
irods::experimental::filesystem::client::status_known
auto status_known(object_status _s) noexcept -> bool
Definition: filesystem.cpp:1007
irods::experimental::filesystem::client::data_object_checksum
auto data_object_checksum(rcComm_t &_comm, const path &_path, const boost::variant< int, replica_number > &_replica_number, verification_calculation _calculation=verification_calculation::none) -> std::vector< checksum >
Definition: filesystem.cpp:886
irods::experimental::filesystem::metadata::units
std::string units
Definition: filesystem.hpp:66
irods::experimental::filesystem::perms
perms
Definition: permissions.hpp:9
irods::experimental::filesystem::client::remove
auto remove(rcComm_t &_comm, const path &_p, remove_options _opts=remove_options::none) -> bool
Definition: filesystem.cpp:699
irods::experimental::filesystem::client::status
auto status(rcComm_t &_comm, const path &_p) -> object_status
Definition: filesystem.cpp:963
irods::experimental::filesystem::client::set_metadata
auto set_metadata(rcComm_t &_comm, const path &_path, const metadata &_metadata) -> void
Definition: filesystem.cpp:1057
detail.hpp
irods::experimental::filesystem::replica_number::all
@ all
irods::experimental::filesystem::object_status
Definition: object_status.hpp:22
irods::experimental::filesystem::checksum::replica_number
int replica_number
Definition: filesystem.hpp:44
irods::experimental::filesystem::metadata::value
std::string value
Definition: filesystem.hpp:65
irods::experimental::filesystem::client::rename
auto rename(rcComm_t &_comm, const path &_from, const path &_to) -> void
Definition: filesystem.cpp:805
irods::experimental::filesystem::client::create_collection
auto create_collection(rcComm_t &_comm, const path &_p, const path &_existing_p) -> bool
Definition: filesystem.cpp:503
irods::experimental::filesystem::remove_options
remove_options
Definition: filesystem.hpp:37
irods::experimental::filesystem::copy_options
copy_options
Definition: copy_options.hpp:10
rs_atomic_apply_metadata_operations.hpp
irods::experimental::filesystem::client::equivalent
auto equivalent(rcComm_t &_comm, const path &_p1, const path &_p2) -> bool
Definition: filesystem.cpp:552
irods::experimental::filesystem::client::remove_all
auto remove_all(rcComm_t &_comm, const path &_p, remove_options _opts=remove_options::none) -> std::uintmax_t
Definition: filesystem.cpp:706
irods::experimental::filesystem::metadata
Definition: filesystem.hpp:63