|
Seismic Drive Client API
|
This class represents a generic cloud storage dataset. More...
#include <SDGenericDataset.h>
Public Member Functions | |
| SDGenericDataset (SDManager *sdmanager, const std::string &sdfilename, const bool log=false) | |
| Constructor. More... | |
| SDGenericDataset (SDManager *sdmanager, const std::string &sdfilename, const std::string &filetype, const bool log=false) | |
| Constructor with dataset type. More... | |
| ~SDGenericDataset () | |
| Destructor. More... | |
| SDGenericDataset (SDGenericDataset &&rhs) noexcept | |
| Move Constructor. More... | |
| SDGenericDataset & | operator= (SDGenericDataset &&rhs) noexcept |
| Move Assignment Operator. More... | |
| SDGenericDataset (const SDGenericDataset &rhs) | |
| Copy Constructor. More... | |
| SDGenericDataset & | operator= (const SDGenericDataset &rhs) |
| 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 (SDDatasetDisposition disposition, const std::unordered_map< std::string, std::string > &args) |
| Main method to open a seismic store dataset. More... | |
| void | open (const dataset::ParamsOpen ¶ms) |
| Opens the dataset whose name was specified in the constructor. More... | |
| void | close () |
| Close an opened dataset. More... | |
| std::string | getGcsUrl () const |
| Deprecated. More... | |
| std::string | getStorageUrl () const |
| Get storage url. More... | |
| std::string | getType () const |
| Gets the dataset type. More... | |
| std::string | getLegalTag () const |
| Gets the legal-tag. More... | |
| bool | blockExists (int blocknum) const |
| Determines whether a block of data exists. More... | |
| bool | blockExists (const std::string &) const |
| Determines whether a block of data exists. More... | |
| void | writeBlock (int blocknum, const char *data, std::size_t len, bool check_and_overwrite=false) |
| Writes a block of data. More... | |
| void | readBlock (int blocknum, char *data, size_t offset, size_t numBytes) |
| Read a block of data. More... | |
| void | readBlock (int blocknum, char *data, size_t &len) |
| Read a block of data. More... | |
| void | readBlock (int blocknum, char **data, size_t &len) |
| Read a block of data. More... | |
| void | writeBlock (const std::string &blockName, const char *data, std::size_t len, bool check_and_overwrite=false) |
| Writes a block of data. More... | |
| void | readBlock (const std::string &blockName, char *data, size_t offset, size_t numBytes) |
| Read a block of data. More... | |
| void | readBlock (const std::string &blockName, char *data, size_t &len) |
| Read a block of data. More... | |
| void | readBlock (const std::string &blockName, char **data, size_t &len) |
| Read a block of data. More... | |
| long long | getBlockSize (int blocknum) |
| Gets the size of a block. More... | |
| long long | getBlockSize (const std::string &blockName) |
| Gets the size of a block. More... | |
| std::vector< long long > | getBlocksSize (const std::vector< std::string > &blockNames) |
| Deprecated. More... | |
| std::vector< long long > | getBlockSizes (const std::vector< std::string > &blockNames) |
| Gets the sizes of a list of blocks. More... | |
| void | deleteBlock (const std::string &blockName) |
| Deletes a given block. More... | |
| void | deleteBlock (const std::string &blockName, bool skipMetadataUpdate) |
| Deletes a given block. More... | |
| uint64_t | getBlockNum () |
| Gets the number of blocks. More... | |
| uint64_t | getSize () |
| Get the dataset size. More... | |
| void | setBlockNum (uint64_t blockNum) |
| sets the number of a block More... | |
| void | setSize (uint64_t size) |
| Sets the dataset size. More... | |
| bool | checkReadAccess () const |
| Checks if the user have read access permission on current dataset. More... | |
| bool | checkWriteAccess () const |
| Checks if the user have write access permission on current dataset. More... | |
| bool | checkDeleteAccess () const |
| Checks if the user have delete access permission on current dataset. More... | |
| void | setMetaData (const std::string &metadata) const |
| Adds user-defined metadata to the dataset. More... | |
| std::string | getMetaData () const |
| Gets the user-defined metadata of the current dataset. More... | |
| std::string | getFileMetaData () const |
| Gets the user-defined file metadata of the current dataset. More... | |
| void | setSeismicMeta (const std::string &seismicmeta) |
| Adds seismic metadata to the dataset. More... | |
| std::string | getSeismicMeta () const |
| Gets the seismic metadata from the dataset. More... | |
| std::string | getCTag () |
| Gets the dataset coherency tag. More... | |
| std::string | getConsistencyID () |
| Gets the locking session id. More... | |
| int | getConsistencyCounter () |
| Gets process number that is locking the dataset. More... | |
| bool | checkCTag () |
| Check dataset coherency tag. More... | |
| void | refreshDatsetMetadata () |
| Deprecated. More... | |
| void | refreshDatasetMetadata () |
| Refresh the dataset metadata. More... | |
| SDGenericDatasetBasicObjectIterator | getIterator () const |
| Gets the iterator info. More... | |
| SDGenericDatasetBasicObjectIterator | getIterator (bool recursive) const |
| Gets the iterator info. More... | |
| void | flush () |
| Flushes the file metadata. More... | |
| bool | exist () const |
| Deprecated. More... | |
| bool | exists () const |
| Check if the dataset exists. More... | |
| std::string | getSerializedReadOnlyAccessor () const |
| Generate a serialized Read Only Dataset Accessor. More... | |
| void | upload (const std::string &filepath, const std::string &legaltag="") const |
| Upload a file into a single object. 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 | getCreatedDate () const |
| Get dataset created date. More... | |
| std::string | getStatus () const |
| Get dataset status. More... | |
| void | setHttpContext (const HttpContext *context=nullptr) |
| Set the underlying HTTP connection configuration. More... | |
| void | setHttpContext (const HttpContext *context, HttpConnectionLink link) |
| Set the underlying HTTP connection configuration. More... | |
| void | setExponentialRetryBackoffPolicy (const ExponentialRetryBackoffPolicy *policy, HttpConnectionLink link=HttpConnectionLink::ANY) |
| Set the exponential retry back-off policy. More... | |
| std::string | getSerializedContext () |
| Return the dataset open context. More... | |
| void | setReadonlyMode (bool readonly) |
| Set the readonly mode for a dataset. More... | |
| bool | getReadonlyMode () const |
| Get the readonly mode status for a dataset. More... | |
| std::vector< std::string > | getHosts () |
| Get host list for a dataset. More... | |
| bool | updateStorageTier (const std::string &storageTier) const |
| bool | setStorageTier (const std::string &tier) |
| set the storage tier from user More... | |
| std::string | getStorageTier () |
| Get the storage tier from user. More... | |
Friends | |
| class | SDGenericDatasetTest |
This class represents a generic cloud storage dataset.
This class is a generic dataset class to read/write cloud storage objects as sequential(0...n-1) file blocks.
| seismicdrive::SDGenericDataset::SDGenericDataset | ( | 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 /seismic-drive/[tenant_name]/[subproject_name]/[path*]/[dataset_name]. The field [path*] rapresent the 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::SDGenericDataset::SDGenericDataset | ( | 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 /seismic-drive/[tenant_name]/[subproject_name]/[path*]/[dataset_name]. The field [path*] rapresent the 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::SDGenericDataset::~SDGenericDataset | ( | ) |
Destructor.
If the file is opened for writing (not READ_ONLY), it will be closed.
|
noexcept |
Move Constructor.
This constructor moves the SDGenericDataset object from the source to the new object and destroy the source object.
| seismicdrive::SDGenericDataset::SDGenericDataset | ( | const SDGenericDataset & | rhs | ) |
Copy Constructor.
This constructor makes a copy of the SDGenericDataset object from the source to the new object without modifying the source object.
| bool seismicdrive::SDGenericDataset::blockExists | ( | int | blocknum | ) | const |
Determines whether a block of data exists.
This method determines whether a block of data (specified with a block name) exists.
| blocknum | is the number of the block |
| bool seismicdrive::SDGenericDataset::blockExists | ( | const std::string & | ) | const |
Determines whether a block of data exists.
This method determines whether a block of data (specified with a block name) exists.
| blockName | is the name of the block |
| bool seismicdrive::SDGenericDataset::checkCTag | ( | ) |
Check dataset coherency tag.
Returns true if the cached tag returned by getCTag() still matches what is stored on the server.
Returns false if the dataset has been updated. In this case, all the other cached data for this dataset must be assumed stale as well.
Raises an exception if the dataset has been deleted.
NOTES: This method is somewhat expensive as it sends a request to the server.
A dataset that has been deleted and re-created with the same name is considered "updated", not "missing", and will not raise an exception.
The cached c-tag will not be updated by this function.
A dataset has its c-tag updated
The c-tag does not change when data blocks are written.
Usage example:
| bool seismicdrive::SDGenericDataset::checkDeleteAccess | ( | ) | const |
Checks if the user have delete access permission on current dataset.
This method checks if the user have delete access permission on current dataset
| bool seismicdrive::SDGenericDataset::checkReadAccess | ( | ) | const |
Checks if the user have read access permission on current dataset.
This method checks if the user have read access permission on current dataset
| bool seismicdrive::SDGenericDataset::checkWriteAccess | ( | ) | const |
Checks if the user have write access permission on current dataset.
This method checks if the user have write access permission on current dataset
| void seismicdrive::SDGenericDataset::close | ( | ) |
Close an opened dataset.
This method closes a dataset and marks it as closed. File must be opened.
| error::dataset::Locked | if opened in CREATE, OVERWRITE or READ_WRITE mode and Seismic Store received an HTTP Error 423 from service this may happen if
|
The caller must decide whether it's appropriate to retry. error::dataset::Locked should contain enough information to make that decision.
| void seismicdrive::SDGenericDataset::deleteBlock | ( | const std::string & | blockName | ) |
Deletes a given block.
This method is deletes a block given its name. If the object does not exist, this method does nothing.
| blockName | is the name of the block to delete |
| void seismicdrive::SDGenericDataset::deleteBlock | ( | const std::string & | blockName, |
| bool | skipMetadataUpdate | ||
| ) |
Deletes a given block.
This method is deletes a block given its name. If the object does not exist, this method does nothing.
| blockName | is the name of the block to delete |
| skipMetadataUpdate | if true, the dataset metadata won't be updated after deletion |
| bool seismicdrive::SDGenericDataset::exist | ( | ) | const |
Deprecated.
Use exists() instead
| bool seismicdrive::SDGenericDataset::exists | ( | ) | const |
Check if the dataset exists.
Checks if the dataset exists in cloud storage
| void seismicdrive::SDGenericDataset::flush | ( | ) |
Flushes the file metadata.
This method flushes the metadata of the object into the dataset.
| uint64_t seismicdrive::SDGenericDataset::getBlockNum | ( | ) |
Gets the number of blocks.
This method is an accessor used to get the block number.
| long long seismicdrive::SDGenericDataset::getBlockSize | ( | int | blocknum | ) |
Gets the size of a block.
This method is an accessor used to get the size of a block in bytes given the block number.
| blocknum | should be in the range 0..getBlockNum()-1 |
| long long seismicdrive::SDGenericDataset::getBlockSize | ( | const std::string & | blockName | ) |
Gets the size of a block.
This method is an accessor used to get the size of a block in bytes given the block name.
| blockName | is the name of the block |
| std::vector<long long> seismicdrive::SDGenericDataset::getBlockSizes | ( | const std::vector< std::string > & | blockNames | ) |
Gets the sizes of a list of blocks.
This method is an accessor used to get the size of a list of blocks in bytes given a vector of their names.
| blockNames | is the list of blocks name |
| std::vector<long long> seismicdrive::SDGenericDataset::getBlocksSize | ( | const std::vector< std::string > & | blockNames | ) |
Deprecated.
Use getBlockSizes() instead
| int seismicdrive::SDGenericDataset::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::SDGenericDataset::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::SDGenericDataset::getCreatedDate | ( | ) | const |
Get dataset created date.
This method can be used to retrieve the dataset creation date.
usage example:
| std::string seismicdrive::SDGenericDataset::getCTag | ( | ) |
Gets the dataset coherency tag.
Returns the CTag for the dataset that is cached on the client side, i.e. the value the tag has on the last explicit call to open() or refreshDatasetMetadata(). There is no check to see whether the cache is stale. The method has very low cost.
usage example:
| std::string seismicdrive::SDGenericDataset::getFileMetaData | ( | ) | const |
Gets the user-defined file metadata of the current dataset.
This method is an accessor used to get the user-defined file metadata from the current dataset
| std::string seismicdrive::SDGenericDataset::getGcsUrl | ( | ) | const |
Deprecated.
Use getStorageUrl() instead
| std::vector<std::string> seismicdrive::SDGenericDataset::getHosts | ( | ) |
Get host list for a dataset.
Returns a list of hosts potentially used to interact with this dataset.
NOTE: The dataset must be open.
| SDGenericDatasetBasicObjectIterator seismicdrive::SDGenericDataset::getIterator | ( | ) | const |
Gets the iterator info.
This method gets the info from the dataset's SDGenericDatasetBasicObjectIterator object.
| SDGenericDatasetBasicObjectIterator seismicdrive::SDGenericDataset::getIterator | ( | bool | recursive | ) | const |
Gets the iterator info.
This method gets the info from the dataset's SDGenericDatasetBasicObjectIterator object.
| recursive | determines the depth of the search |
| std::string seismicdrive::SDGenericDataset::getLegalTag | ( | ) | const |
Gets the legal-tag.
This method gets the legal-tag.
| std::string seismicdrive::SDGenericDataset::getMetaData | ( | ) | const |
Gets the user-defined metadata of the current dataset.
This method is an accessor used to get the user-defined metadata from the current dataset
| bool seismicdrive::SDGenericDataset::getReadonlyMode | ( | ) | const |
Get the readonly mode status for a dataset.
This method return the dataset readonly mode status as boolean
usage example:
| std::string seismicdrive::SDGenericDataset::getSeismicMeta | ( | ) | const |
Gets 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; SDGenericDataset dataset(&sdmanager, "sd://tenant/subproject/data"); dataset.open(SDDatasetDisposition::READ_ONLY); auto smeta = dataset.getSeismicMeta(); dataset.close()
| std::string seismicdrive::SDGenericDataset::getSerializedContext | ( | ) |
Return the dataset open context.
This method returns the serialized context of an open read-only dataset. The serialized context can be injected as query parameter in the dataset URI to load the serialized context instead of generating a new one.
usage example:
| std::string seismicdrive::SDGenericDataset::getSerializedReadOnlyAccessor | ( | ) | const |
Generate a serialized Read Only Dataset Accessor.
This method generates read only accessor for the current dataset.
| uint64_t seismicdrive::SDGenericDataset::getSize | ( | ) |
Get the dataset size.
This method gets the dataset size, which is the total size of all blocks in the dataset.
| std::string seismicdrive::SDGenericDataset::getStatus | ( | ) | const |
Get dataset status.
This method can be used to retrieve the dataset status (if set)
usage example:
| std::string seismicdrive::SDGenericDataset::getStorageTier | ( | ) |
Get the storage tier from user.
This method will return storage tier, and only works for existing datasets.
| std::string seismicdrive::SDGenericDataset::getStorageUrl | ( | ) | const |
Get storage url.
Returns the storage url of this dataset
| std::vector<std::string> seismicdrive::SDGenericDataset::getTags | ( | ) | const |
Get dataset tags.
This method can be used to retrieve the list of seismic store dataset tags.
usage example:
| std::string seismicdrive::SDGenericDataset::getType | ( | ) | const |
Gets the dataset type.
This method gets the dataset type.
| void seismicdrive::SDGenericDataset::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 (ignored if opened from a serialized context) |
| void seismicdrive::SDGenericDataset::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 |
| error::dataset::Locked | if opened in CREATE, OVERWRITE or READ_WRITE mode and Seismic Store received an HTTP Error 423 from service this may happen if
|
The caller must decide whether it's appropriate to retry. error::dataset::Locked should contain enough information to make that decision.
more realistic usage example :
| void seismicdrive::SDGenericDataset::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 want to open a dataset already locked for write. |
| legaltag | the dataset legaltag |
| error::dataset::Locked | if opened in CREATE, OVERWRITE or READ_WRITE mode and Seismic Store received an HTTP Error 423 from service this may happen if
|
The caller must decide whether it's appropriate to retry. error::dataset::Locked should contain enough information to make that decision.
| void seismicdrive::SDGenericDataset::open | ( | 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 disposition modes:
The method accepts these optional opening arguments (defined in Constants.h);
KReadonlyOnClose: define if the dataset should be marked as readonly when the dataset is closed. = "enable" -> mark the dataset as readonly on close. = "disable" (default) -> do not mark the dataset as readonly on close. The file-metadata, in the SDGenericDataset accessor, is an object metadata associated to the dataset. It contains information on the number of objects that compose the dataset and the total size in byte: file-metadata = { type: "GENERIC", nobjects: <number_of_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 is computed during the close by iterating on the saved object in the storage (high costs)
The file-metadata can be useful if dataset is saved as single object or as consecutive sequence like: 0 1 2 3 ..... N object This information is saved and, in some cases, computed during the close dataset operation. If not required, it is advisable to disable the file-metadata saving. This will improve performance by reducing the latencies while closing datasets.
The optional argument, KFlushManifest/KPedantic/KWriteLabel, can be tuned based on the consumer workflow. 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-|-KPedantic-|-kWriteIdLabel-|-saved-|-cost-| |-ENABLE------—|-ENABLE-—| -SET-------—|-YES—|-1-—| |-ENABLE------—|-ENABLE-—| -UNSET-----—|-YES—|-1-—| |-ENABLE------—|-DISABLE—| -SET-------—|-NO-—|-0-—| |-ENABLE------—|-DISABLE—| -UNSET-----—|-YES—|-1-—| |-DISABLE-----—|-ENABLE-—| -SET-------—|-NO-—|-0-—| |-DISABLE-----—|-ENABLE-—| -UNSET-----—|-NO-—|-0-—| |-DISABLE-----—|-DISABLE—| -SET-------—|-NO-—|-0-—| |-DISABLE-----—|-DISABLE—| -UNSET-----—|-NO-—|-0— |
usage example:
| disposition | The opening disposition open mode |
| args | The list of optional arguments |
| error::dataset::Locked | if opened in CREATE, OVERWRITE or READ_WRITE mode and Seismic Store received an HTTP Error 423 from service this may happen if
|
The caller must decide whether it's appropriate to retry. error::dataset::Locked should contain enough information to make that decision.
| void seismicdrive::SDGenericDataset::open | ( | const dataset::ParamsOpen & | params | ) |
Opens the dataset whose name was specified in the constructor.
Accepts structure containing parameters specific to this call
usage example:
| params | dataset opening parameters |
|
noexcept |
Move Assignment Operator.
Same functionality as the move constructor.
| SDGenericDataset& seismicdrive::SDGenericDataset::operator= | ( | const SDGenericDataset & | rhs | ) |
Copy Assignment Operator.
Same functionality as the copy constructor.
| void seismicdrive::SDGenericDataset::readBlock | ( | int | blocknum, |
| char * | data, | ||
| size_t | offset, | ||
| size_t | numBytes | ||
| ) |
Read a block of data.
This method reads a block of data specified by the block number. It expects the size of the data to read in bytes. This method does not check the crc32c.
| blocknum | should be in the range 0..getBlockNum()-1 |
| data | is a buffer where read data will be saved (pre-allocated) |
| offset | is the starting reading offset |
| numBytes | is the size in byte of the data to read |
| void seismicdrive::SDGenericDataset::readBlock | ( | int | blocknum, |
| char * | data, | ||
| size_t & | len | ||
| ) |
Read a block of data.
This method reads a block of data specified by the block number. This method does check the crc32c.
| blocknum | should be in the range 0..getBlockNum()-1 |
| data | is a buffer where read data will be saved (pre-allocated) |
| len | is the param where the reading len will be stored |
| void seismicdrive::SDGenericDataset::readBlock | ( | int | blocknum, |
| char ** | data, | ||
| size_t & | len | ||
| ) |
Read a block of data.
This method reads a block of data specified by the block number. It will overwrite any pre-allocated buffers where the data read is to be stored. This method does check the crc32c. *
| blocknum | should be in the range 0..getBlockNum()-1 |
| data | is a pointer to a buffer where read data will be saved (pre-allocated data will be lost if any) |
| len | is the param where the reading len will be stored |
| void seismicdrive::SDGenericDataset::readBlock | ( | const std::string & | blockName, |
| char * | data, | ||
| size_t | offset, | ||
| size_t | numBytes | ||
| ) |
Read a block of data.
This method reads a block of data specified by the block name. It expects the size of the data to read in bytes. This method does not check the crc32c.
| blockName | is the name of the block to read |
| data | is a buffer where read data will be saved (pre-allocated) |
| offset | is the starting reading offset |
| numBytes | is the size in byte of the data to read |
| void seismicdrive::SDGenericDataset::readBlock | ( | const std::string & | blockName, |
| char * | data, | ||
| size_t & | len | ||
| ) |
Read a block of data.
This method reads a block of data specified by the block name. This method does check the crc32c.
| blockName | is the name of the block to read |
| data | is a buffer where read data will be saved (pre-allocated) |
| len | is the param where the reading len will be stored |
| void seismicdrive::SDGenericDataset::readBlock | ( | const std::string & | blockName, |
| char ** | data, | ||
| size_t & | len | ||
| ) |
Read a block of data.
This method reads a block of data specified by the block number. It will overwrite any pre-allocated buffers where the data read is to be stored. This method does check the crc32c. *
| blockName | is the name of the block to read |
| data | is a pointer to a buffer where read data will be saved (pre-allocated data will be lost if any) |
| len | is the param where the reading len will be stored |
| void seismicdrive::SDGenericDataset::refreshDatasetMetadata | ( | ) |
Refresh the dataset metadata.
Unconditionally refresh the metadata from the SD server. You only need to call this if getCTag() returned false. Calling this method is semantically equivalent to closing the SDGenericDataset instance and opening a new one, but it might be more efficient. In particular, if a file has been deleted and re-created with the same name then neither refresh nor close/re-open will have a problem with that.
usage example:
| void seismicdrive::SDGenericDataset::refreshDatsetMetadata | ( | ) |
Deprecated.
Use refreshDatasetMetadata() instead
| void seismicdrive::SDGenericDataset::setBlockNum | ( | uint64_t | blockNum | ) |
sets the number of a block
This method sets the number of a block directly to the given number.
| blockNum | is the number to be assigned to the block. |
| void seismicdrive::SDGenericDataset::setExponentialRetryBackoffPolicy | ( | const ExponentialRetryBackoffPolicy * | policy, |
| HttpConnectionLink | link = HttpConnectionLink::ANY |
||
| ) |
Set the exponential retry back-off policy.
This method configure the retry back applied policy
| policy | The exponential retry back-off policy settings. |
| HttpConnectionLink | The connection link where this settings must apply (ANY by default) |
NOTE: This method is not thread-safe. Do not call it while more than one thread is accessing this dataset.
usage example:
| void seismicdrive::SDGenericDataset::setHttpContext | ( | const HttpContext * | context = nullptr | ) |
Set the underlying HTTP connection configuration.
This method sets the underlying HTTP connection configuration
| context | the underlying HTTP connection configuration |
usage example:
| void seismicdrive::SDGenericDataset::setHttpContext | ( | const HttpContext * | context, |
| HttpConnectionLink | link | ||
| ) |
Set the underlying HTTP connection configuration.
This method sets the underlying HTTP connection configuration
| context | the underlying HTTP connection configuration |
| HttpConnectionLink | The connection link where this settings must apply (ANY by default) |
NOTE: This method is not thread-safe. Do not call it while more than one thread is accessing this dataset.
usage example:
| void seismicdrive::SDGenericDataset::setMetaData | ( | const std::string & | metadata | ) | const |
Adds user-defined metadata to the dataset.
This method adds the user-defined metadata passed here to the current dataset.
| metadata | is the json stringify metadata |
| error::dataset::Locked |
| void seismicdrive::SDGenericDataset::setReadonlyMode | ( | bool | readonly | ) |
Set the readonly mode for a dataset.
This method set the dataset as readonly if the input parameter "readonly" is true
| error::dataset::Locked | usage example: |
| void seismicdrive::SDGenericDataset::setSeismicMeta | ( | const std::string & | seismicmeta | ) |
Adds 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; SDGenericDataset 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 seismicmeta field does not exist after patch request |
| error::dataset::Locked | ( see above for retries ) |
| void seismicdrive::SDGenericDataset::setSize | ( | uint64_t | size | ) |
Sets the dataset size.
This method sets the size of a dataset to the given number.
| size | is the size to be assigned to the dataset. |
| bool seismicdrive::SDGenericDataset::setStorageTier | ( | const std::string & | tier | ) |
set the storage tier from user
This method will set storage tier base on user input.
| tier | is user provided storage tier. |
| void seismicdrive::SDGenericDataset::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 |
| error::dataset::Locked | if opened in CREATE, OVERWRITE or READ_WRITE mode and Seismic Store received an HTTP Error 423 from service this may happen if
|
The caller must decide whether it's appropriate to retry. error::dataset::Locked should contain enough information to make that decision.
| bool seismicdrive::SDGenericDataset::updateStorageTier | ( | const std::string & | storageTier | ) | const |
| void seismicdrive::SDGenericDataset::upload | ( | const std::string & | filepath, |
| const std::string & | legaltag = "" |
||
| ) | const |
Upload a file into a single object.
Uploads a file as a single object.
| filepath | is the absolute path of the file to upload |
| legaltag | the dataset legaltag |
| void seismicdrive::SDGenericDataset::writeBlock | ( | int | blocknum, |
| const char * | data, | ||
| std::size_t | len, | ||
| bool | check_and_overwrite = false |
||
| ) |
Writes a block of data.
This method writes a block of data (specified with a block number) with a specified length.
| blocknum | is the number of the block (keep it sequential 0...n-1) |
| data | is the block data to write |
| len | is the size in byte of the data to write |
| check_and_overwrite | is a flag that if set to true will force the system to check if a previous block with the same name exist |
| void seismicdrive::SDGenericDataset::writeBlock | ( | const std::string & | blockName, |
| const char * | data, | ||
| std::size_t | len, | ||
| bool | check_and_overwrite = false |
||
| ) |
Writes a block of data.
This method writes a block of data (specified with a block name) with a specified length.
| blockName | is the name of the block to write |
| data | is the block data to write |
| len | is the size in byte of the data to write |
| check_and_overwrite | is a flag that if set to true will force the system to check if a previous block with the same name exist |
|
friend |
1.8.14