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

This class allows access to hierarchical datasets in cloud storage. More...

#include <SDHierarchicalDatasetAccessor.h>

Public Member Functions

 SDHierarchicalDatasetAccessor (const SDDatasetDisposition disposition, Storage *storage, const std::string &gcsUrl, const std::string tag)
 
 ~SDHierarchicalDatasetAccessor ()
 
 SDHierarchicalDatasetAccessor (SDHierarchicalDatasetAccessor &&sdhd) noexcept
 Move Constructor. More...
 
SDHierarchicalDatasetAccessoroperator= (SDHierarchicalDatasetAccessor &&sdhd) noexcept
 Move Assignment Operator. More...
 
 SDHierarchicalDatasetAccessor (const SDHierarchicalDatasetAccessor &op)
 Copy Constructor. More...
 
SDHierarchicalDatasetAccessoroperator= (const SDHierarchicalDatasetAccessor &op)
 Copy Assignment Operator. More...
 
std::string get_tag () const
 Return accessor tag. More...
 
uint64_t node_add (const std::string &nodeName)
 Adds a new Node. More...
 
uint64_t node_get (const std::string &nodeName) const
 Gets a Node. More...
 
std::size_t object_write (const uint64_t nodeID, const std::string &objectName, const char *buffer, const std::size_t size)
 Write an object (block of data/bytes) to gcs. More...
 
void object_read (const uint64_t nodeID, const std::string &objectName, char *buffer, size_t size)
 Read an object (block of data/bytes) from gcs. More...
 
void object_delete (const uint64_t nodeID, const std::string &objectName)
 Delete an object (block of data/bytes) from gcs. More...
 
uint64_t node_count () const
 gets the node count. More...
 
std::size_t tot_byte_size () const
 gets the total size of the dataset in bytes. More...
 
std::vector< SDHierarchicalMetaDatametadata_get () const
 gets the metadatas for all stored object. More...
 
void metadata_set (const std::vector< SDHierarchicalMetaData > *meta)
 Add new metadata. More...
 
std::vector< std::string > node_names () const
 gets the names of all the nodes More...
 
std::vector< std::size_t > node_sizes () const
 gets the size of all the nodes More...
 
std::string node_name (const uint64_t nodeID) const
 gets the node name. More...
 
std::size_t node_size (const uint64_t nodeID) const
 gets the node size in bytes. More...
 
uint64_t object_count (const uint64_t nodeID) const
 gets the objects count. More...
 
std::vector< std::string > object_names (const uint64_t nodeID) const
 gets the objects names. More...
 
std::vector< std::size_t > object_sizes (const uint64_t nodeID) const
 gets the objects sizes. More...
 
std::size_t object_size (const uint64_t nodeID, const std::string &object_name) const
 gets the objects sizes. More...
 
void objects_info (const uint64_t nodeID, std::vector< std::string > &names, std::vector< std::size_t > &sizes)
 gets the objects' names and sizes. More...
 

Friends

class SDHierarchicalDatasetAcsTest
 

Detailed Description

This class allows access to hierarchical datasets in cloud storage.

This class provide basics methods to read/write blocks of data to cloud storage

Constructor & Destructor Documentation

◆ SDHierarchicalDatasetAccessor() [1/3]

seismicdrive::SDHierarchicalDatasetAccessor::SDHierarchicalDatasetAccessor ( const SDDatasetDisposition  disposition,
Storage *  storage,
const std::string &  gcsUrl,
const std::string  tag 
)

Constructor.

