Seismic Drive Client API
SDHierarchicalDatasetAccessor.h
Go to the documentation of this file.
1 // ============================================================================
2 // Copyright 2017-2021, Schlumberger
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 // ============================================================================
16 
17 #pragma once
18 
19 #include "DLL_EXPORT.h"
20 #include "SDDatasetDisposition.h"
21 
22 #include <iterator>
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 namespace seismicdrive
28 {
29  class Storage;
30 
31  /*******************************************************************************/
40  {
41  /*******************************************************************************/
48  SDHierarchicalMetaData(const std::string &name = "", uint64_t nobjects = 0, uint64_t size = 0)
49  : _name(name), _nobjects(nobjects), _size(size)
50  {
51  }
52 
53  /*******************************************************************************/
61  {
62  return this->_name == rhs._name && this->_nobjects == rhs._nobjects && this->_size == rhs._size;
63  }
64 
66  std::string _name;
67 
69  uint64_t _nobjects;
70 
72  uint64_t _size;
73  };
74 
75  /*******************************************************************************/
84  {
85  private:
86  /*******************************************************************************/
92  SDHierarchicalDatasetAccessor(const SDDatasetDisposition disposition, void *storage, const std::string &gcsUrl, const std::string tag);
93 
94  /*******************************************************************************/
100  void metadata_set(void *meta);
101 
102  public:
103  /*******************************************************************************/
111  SDHierarchicalDatasetAccessor(const SDDatasetDisposition disposition, Storage *storage, const std::string &gcsUrl, const std::string tag);
112 
113  /*******************************************************************************/
120 
121  /*******************************************************************************/
129 
130  /*******************************************************************************/
137 
138  /*******************************************************************************/
146 
147  /*******************************************************************************/
154 
155  // --------------------------------------------------------------------------
156 
157  /*******************************************************************************/
165  std::string get_tag() const;
166 
167  /*******************************************************************************/
175  uint64_t node_add(const std::string &nodeName);
176 
177  /*******************************************************************************/
185  uint64_t node_get(const std::string &nodeName) const;
186 
187  /*******************************************************************************/
199  std::size_t object_write(const uint64_t nodeID, const std::string &objectName, const char *buffer, const std::size_t size);
200 
201  /*******************************************************************************/
211  void object_read(const uint64_t nodeID, const std::string &objectName, char *buffer, size_t size);
212 
213  /*******************************************************************************/
221  void object_delete(const uint64_t nodeID, const std::string &objectName);
222 
223  // --------------------------------------------------------------------------
224 
225  /*******************************************************************************/
233  uint64_t node_count() const;
234 
235  /*******************************************************************************/
243  std::size_t tot_byte_size() const;
244 
245  /*******************************************************************************/
253  std::vector<SDHierarchicalMetaData> metadata_get() const;
254 
255  /*******************************************************************************/
262  void metadata_set(const std::vector<SDHierarchicalMetaData> *meta);
263 
264  /*******************************************************************************/
272  std::vector<std::string> node_names() const;
273 
274  /*******************************************************************************/
282  std::vector<std::size_t> node_sizes() const;
283 
284  /*******************************************************************************/
293  std::string node_name(const uint64_t nodeID) const;
294 
295  /*******************************************************************************/
305  std::size_t node_size(const uint64_t nodeID) const;
306 
307  /*******************************************************************************/
317  uint64_t object_count(const uint64_t nodeID) const;
318 
319  /*******************************************************************************/
329  std::vector<std::string> object_names(const uint64_t nodeID) const;
330 
331  /*******************************************************************************/
341  std::vector<std::size_t> object_sizes(const uint64_t nodeID) const;
342 
343  /*******************************************************************************/
355  std::size_t object_size(const uint64_t nodeID, const std::string &object_name) const;
356 
357  /*******************************************************************************/
369  void objects_info(const uint64_t nodeID, std::vector<std::string> &names, std::vector<std::size_t> &sizes);
370 
371  private:
372 #ifdef _MSC_VER
373  #pragma warning(push)
374  #pragma warning(disable : 4251)
375 #endif
376 
377  class Impl;
378 
379  std::unique_ptr<Impl> _impl;
380 
381 #ifdef _MSC_VER
382  #pragma warning(pop)
383 #endif
384 
385  friend class SDHierarchicalDatasetAcsTest;
386  };
387 
388 }
bool operator==(const SDHierarchicalMetaData &rhs)
Equals operator.
Definition: SDHierarchicalDatasetAccessor.h:60
SDDatasetDisposition
Defines the different Seismic Drive Dataset Dispositions.
Definition: SDDatasetDisposition.h:29
This class allows access to hierarchical datasets in cloud storage.
Definition: SDHierarchicalDatasetAccessor.h:83
uint64_t _size
Total size in byte of the object in the node.
Definition: SDHierarchicalDatasetAccessor.h:72
std::string _name
Name of the node.
Definition: SDHierarchicalDatasetAccessor.h:66
SDHierarchicalMetaData(const std::string &name="", uint64_t nobjects=0, uint64_t size=0)
Definition: SDHierarchicalDatasetAccessor.h:48
uint64_t _nobjects
Number of objects in the node.
Definition: SDHierarchicalDatasetAccessor.h:69
This class represents the metadata of a hierarchical dataset.
Definition: SDHierarchicalDatasetAccessor.h:39
Definition: Constants.h:27