|
Seismic Drive Client API
|
This class represents a hierarchical cloud storage dataset. More...
#include <SDHierarchicalDataset.h>
Public Member Functions | |
| SDHierarchicalDataset (SDManager *sdmanager, const std::string &sdfilename, const bool log=false) | |
| Constructor. More... | |
| SDHierarchicalDataset (SDManager *sdmanager, const std::string &sdfilename, const std::string &filetype, const bool log=false) | |
| Constructor with dataset type. More... | |
| ~SDHierarchicalDataset () | |
| Destructor. More... | |
| SDHierarchicalDataset (SDHierarchicalDataset &&sdhd) noexcept | |
| Move Constructor. More... | |
| SDHierarchicalDataset & | operator= (SDHierarchicalDataset &&sdhd) noexcept |
| Move Assignment Operator. More... | |
| SDHierarchicalDataset (const SDHierarchicalDataset &op) | |
| Copy Constructor. More... | |
| SDHierarchicalDataset & | operator= (const SDHierarchicalDataset &op) |
| Copy Assignment Operator. More... | |
| void | open (const SDDatasetDisposition disposition) |
| Opens the dataset whose name was specified the constructor. More... | |
| void | open (const SDDatasetDisposition disposition, const std::string &legaltag) |
| Opens the dataset whose name was specified the constructor. More... | |
| void | open (const SDDatasetDisposition disposition, const std::string &legaltag, const std::string &wid) |
| Opens the dataset whose name was specified the constructor. More... | |
| void | open (const SDDatasetDisposition disposition, const std::unordered_map< std::string, std::string > &args) |
| Main method to open a seismic store dataset. More... | |
| void | close () |
| Close an opened dataset. More... | |
| void | flush () |
| Flushes the file metadata. More... | |
| bool | exist () const |
| Deprecated. More... | |
| bool | exists () const |
| Check if the dataset exists. More... | |
| bool | isOpen () |
| Return the dataset opening state. More... | |
| bool | objectExists (const std::string &blockName) const |
| Checks if an object exists. More... | |
| SDHierarchicalDatasetAccessor | getDatasetAccessor () const |
| gets the hierarchical dataset accessor More... | |
| void | mergeDatasetAccessor (const SDHierarchicalDatasetAccessor &dsaccessor) |
| Merges the accessor metadata into the dataset. More... | |
| void | lock () |
| Acquire a lockfile on the dataset. More... | |
| void | waitLock () |
| Wait until lockfile on the dataset is removed. More... | |
| void | unlock () |
| Release a lockfile on the dataset. More... | |
| std::string | getConsistencyID () |
| Gets the locking session id. More... | |
| int | getConsistencyCounter () |
| Gets process number that is locking the dataset. More... | |
| void | setTags (const std::vector< std::string > &tags) const |
| Add dataset tags. More... | |
| std::vector< std::string > | getTags () const |
| Get dataset tags. More... | |
| std::string | getLegalTag () const |
| Gets the legal-tag. More... | |
| std::string | getCreatedDate () const |
| Get dataset created date. More... | |
| std::string | getType () const |
| Gets the dataset type. More... | |
| void | setSeismicMeta (const std::string &seismicmeta) |
| Add seismic metadata to the dataset This method can be use to set the seismic metadata field in the dataset's JSON. More... | |
| std::string | getSeismicMeta () const |
| Get the seismic metadata from the dataset. More... | |
| void | setHttpContext (const HttpContext *context=nullptr) |
| Set connection parameters. More... | |
Friends | |
| class | SDHierarchicalDatasetTest |
This class represents a hierarchical cloud storage dataset.
This is a dataset class to read/write cloud storage objects with a hierarchical structure.
| seismicdrive::SDHierarchicalDataset::SDHierarchicalDataset | ( | SDManager * | sdmanager, |
| const std::string & | sdfilename, | ||
| const bool | log = false |
||
| ) |
Constructor.
| sdmanager | is the seismic drive service manager |
| sdfilename | name of the dataset. It must be in the form /seimsic-drive/[tenant_name]/[subproject_name]/[path*]/[dataset_name]. The field [path*] rapresent the logic dataset hierarchy and it's optional. example sd://fatty-acid/sproj01/a/b/c/dataset_01 |
| log | is a boolean value that enable the debug logger (false by default) |
| seismicdrive::SDHierarchicalDataset::SDHierarchicalDataset | ( | SDManager * | sdmanager, |
| const std::string & | sdfilename, | ||
| const std::string & | filetype, | ||
| const bool | log = false |
||
| ) |
Constructor with dataset type.
| sdmanager | is the seismic drive service manager |
| sdfilename | name of the dataset. It must be in the form /seimsic-drive/[tenant_name]/[subproject_name]/[path*]/[dataset_name]. The field [path*] rapresent the logic dataset hierarchy and it's optional. example sd://fatty-acid/sproj01/a/b/c/dataset_01 |
| filetype | is the dataset type (ex. dio, bolt, txt, segy... ) |
| log | is a boolean value that enable the debug logger (false by default) |
| seismicdrive::SDHierarchicalDataset::~SDHierarchicalDataset | ( | ) |
Destructor.
If the file is opened for writing (not READ_ONLY), it wll be closed.
|
noexcept |
Move Constructor.
This contructor moves the SDHierarchicalDataset object from the source to the new object and destroy the source object.
| seismicdrive::SDHierarchicalDataset::SDHierarchicalDataset | ( | const SDHierarchicalDataset & | op | ) |
Copy Constructor.
This contructor makes a copy of the SDHierarchicalDataset object from the source to the new object without modifying the source object.
| void seismicdrive::SDHierarchicalDataset::close | ( | ) |
Close an opened dataset.
This method closes a dataset and marks it as closed. File must be opened.
| bool seismicdrive::SDHierarchicalDataset::exist | ( | ) | const |
Deprecated.
Use exists() instead
| bool seismicdrive::SDHierarchicalDataset::exists | ( | ) | const |
Check if the dataset exists.
Checks if the dataset exists in cloud storage
| void seismicdrive::SDHierarchicalDataset::flush | ( | ) |
Flushes the file metadata.
This method flushes the metadata of the object into the dataset.
| int seismicdrive::SDHierarchicalDataset::getConsistencyCounter | ( | ) |
Gets process number that is locking the dataset.
This method is an accessor used to get the process number that is locking the current dataset.
| std::string seismicdrive::SDHierarchicalDataset::getConsistencyID | ( | ) |
Gets the locking session id.
This method is an accessor used to get the locking session ID of the current dataset.
| std::string seismicdrive::SDHierarchicalDataset::getCreatedDate | ( | ) | const |
Get dataset created date.
This method can be used to retrieve the dataset creation date.
usage example:
| SDHierarchicalDatasetAccessor seismicdrive::SDHierarchicalDataset::getDatasetAccessor | ( | ) | const |
gets the hierarchical dataset accessor
This method generates an accessor for the current hierarchical dataset.
| std::string seismicdrive::SDHierarchicalDataset::getLegalTag | ( | ) | const |
Gets the legal-tag.
This method gets the legal-tag.
| std::string seismicdrive::SDHierarchicalDataset::getSeismicMeta | ( | ) | const |
Get the seismic metadata from the dataset.
This method can be used to retrieve the seismic metadata field from the dataset's JSON
usage example:
SDManager sdmanager; SDHierarchicalDataset dataset(&sdmanager, "sd://tenant/subproject/data"); dataset.open(SDDatasetDisposition::READ_ONLY); auto smeta = dataset.getSeismicMeta(); dataset.close()
| std::vector<std::string> seismicdrive::SDHierarchicalDataset::getTags | ( | ) | const |
Get dataset tags.
This method can be used to retrieve the list of seismic store dataset tags.
usage example:
| std::string seismicdrive::SDHierarchicalDataset::getType | ( | ) | const |
Gets the dataset type.
This method gets the dataset type.
| bool seismicdrive::SDHierarchicalDataset::isOpen | ( | ) |
Return the dataset opening state.
This method return whether or not a dataset is already opened.
| void seismicdrive::SDHierarchicalDataset::lock | ( | ) |
Acquire a lockfile on the dataset.
This methos locks the current dataset.
| void seismicdrive::SDHierarchicalDataset::mergeDatasetAccessor | ( | const SDHierarchicalDatasetAccessor & | dsaccessor | ) |
Merges the accessor metadata into the dataset.
This method merges the metadata of a Hierarchical Dataset Accessor into the Hierarchical Dataset.
| dsaccessor | is the Hierarchical Dataset Accessor |
| bool seismicdrive::SDHierarchicalDataset::objectExists | ( | const std::string & | blockName | ) | const |
Checks if an object exists.
Checks if an object exists in this dataset
| blockName | is the name of the block (object) |
| void seismicdrive::SDHierarchicalDataset::open | ( | const SDDatasetDisposition | disposition | ) |
Opens the dataset whose name was specified the constructor.
This method is the most basic open function. It opens a dataset with a given open mode.
usage example:
| disposition | open mode |
| void seismicdrive::SDHierarchicalDataset::open | ( | const SDDatasetDisposition | disposition, |
| const std::string & | legaltag | ||
| ) |
Opens the dataset whose name was specified the constructor.
This method allows opening a dataset with a given open mode and legaltag.
usage example:
| disposition | open mode |
| legaltag | the dataset legaltag |
| void seismicdrive::SDHierarchicalDataset::open | ( | const SDDatasetDisposition | disposition, |
| const std::string & | legaltag, | ||
| const std::string & | wid | ||
| ) |
Opens the dataset whose name was specified the constructor.
This method allows opening a dataset with a given open mode and legaltag that has already been locked for writing.
usage example:
| disposition | open mode |
| wid | is the write opening id. This must be specified if you wnat to open a dataset already locked for write. |
| legaltag | the dataset legaltag |
| void seismicdrive::SDHierarchicalDataset::open | ( | const SDDatasetDisposition | disposition, |
| const std::unordered_map< std::string, std::string > & | args | ||
| ) |
Main method to open a seismic store dataset.
This method opens a seismic data dataset in seismic store.
The method support different opening dispotion modes:
The method accepts these optional opening arguments (defined in Constants.h);
KPedantic: define if enable or disable the pedantic mode to automatically flush the file-metadata in a locking session. = "enable" -> the file-metadata, if exist, will be saved. = "disable" -> the file-metadata, if exist, will be saved ONLY if the kWriteIdLabel is not set (not in a locking session)
The file-metadata, in the SDHierarchicalDataset accessor, is an object metadata associated to the dataset. It contains information on nodes, number of objects that compose the node and the total size of the node in bytes: file-metadata = { type: "HIERARCHICAL", nodes: { name: <node_name> nobjects: <number_of_node_objects> size: <dataset_size> } }
These properties are collected at every block written and saved during the close operation. In the case of a "Master" node non pedantic (see table below) the file-metadata is not collected at every block written, but it is computed during the close by iterating on the saved object on the storage (high costs)
The file-metadata can be useful if the dataset is saved with a hierarchical structure (like a normal filesystem) These informations are saved during the close dataset operataion. If is not required, is advisable to disable the file-metadata saving. This will immprove performance by reducing the latencies while closing datasets.
The optional argument KFlushManifest can be tuned based on the consumer workflow to disable the file-metadata saving. Below reported all possible combination with: saved = YES (save the file metadata) NO (do not save the file metadata) cost = number of call to perform to the SDMS service during the close
|-kFlushManifest-|-saved-|-cost-| |-ENABLE------—|-YES—|-1-—| |-DISABLE-----—|-NO-—|-0— |
usage example:
| disposition | The opening disposition open mode |
| args | The list of optional arguments |
|
noexcept |
Move Assignment Operator.
Same functionality as the move constructor.
| SDHierarchicalDataset& seismicdrive::SDHierarchicalDataset::operator= | ( | const SDHierarchicalDataset & | op | ) |
Copy Assignment Operator.
Same functionality as the copy constructor.
| void seismicdrive::SDHierarchicalDataset::setHttpContext | ( | const HttpContext * | context = nullptr | ) |
Set connection parameters.
This method sets connection parameters for the underlying HTTP connection to the server.
| context | The connection parameters to be used for this dataset |
usage example:
HttpContext context; context.timeoutSecs = 3600; context.tcpKeepAlive = true;
SDManager sdmanager; SDHierarchicalDataset dataset(&sdmanager, "sd://tenant/subproject/data"); dataset.setHttpContext(&context); dataset.open(SDDatasetDisposition::READ_ONLY); auto smeta = dataset.getSeismicMeta(); dataset.close()
| void seismicdrive::SDHierarchicalDataset::setSeismicMeta | ( | const std::string & | seismicmeta | ) |
Add seismic metadata to the dataset This method can be use to set the seismic metadata field in the dataset's JSON.
usage example:
SDManager sdmanager; SDHierarchicalDataset dataset(&sdmanager, "sd://tenant/subproject/data"); dataset.open(SDDatasetDisposition::READ_WRITE); dataset.setSeismicMeta("{\"description":""}"); dataset.close();
| seismicmeta | is the json stringify seismic metadata. The schema for seismic meta can be found at https://developer.delfi.slb.com/solutions/dataecosystem/tutorials/storageservice |
| error::dataset::Error | Invalid JSON or seismic meta field does not exist after patch request |
| void seismicdrive::SDHierarchicalDataset::setTags | ( | const std::vector< std::string > & | tags | ) | const |
Add dataset tags.
This method can be used to set a list of tags to a seismic store dataset. Tags are just simple strings (not key/value pairs).
usage example:
| tags | The list of tags to add to the opened seismic store dataset |
| void seismicdrive::SDHierarchicalDataset::unlock | ( | ) |
Release a lockfile on the dataset.
This method removes the lock from the current dataset.
| void seismicdrive::SDHierarchicalDataset::waitLock | ( | ) |
Wait until lockfile on the dataset is removed.
This method waits until the current dataset is not locked by another process.
|
friend |
1.8.14