Seismic Drive Client API
Public Member Functions | Static Public Member Functions | Friends | List of all members
seismicdrive::SDUtils Class Reference

Seismic Drive Utilities class. More...

#include <SDUtils.h>

Public Member Functions

 SDUtils (SDManager *sdmanager)
 Constructor. More...
 
 ~SDUtils ()
 
 SDUtils (SDUtils &&rhf) noexcept
 Move Constructor. More...
 
SDUtilsoperator= (SDUtils &&rhf) noexcept
 Move Assignment Operator. More...
 
 SDUtils (const SDUtils &rhs)
 Copy Constructor. More...
 
SDUtilsoperator= (const SDUtils &rhs)
 Copy Assignment Operator. More...
 
std::vector< bool > datasetsExist (const std::vector< std::string > &sdfileNames)
 Checks for existance of several files. More...
 
bool datasetExist (const std::string &fileName)
 Deprecated. More...
 
bool datasetExists (const std::string &fileName)
 Checks for existance of a file. More...
 
std::vector< int64_t > datasetsSize (const std::vector< std::string > &sdfileNames)
 Deprecated. More...
 
std::vector< int64_t > datasetSizes (const std::vector< std::string > &sdfileNames)
 Get the file size in bytes of several files. More...
 
int64_t datasetSize (const std::string &fileName)
 Get the file size in bytes. More...
 
void deleteDataset (const std::string &sddatasetname)
 Delete a dataset (objects removed via service) More...
 
void deleteDatasetSync (const std::string &datasetUri)
 Delete a dataset (objects removed via sdk) More...
 
bool blockExists (const std::string &datasetpath, int blocknum) const
 Determines whether a block of data exists in a dataset. More...
 
bool blockExists (const std::string &datasetpath, const std::string &blockName) const
 Determines whether a block of data exists in a dataset. More...
 
std::vector< std::vector< std::string > > readDirectory (const std::string &sddirectorypath) const
 List Datasets and directories in a directory. More...
 
std::pair< std::vector< std::string >, std::vector< std::string > > ls (const std::string &path, std::string &cursor, int limit=10000) const
 list datasets and directories content of a seismic store path. More...
 
std::vector< std::string > datasetList (const std::string &subProjectPath, std::string &cursor, int limit=100) const
 list datasets of a seismic store subProjectPath. More...
 
std::string bulkDelete (const std::string &path) const
 Add a bulk delete request to the operation task queue. More...
 
std::string bulkDeleteSubProjectPath (std::string &subProjectPath) const
 Add a bulk delete request to the operation task queue. More...
 
std::string bulkDeleteDataset (std::string &datasetPath) const
 Add a bulk delete request to the operation task queue. More...
 
BulkDeleteStatus bulkDeleteStatus (const std::string &operationId, const std::string &dataPartitionId) const
 Get the status of a bulk delete operation. More...
 
std::string bulkChangeTier (const std::string &path, const std::string &storageTier) const
 Add a bulk change-tier request to the operation task queue. More...
 
std::string bulkChangeTierSubProjectPath (std::string &subProjectPath, const std::string &storageTier) const
 Add a bulk change-tier request to the operation task queue. More...
 
std::string bulkChangeTierDataset (std::string &datasetPath, const std::string &storageTier) const
 Add a bulk change-tier request to the operation task queue. More...
 
BulkChangeTierStatus bulkChangeTierStatus (const std::string &operationId, const std::string &dataPartitionId) const
 Get the status of a bulk change-tier operation. More...
 
std::string getServiceCloudProivider () const
 Returns the current cloud provider. More...
 
void upload (const std::string &datasetpath, const std::string &filename) const
 
std::string getCreatedDate (const std::string &seistoreDatasetPath) const
 Get dataset created date. More...
 
std::string getLastModifiedDate (const std::string &seistoreDatasetPath) const
 Get dataset last modified date. More...
 
std::string getCreatedBy (const std::string &seistoreDatasetPath) const
 Get dataset "create by". More...
 
std::string getType (const std::string &seistoreDatasetPath) const
 Get dataset type. More...
 