Parameters
dispositionis the disposition mode
storageis a cloud provider specific Storage object, e.g. an AzureStorage instance
gcsUrlis the url of the root node in gcs (gs://bucket_name/root_folder)
tagis an optional tag that can be assigned to the class for debugging purpose

◆ ~SDHierarchicalDatasetAccessor()

seismicdrive::SDHierarchicalDatasetAccessor::~SDHierarchicalDatasetAccessor ( )

Destructor.

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

◆ SDHierarchicalDatasetAccessor() [2/3]

seismicdrive::SDHierarchicalDatasetAccessor::SDHierarchicalDatasetAccessor ( SDHierarchicalDatasetAccessor &&  sdhd)
noexcept

Move Constructor.

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

◆ SDHierarchicalDatasetAccessor() [3/3]

seismicdrive::SDHierarchicalDatasetAccessor::SDHierarchicalDatasetAccessor ( const SDHierarchicalDatasetAccessor op)

Copy Constructor.

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

Member Function Documentation

◆ get_tag()

std::string seismicdrive::SDHierarchicalDatasetAccessor::get_tag ( ) const

Return accessor tag.

This method returns the hierarchical dataset accessor's tag.

Returns
the accessor tag.

◆ metadata_get()

std::vector<SDHierarchicalMetaData> seismicdrive::SDHierarchicalDatasetAccessor::metadata_get ( ) const

gets the metadatas for all stored object.

This method is used to get the metadata of all objects in the current hierarchical dataset in bytes.

Returns
a vector of metdata for the stored objects.

◆ metadata_set()

void seismicdrive::SDHierarchicalDatasetAccessor::metadata_set ( const std::vector< SDHierarchicalMetaData > *  meta)

Add new metadata.

Adds new user-defined metadata into the hierarchical dataset

Parameters
metais the metadata to add

◆ node_add()

uint64_t seismicdrive::SDHierarchicalDatasetAccessor::node_add ( const std::string &  nodeName)

Adds a new Node.

This method add a new node to the hierarchical structure.

Parameters
nodeNameis the name of the new node.
Returns
index of the added node in the hierarchical structure.

◆ node_count()

uint64_t seismicdrive::SDHierarchicalDatasetAccessor::node_count ( ) const

gets the node count.

This method is used to get the number of nodes in the current dataset.

Returns
the number of node currently stored in the hierarchy.

◆ node_get()

uint64_t seismicdrive::SDHierarchicalDatasetAccessor::node_get ( const std::string &  nodeName) const

Gets a Node.

This method gets a node from the hierarchical structure.

Parameters
nodeNameis the name of the new node.
Returns
index of the added node in the hierarchical structure.

◆ node_name()

std::string seismicdrive::SDHierarchicalDatasetAccessor::node_name ( const uint64_t  nodeID) const

gets the node name.

This method gets the node name given its ID.

Parameters
nodeIDis the ID of the node.
Returns
the node name of the passed node ID

◆ node_names()

std::vector<std::string> seismicdrive::SDHierarchicalDatasetAccessor::node_names ( ) const

gets the names of all the nodes

This method gets a list of the names of all nodes in the hierarchical dataset.

Returns
the nodes name list.

◆ node_size()

std::size_t seismicdrive::SDHierarchicalDatasetAccessor::node_size ( const uint64_t  nodeID) const

gets the node size in bytes.

This method gets the node size given its ID.

Parameters
nodeIDis the ID of the node.
Returns
the node size in bytes of the passed node ID

◆ node_sizes()

std::vector<std::size_t> seismicdrive::SDHierarchicalDatasetAccessor::node_sizes ( ) const

gets the size of all the nodes

This method gets a list of the sizes of all nodes in the hierarchical dataset in bytes.

Returns
the nodes size list in bytes.

◆ object_count()

uint64_t seismicdrive::SDHierarchicalDatasetAccessor::object_count ( const uint64_t  nodeID) const

gets the objects count.

This method gets the number of objects in a node given its ID.

Parameters
nodeIDis the ID of the node.
Returns
the number of object of the node.

◆ object_delete()

void seismicdrive::SDHierarchicalDatasetAccessor::object_delete ( const uint64_t  nodeID,
const std::string &  objectName 
)

Delete an object (block of data/bytes) from gcs.

This method deletes an object from GCS given its name and node index.

Parameters
nodeIDis the index of the node.
objectNameis the name of the object.

◆ object_names()

std::vector<std::string> seismicdrive::SDHierarchicalDatasetAccessor::object_names ( const uint64_t  nodeID) const

gets the objects names.

This method gets the names of objects in a node given its ID.

Parameters
nodeIDis the ID of the node.
Returns
a list of the objects names for a given node.

◆ object_read()

void seismicdrive::SDHierarchicalDatasetAccessor::object_read ( const uint64_t  nodeID,
const std::string &  objectName,
char *  buffer,
size_t  size 
)

Read an object (block of data/bytes) from gcs.

This method reads a block of data (specified with a index of the node) with a specified length.

Parameters
nodeIDis the index of the node.
objectNameis the name of the object.
bufferis the buffer where read data will be stored.
sizeis the number of byte to read.

◆ object_size()

std::size_t seismicdrive::SDHierarchicalDatasetAccessor::object_size ( const uint64_t  nodeID,
const std::string &  object_name 
) const

gets the objects sizes.

This method gets the size in byes of an object in a node given the object name and the node ID.

Parameters
nodeIDis the ID of the node.
object_nameis the name of the object.
Returns
the object size in byte for a given node. -1 if the object doesn't exist

◆ object_sizes()

std::vector<std::size_t> seismicdrive::SDHierarchicalDatasetAccessor::object_sizes ( const uint64_t  nodeID) const

gets the objects sizes.

This method gets the size in byes of all objects in a node given its ID.

Parameters
nodeIDis the ID of the node.
Returns
a list of the objects sizes in bytes for a given node.

◆ object_write()

std::size_t seismicdrive::SDHierarchicalDatasetAccessor::object_write ( const uint64_t  nodeID,
const std::string &  objectName,
const char *  buffer,
const std::size_t  size 
)

Write an object (block of data/bytes) to gcs.

This method writes a block of data (specified with a index of the node) with a specified length.

Parameters
nodeIDis the index of the node.
objectNameis the name of the object.
bufferis the data to write.
sizeis the number of byte to write (buffer size).
Returns
the number of bytes written to GCS.

◆ objects_info()

void seismicdrive::SDHierarchicalDatasetAccessor::objects_info ( const uint64_t  nodeID,
std::vector< std::string > &  names,
std::vector< std::size_t > &  sizes 
)

gets the objects' names and sizes.

This method gets the names and sizes of all objects stored in a node given its ID.

Parameters
nodeIDis the ID of the node.
namesis the vector where the names will be stored.
sizesis the vector where the sizes will be stored.
Returns
the objects name and size list in byte for a given node.

◆ operator=() [1/2]

SDHierarchicalDatasetAccessor& seismicdrive::SDHierarchicalDatasetAccessor::operator= ( SDHierarchicalDatasetAccessor &&  sdhd)
noexcept

Move Assignment Operator.

Same functionality as the move constructor.

◆ operator=() [2/2]

SDHierarchicalDatasetAccessor& seismicdrive::SDHierarchicalDatasetAccessor::operator= ( const SDHierarchicalDatasetAccessor op)

Copy Assignment Operator.

Same functionality as the copy constructor.

◆ tot_byte_size()

std::size_t seismicdrive::SDHierarchicalDatasetAccessor::tot_byte_size ( ) const

gets the total size of the dataset in bytes.

This method is used to get the total size of the current hierarchical dataset in bytes.

Returns
the total size in byte of the stored objects.

Friends And Related Function Documentation

◆ SDHierarchicalDatasetAcsTest

friend class SDHierarchicalDatasetAcsTest
friend

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