std::string getLegalTag (const std::string &seistoreDatasetPath) const
 Get dataset legal-tag. More...
 
std::string getFileMetaData (const std::string &seistoreDatasetPath) const
 Gets the user-defined filemetadata of the current dataset. More...
 
void datasetUnlock (const std::string &seistoreDatasetPath) const
 Unlock a dataset. More...
 
std::string getOpenSessionID (const std::string &seistoreDatasetPath) const
 Get the dataset open session id. More...
 
bool updateStorageTier (const std::string &sdpath, const std::string &storageTier) const
 

Static Public Member Functions

static bool isSDDatasetPath (const std::string &datasetpath)
 Check if a dataset path is a valid seismic-store dataset path. More...
 

Friends

class SDUtilsTest
 

Detailed Description

Seismic Drive Utilities class.

This class is the utilities class for the seismic-drive namespace.

Constructor & Destructor Documentation

◆ SDUtils() [1/3]

seismicdrive::SDUtils::SDUtils ( SDManager sdmanager)

Constructor.

Parameters
sdmanageris the seismic drive service manager

◆ ~SDUtils()

seismicdrive::SDUtils::~SDUtils ( )

Destructor.

If the file is opened for writing (not READ_ONLY), it will be closed.

◆ SDUtils() [2/3]

seismicdrive::SDUtils::SDUtils ( SDUtils &&  rhf)
noexcept

Move Constructor.

This contructor moves the SDUtils object from the source to the new object and destroy the source object.

◆ SDUtils() [3/3]

seismicdrive::SDUtils::SDUtils ( const SDUtils rhs)

Copy Constructor.

This contructor makes a copy of the SDUtils object from the source to the new object without modifying the source object.

Member Function Documentation

◆ blockExists() [1/2]

bool seismicdrive::SDUtils::blockExists ( const std::string &  datasetpath,
int  blocknum 
) const

Determines whether a block of data exists in a dataset.

This method determines whether a block of data (specified with a block number) exists in a dataset.

Parameters
datasetpathis the seismic drive dataset name ( sd://tenant/subproject/path/dataset )
blocknumis the number of the block
Returns
true if the block exists, otherwise false.

◆ blockExists() [2/2]

bool seismicdrive::SDUtils::blockExists ( const std::string &  datasetpath,
const std::string &  blockName 
) const

Determines whether a block of data exists in a dataset.

This method determines whether a block of data (specified with a block number) exists in a dataset.

Parameters
datasetpathis the seismic drive dataset name ( sd://tenant/subproject/path/dataset )
blockNameis the name of the block
Returns
true if the block exists, otherwise false.

◆ bulkChangeTier()

std::string seismicdrive::SDUtils::bulkChangeTier ( const std::string &  path,
const std::string &  storageTier 
) const

Add a bulk change-tier request to the operation task queue.

This method return a operation-id that can be used to track the progress of the request.

  • For a subProject path the string must end with a '/'. For a single dataset do not add '/' to the end
    Parameters
    paththe seismic drive subProject path ( sd://tenant/subproject/path/ )
    Returns
    a string containing the operation-id
    usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkChangeTier(path); std::cout<< response <<'
';

◆ bulkChangeTierDataset()

std::string seismicdrive::SDUtils::bulkChangeTierDataset ( std::string &  datasetPath,
const std::string &  storageTier 
) const

Add a bulk change-tier request to the operation task queue.

This method return a operation-id that can be used to track the progress of the request.

Parameters
datasetPaththe seismic drive datasetPath path ( sd://tenant/subproject/path/dataset )
Returns
a string containing the operation-id

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkChangeTierDataset(datasetPath); std::cout<< response <<'
';

◆ bulkChangeTierStatus()

BulkChangeTierStatus seismicdrive::SDUtils::bulkChangeTierStatus ( const std::string &  operationId,
const std::string &  dataPartitionId 
) const

Get the status of a bulk change-tier operation.

This method returns the status a bulk delete request.

Parameters
operationIdthe seismic drive subProject path ( sd://tenant/subproject/path )
dataPartitionIdthe seismic drive subProject path ( sd://tenant/subproject/path )
Returns
a bulkChangeTierStatus structure that contains containing a requests operation-id, status, and created_at time.

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkChangeTierStatus(operationId, dataPartitionId); std::cout << response.status <<'
';

◆ bulkChangeTierSubProjectPath()

std::string seismicdrive::SDUtils::bulkChangeTierSubProjectPath ( std::string &  subProjectPath,
const std::string &  storageTier 
) const

Add a bulk change-tier request to the operation task queue.

This method return a operation-id that can be used to track the progress of the request.

Parameters
subProjectPaththe seismic drive subProject path ( sd://tenant/subproject/path/ )
Returns
a string containing the operation-id

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkChangeTierSubProjectPath(subProjectPath); std::cout<< response <<'
';

◆ bulkDelete()

std::string seismicdrive::SDUtils::bulkDelete ( const std::string &  path) const

Add a bulk delete request to the operation task queue.

This method return a operation-id that can be used to track the progress of the request.

For a subProject path the string must end with a '/'. For a single dataset do not add '/' to the end

Parameters
paththe seismic drive subProject path ( sd://tenant/subproject/path/ )
Returns
a string containing the operation-id

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkDelete(path); std::cout<< response <<'
';

◆ bulkDeleteDataset()

std::string seismicdrive::SDUtils::bulkDeleteDataset ( std::string &  datasetPath) const

Add a bulk delete request to the operation task queue.

This method return a operation-id that can be used to track the progress of the request.

Parameters
datasetPaththe seismic drive datasetPath path ( sd://tenant/subproject/path/dataset )
Returns
a string containing the operation-id

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkDeleteDataset(datasetPath); std::cout<< response <<'
';

◆ bulkDeleteStatus()

BulkDeleteStatus seismicdrive::SDUtils::bulkDeleteStatus ( const std::string &  operationId,
const std::string &  dataPartitionId 
) const

Get the status of a bulk delete operation.

This method returns the status a bulk delete request.

Parameters
operationIdthe seismic drive subProject path ( sd://tenant/subproject/path )
dataPartitionIdthe seismic drive subProject path ( sd://tenant/subproject/path )
Returns
a BulkDeleteStatus structure that contains containing a requests operation-id, status, and created_at time.

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkDeleteStatus(operationId, dataPartitionId); std::cout << response.status <<'
';

◆ bulkDeleteSubProjectPath()

std::string seismicdrive::SDUtils::bulkDeleteSubProjectPath ( std::string &  subProjectPath) const

Add a bulk delete request to the operation task queue.

This method return a operation-id that can be used to track the progress of the request.

Parameters
subProjectPaththe seismic drive subProject path ( sd://tenant/subproject/path/ )
Returns
a string containing the operation-id

usage example:

SDManager manager; SDutils utils(&manager);

auto response = utils.bulkDeleteSubProjectPath(subProjectPath); std::cout<< response <<'
';

◆ datasetExist()

bool seismicdrive::SDUtils::datasetExist ( const std::string &  fileName)

Deprecated.

Use datasetExists() instead

◆ datasetExists()

bool seismicdrive::SDUtils::datasetExists ( const std::string &  fileName)

Checks for existance of a file.

This method checks if a single file exists in cloud storage. This is much slower per file than checking all file names together.

Parameters
fileNamename of file to check ( sd://tenant/subproject/path/dataset )
Returns
true if file exists

◆ datasetList()

std::vector<std::string> seismicdrive::SDUtils::datasetList ( const std::string &  subProjectPath,
std::string &  cursor,
int  limit = 100 
) const

list datasets of a seismic store subProjectPath.

This method return a list datasets of a seismic store subProjectPath.

Parameters
subProjectPaththe seismic drive subProject path ( sd://tenant/subproject/ )
cursorthe next page cursor (empty will return the first page)
limitthe results max page size (100 default)
Returns
a vector of datasets as string

usage example:

SDManager manager; SDutils utils(&manager); std::string nextPageToken; do { auto response = utils.datasetList(path, nextPageToken, 100); for(auto &item: response.first) { std::cout<<item<<'
'; } } while(!nextPageToken.empty())

◆ datasetsExist()

std::vector<bool> seismicdrive::SDUtils::datasetsExist ( const std::vector< std::string > &  sdfileNames)

Checks for existance of several files.

This method checks if a list of filenames exists in cloud storage. This is much faster than checking each file name separately

Parameters
sdfileNameslist of dataset path ( sd://tenant/subproject/path/dataset ). All sdfileNames must refer to the same subproject (must have the same sd://tenant/subproject prefix)
Returns
a vector boolean (true if the dataset exists false if not)

◆ datasetSize()

int64_t seismicdrive::SDUtils::datasetSize ( const std::string &  fileName)

Get the file size in bytes.

This method gets the size in bytes of one single dataset. This method returns -1 if file does not exist or is empty.

Parameters
fileNamename of file to get size ( sd://tenant/subproject/path/dataset )
Returns
64 bit integer size in bytes

◆ datasetSizes()

std::vector<int64_t> seismicdrive::SDUtils::datasetSizes ( const std::vector< std::string > &  sdfileNames)

Get the file size in bytes of several files.

This method gets the size of a list of datasets in bytes. The method returns -1 for files that do not exist.

Parameters
sdfileNameslist of dataset path ( sd://tenant/subproject/path/dataset ) All sdfileNames must refer to the same subproject (must have the same sd://tenant/subproject prefix)
Returns
a vector with the required datasets sizes

◆ datasetsSize()

std::vector<int64_t> seismicdrive::SDUtils::datasetsSize ( const std::vector< std::string > &  sdfileNames)

Deprecated.

Use datasetSizes() instead

◆ datasetUnlock()

void seismicdrive::SDUtils::datasetUnlock ( const std::string &  seistoreDatasetPath) const

Unlock a dataset.

This method can be used to unlock a dataset in seismic store

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • utils.datasetUnlock("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path

◆ deleteDataset()

void seismicdrive::SDUtils::deleteDataset ( const std::string &  sddatasetname)

Delete a dataset (objects removed via service)

This method is used to delete a dataset given its full path name. The objects deletion process will delegate to SDMS service.

Parameters
sddatasetnameis the seismic drive dataset name ( sd://tenant/subproject/path/dataset )
Exceptions
error::dataset::Lockedoccurs in certain circumstances ( 502 timeout by proxy, for example ) since these are not automatically retried by the library and the caller needs to decide whether it's appropriate to wait and retry

◆ deleteDatasetSync()

void seismicdrive::SDUtils::deleteDatasetSync ( const std::string &  datasetUri)

Delete a dataset (objects removed via sdk)

This method is used to delete a dataset given its full path name. The objects deletion process will directly performed by the sdapi sdk.

Parameters
datasetUriis the seismic dms dataset uri path ( sd://tenant/subproject/path/dataset )

◆ getCreatedBy()

std::string seismicdrive::SDUtils::getCreatedBy ( const std::string &  seistoreDatasetPath) const

Get dataset "create by".

This method can be used to retrieve the "created by" field associated with a dataset.

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • auto createdby = utils.getCreatedBy("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path
Returns
The dataset created by field

◆ getCreatedDate()

std::string seismicdrive::SDUtils::getCreatedDate ( const std::string &  seistoreDatasetPath) const

Get dataset created date.

This method can be used to retrieve the dataset creation date.

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • auto cdate = utils.getCreatedDate("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path
Returns
The dataset created date

◆ getFileMetaData()

std::string seismicdrive::SDUtils::getFileMetaData ( const std::string &  seistoreDatasetPath) const

Gets the user-defined filemetadata of the current dataset.

This method is an accessor used to get the user-defined filemetadata from the current dataset

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • auto filemetadata = utils.getFileMetaData("sd://tenant/subproject/data");
Returns
the stringify json filemetadata of the current dataset

◆ getLastModifiedDate()

std::string seismicdrive::SDUtils::getLastModifiedDate ( const std::string &  seistoreDatasetPath) const

Get dataset last modified date.

This method can be used to retrieve the dataset last modified date.

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • auto cdate = utils.getLastModifiedDate("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path
Returns
The dataset last modified date

◆ getLegalTag()

std::string seismicdrive::SDUtils::getLegalTag ( const std::string &  seistoreDatasetPath) const

Get dataset legal-tag.

This method can be used to retrieve the dataset type associated with a dataset.

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • auto legalTag = utils.getLegalTag("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path
Returns
the dataset legal-tag.

◆ getOpenSessionID()

std::string seismicdrive::SDUtils::getOpenSessionID ( const std::string &  seistoreDatasetPath) const

Get the dataset open session id.

This method can be used to get the dataset open session id.

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • utils.getOpenSessionID("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path
Returns
The dataset open session ID.
  • if opened for read, starts with 'R'
  • if opened for write, starts with 'W'
  • if closed, empty string

◆ getServiceCloudProivider()

std::string seismicdrive::SDUtils::getServiceCloudProivider ( ) const

Returns the current cloud provider.

Returns
a std::string with the current cloud provider.

◆ getType()

std::string seismicdrive::SDUtils::getType ( const std::string &  seistoreDatasetPath) const

Get dataset type.

This method can be used to retrieve the dataset type associated with a dataset.

usage example:

  • SDManager sdmanager;
  • SDUtils utils(&sdmanager);
  • auto type = utils.getType("sd://tenant/subproject/data");
Parameters
seistoreDatasetPathis the seismic-store dataset path
Returns
the dataset type.

◆ isSDDatasetPath()

static bool seismicdrive::SDUtils::isSDDatasetPath ( const std::string &  datasetpath)
static

Check if a dataset path is a valid seismic-store dataset path.

This method checks if a given sd path exits in cloud storage.

Parameters
datasetpathis the seismic-store dataset path to validate
Returns
true if the path exists, and false if it does not

◆ ls()

std::pair<std::vector<std::string>, std::vector<std::string> > seismicdrive::SDUtils::ls ( const std::string &  path,
std::string &  cursor,
int  limit = 10000 
) const

list datasets and directories content of a seismic store path.

This method return a list of files and folders of a seismic store path.

Parameters
paththe seismic drive directory path ( sd://tenant/subproject/path )
cursorthe next page cursor (empty will return the first page)
limitthe results max page size (10000 default)
Returns
a pair object result with folders (first), returned in full with the first page, and datasets (second)

usage example:

SDManager manager; SDutils utils(&manager); std::string nextPageToken; do { auto response = utils.ls("sd://tenant/subproject/path", nextPageToken); for(auto &item: response.first) { std::cout<<item<<'
'; } for(auto &item: response.second) { std::cout<<item<<'
'; } } while(!cursor.empty())

◆ operator=() [1/2]

SDUtils& seismicdrive::SDUtils::operator= ( SDUtils &&  rhf)
noexcept

Move Assignment Operator.

Same functionality as the move constructor.

◆ operator=() [2/2]

SDUtils& seismicdrive::SDUtils::operator= ( const SDUtils rhs)

Copy Assignment Operator.

Same functionality as the copy constructor.

◆ readDirectory()

std::vector<std::vector<std::string> > seismicdrive::SDUtils::readDirectory ( const std::string &  sddirectorypath) const

List Datasets and directories in a directory.

This method return a list of files and folders in a given full path directory.

Parameters
sddirectorypathis the seismic drive directory path ( sd://tenant/subproject/path )
Returns
a list of the list of names in the directory

◆ updateStorageTier()

bool seismicdrive::SDUtils::updateStorageTier ( const std::string &  sdpath,
const std::string &  storageTier 
) const

◆ upload()

void seismicdrive::SDUtils::upload ( const std::string &  datasetpath,
const std::string &  filename 
) const

Friends And Related Function Documentation

◆ SDUtilsTest

friend class SDUtilsTest
friend

The documentation for this class was generated from the following file: