NCBI C++ ToolKit
|
Classes | |
class | CNetStorageException |
Exception class for use by CNetStorage, CNetStorageByKey, and CNetStorageObject. More... | |
class | CNetStorageObjectInfo |
Detailed information about a CNetStorage object. More... | |
class | CNetStorageObject |
Basic network-based data object I/O. More... | |
class | CNetStorage |
Network BLOB storage API. More... | |
class | CNetStorageByKey |
Network BLOB storage API – with access by user-defined keys. More... | |
Typedefs | |
typedef SNetStorageObjectInfoImpl * | CNetStorageObjectInfo::TInstance |
typedef unsigned | TNetStorageFlags |
Bitwise OR of ENetStorageFlags. More... | |
typedef SNetStorageObjectImpl * | CNetStorageObject::TInstance |
typedef list< string > | CNetStorageObject::TAttributeList |
Get list of names of all attributes set on this object. More... | |
typedef function< void(CJsonNode)> | TNetStorageProgressCb |
Progress callback. More... | |
typedef SNetStorageImpl * | CNetStorage::TInstance |
typedef SNetStorageByKeyImpl * | CNetStorageByKey::TInstance |
typedef list<string> CNetStorageObject::TAttributeList |
Get list of names of all attributes set on this object.
To get value of particular attribute, GetAttribute should be called.
If | the underlying storage does not support attributes, a CNetStorageException will be thrown. |
Definition at line 300 of file netstorage.hpp.
Definition at line 97 of file netstorage.hpp.
Definition at line 168 of file netstorage.hpp.
typedef SNetStorageImpl* CNetStorage::TInstance |
Definition at line 369 of file netstorage.hpp.
Definition at line 472 of file netstorage.hpp.
typedef unsigned TNetStorageFlags |
Bitwise OR of ENetStorageFlags.
Definition at line 147 of file netstorage.hpp.
typedef function<void(CJsonNode)> TNetStorageProgressCb |
Progress callback.
CJsonNode | progress info (depends on operation) |
Definition at line 348 of file netstorage.hpp.
Definition at line 69 of file netstorage.hpp.
enum ENetStorageFlags |
Blob storage allocation and access strategy.
Definition at line 129 of file netstorage.hpp.
Enumeration that indicates the current location of the object.
Enumerator | |
---|---|
eNFL_Unknown | |
eNFL_NotFound | |
eNFL_NetCache | |
eNFL_FileTrack |
Definition at line 86 of file netstorage.hpp.
Result returned by Remove() methods.
Enumerator | |
---|---|
eNSTRR_NotFound | Removing failed due to object not found. |
eNSTRR_Removed | Object has been removed successfully. |
Definition at line 355 of file netstorage.hpp.
void CNetStorageObject::Close | ( | void | ) |
Finalize and close the current object stream.
If the operation is successful, then the state (including the current position, if applicable) of the 'CNetStorageObject' is reset, and you can start reading from (or writing to) the object all anew, as if the 'CNetStorageObject' object had just been created by 'CNetStorage'.
CNetStorageException | If cannot finalize writing operations |
Definition at line 321 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CProjectStorage::Clone(), CGridCommandLineInterfaceApp::Cmd_Download(), CGridCommandLineInterfaceApp::Cmd_Upload(), CNetCacheBlobFetchApp::ProcessRequest(), CNetStorageObject::Read(), CProjectStorage::SaveObject(), CProjectStorage::SaveProject(), CProjectStorage::SaveRawData(), CProjectStorage::SaveStream(), CProjectStorage::SaveString(), CNetStorageHandler::x_ProcessRead(), CNetStorageHandler::x_SendWriteConfirmation(), and SNetStorageObjectRWStream::~SNetStorageObjectRWStream().
|
explicit |
Construct a CNetStorage object.
init_string | Initialization string that contains client identification, network service locations, etc. The string must be a sequence of apersand-separated pairs of attribute names and their values. Within each pair, the name and the value of the attribute must be separated by the equality sign, and the value must be URL-encoded. The following attributes are recoginzed: * namespace - Application domain. This parameter is required. * client - Application name. If omitted, generated from the executable pathname. * nst - NetStorage server address or LBSM service name pointing to a group of NetStorage servers. * metadata - Whether to request or disable the metadata DB. Valid options:
|
default_flags | Default storage preferences for the created objects. |
Definition at line 326 of file netstorage.cpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
explicit |
Construct a CNetStorageByKey object.
init_string | Initialization string that contains client identification, network service locations, etc. The string must be a sequence of apersand-separated pairs of attribute names and their values. Within each pair, the name and the value of the attribute must be separated by the equality sign, and the value must be URL-encoded. The following attributes are recoginzed: * namespace - Namespace name, within which the keys passed to the methods of this class must be unique. This parameter is required. * domain - Synonym for "namespace". * client - Application name. * nst - NetStorage server address or LBSM service name pointing to a group of NetStorage servers. Example: "client=MyApp&nst=NST_Test&namespace=myapp" |
default_flags | Default storage preferences for objects created by this object. |
Definition at line 361 of file netstorage.cpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
CNetStorageObject CNetStorage::Create | ( | TNetStorageFlags | flags = 0 | ) |
Create new NetStorage object.
The physical storage is allocated during the first CNetStorageObject::Write() operation.
flags | Combination of flags that defines object location (storage) and caching |
Definition at line 333 of file netstorage.cpp.
References flags, and CNetStorage::m_Impl.
Referenced by CProjectStorage::Clone(), CGridCommandLineInterfaceApp::GetNetStorageObject(), CProjectStorage::SaveRawData(), and CProjectStorage::x_GetOutputStream().
bool CNetStorageObject::Eof | ( | void | ) |
Check if the last Read() has hit EOF.
CNetStorageException | If the object doesn't exist, or if 'CNetStorageObject' is in writing mode |
Definition at line 260 of file netstorage.cpp.
References SNetStorageObjectIoMode::eBuffer, SNetStorageObjectIoMode::eEof, and CNetStorageObject::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_Download(), CNetCacheBlobFetchApp::ProcessRequest(), CNetStorageObject::Read(), and CNetStorageHandler::x_ProcessRead().
bool CNetStorageByKey::Exists | ( | const string & | key, |
TNetStorageFlags | flags = 0 |
||
) |
Check if a object with the specified key exists in the storage hinted by 'flags'.
Definition at line 383 of file netstorage.cpp.
References flags, ncbi::grid::netcache::search::fields::key, and CNetStorageByKey::Open().
Check if the object addressed by 'object_loc' exists.
object_loc | File to check for existence |
Definition at line 349 of file netstorage.cpp.
References CNetStorage::Open().
Referenced by CProjectStorage::Exists(), and CNetStorageGCApp::x_CheckExpiration().
Get the current value of the specified attribute.
Attribute values are not cached by this method.
If | the underlying storage does not support attributes, a CNetStorageException will be thrown. |
Definition at line 300 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_GetAttr(), and NAutomation::SNetStorageObject::ExecGetAttr().
CNetStorageObject::TAttributeList CNetStorageObject::GetAttributeList | ( | ) | const |
Definition at line 295 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_GetAttrList(), and NAutomation::SNetStorageObject::ExecAttrList().
CTime CNetStorageObjectInfo::GetCreationTime | ( | ) | const |
Return object creation time reported by the storage back-end.
Definition at line 260 of file netstorageobjectinfo.cpp.
References CNetStorageObjectInfo::m_Impl.
|
overridevirtual |
Get error code interpreted as text.
Reimplemented from CNetServiceException.
Definition at line 58 of file netstorage_rpc.cpp.
References CNetStorageException::eAuthError, CNetStorageException::eExpired, CNetStorageException::eInterrupted, CNetStorageException::eInvalidArg, CNetStorageException::eIOError, CNetStorageException::eNotExists, CNetStorageException::eNotSupported, CNetStorageException::eServerError, CNetStorageException::eTimeout, CNetStorageException::eUnknown, CException::GetErrCode(), and CException::GetErrCodeString().
CNetStorageObjectInfo CNetStorageObject::GetInfo | ( | void | ) |
Return detailed information about the object.
CNetStorageException | on error |
Definition at line 311 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_NetStorageObjectInfo(), NAutomation::SNetStorageObject::ExecInfo(), and CNetStorageHandler::x_ProcessGetObjectInfo().
string CNetStorageObject::GetLoc | ( | void | ) | const |
Return object locator.
Definition at line 224 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CProjectStorage::Clone(), CGridCommandLineInterfaceApp::Cmd_Upload(), CProjectStorage::SaveRawData(), CProjectStorage::x_GetOutputStream(), CNetStorageHandler::x_OnData(), CNetStorageHandler::x_ProcessCreate(), and CNetStorageHandler::x_SendWriteConfirmation().
TLocation CNetStorageObjectInfo::GetLocation | ( | void | ) | const |
Return a ENetStorageObjectLocation constant that corresponds to the storage back-end where the object currently resides.
If the object cannot be found in any of the predictable locations, eNFL_NotFound is returned. If the object is found, the returned value reflects the storage back-end that supplied the rest of information about the object.
Definition at line 250 of file netstorageobjectinfo.cpp.
References CNetStorageObjectInfo::m_Impl.
CJsonNode CNetStorageObjectInfo::GetObjectLocInfo | ( | ) | const |
Return a JSON object containing the fields of the object ID.
A valid value is returned even if GetLocation() == eNFL_NotFound.
Definition at line 255 of file netstorageobjectinfo.cpp.
References CNetStorageObjectInfo::m_Impl.
IReader & CNetStorageObject::GetReader | ( | ) |
Get a reference to the IReader interface for reading the data stream of this object.
The returned reference can be fed to a CRStream object to turn it into an std::istream. In this case, please make sure the CRWStreambuf::fOwnReader flag is NOT used. It is, however, better to use the GetRWStream() method for this purpose.
Definition at line 254 of file netstorage.cpp.
References SNetStorageObjectIoMode::eIReaderIWriter, SNetStorageObjectIoMode::eRead, and CNetStorageObject::m_Impl.
Referenced by CProjectStorage::Clone().
CNcbiIostream * CNetStorageObject::GetRWStream | ( | ) |
Get an iostream instance for reading the data stream of this NetStorage object as well as storing data into this object.
The returned iostream object must be deleted by the caller.
Definition at line 284 of file netstorage.cpp.
References SNetStorageObjectIoMode::eAnyMth, SNetStorageObjectIoMode::eIoStream, and CNetStorageObject::m_Impl.
Referenced by CProjectStorage::GetIstream(), and CProjectStorage::x_GetOutputStream().
Uint8 CNetStorageObjectInfo::GetSize | ( | void | ) | const |
Return object size in bytes.
Definition at line 265 of file netstorageobjectinfo.cpp.
References CNetStorageObjectInfo::m_Impl.
Uint8 CNetStorageObject::GetSize | ( | void | ) |
Return size of the object.
CNetStorageException | On any error (including if the object does not yet exist) |
Definition at line 290 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CNetStorageHandler::x_ProcessGetSize().
CJsonNode CNetStorageObjectInfo::GetStorageSpecificInfo | ( | ) | const |
Return a JSON object containing storage-specific information about the object.
Definition at line 270 of file netstorageobjectinfo.cpp.
References CNetStorageObjectInfo::m_Impl.
IEmbeddedStreamWriter & CNetStorageObject::GetWriter | ( | ) |
Get a reference to the IWriter interface for storing data into this object.
The returned reference can be fed to a CWStream object to turn it into an std::ostream. In this case, please make sure the CRWStreambuf::fOwnWriter flag is NOT used. It is, however, better to use the GetRWStream() method for this purpose.
Definition at line 278 of file netstorage.cpp.
References SNetStorageObjectIoMode::eIReaderIWriter, SNetStorageObjectIoMode::eWrite, and CNetStorageObject::m_Impl.
Referenced by CProjectStorage::Clone(), and CProjectStorage::SaveRawData().
CNetStorageException::NCBI_EXCEPTION_DEFAULT | ( | CNetStorageException | , |
CNetServiceException | |||
) |
CNetStorageObject CNetStorage::Open | ( | const string & | object_loc | ) |
Open an existing NetStorage object for reading.
object_loc | File to open |
Definition at line 338 of file netstorage.cpp.
References CNetStorage::m_Impl.
Referenced by CProjectStorage::Clone(), CNetStorage::Exists(), CProjectStorage::GetIstream(), CGridCommandLineInterfaceApp::GetNetStorageObject(), CNetCacheBlobFetchApp::ProcessRequest(), CNetStorage::Relocate(), CNetStorage::Remove(), CProjectStorage::SaveRawData(), and CProjectStorage::x_GetOutputStream().
CNetStorageObject CNetStorageByKey::Open | ( | const string & | unique_key, |
TNetStorageFlags | flags = 0 |
||
) |
Create a new object or open an existing object using the supplied unique key.
The returned object object can be either written or read.
key | User-defined unique key that, in combination with the domain name specified in the constructor, can be used to address the object |
flags | Combination of flags that defines object location and caching. |
Definition at line 368 of file netstorage.cpp.
References flags, and CNetStorageByKey::m_Impl.
Referenced by CNetStorageByKey::Exists(), CGridCommandLineInterfaceApp::GetNetStorageObject(), CNetStorageByKey::Relocate(), and CNetStorageByKey::Remove().
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 472 of file netstorage.hpp.
|
inline |
Definition at line 369 of file netstorage.hpp.
|
inline |
Definition at line 168 of file netstorage.hpp.
|
inline |
Definition at line 97 of file netstorage.hpp.
void CNetStorageObject::Read | ( | string * | data | ) |
Read object (starting at the current position) and put the read data into a string.
data | The string in which to store the read data |
CNetStorageException | If unable to read ALL of the data, or if 'CNetStorageObject' is in writing mode |
Definition at line 237 of file netstorage.cpp.
References buffer, CNetStorageObject::Close(), data, CNetStorageObject::Eof(), SNetStorageObjectIoMode::eRead, SNetStorageObjectIoMode::eString, and CNetStorageObject::m_Impl.
size_t CNetStorageObject::Read | ( | void * | buffer, |
size_t | buf_size | ||
) |
Read no more than 'buf_size' bytes of the object contents (starting at the current position)
buffer | Pointer to the receiving buffer. NULL means to skip bytes (advance the current object reading position by 'buf_size' bytes). |
buf_size | Number of bytes to attempt to read (or to skip) |
CNetStorageException | On any error – and only if no data at all has been actually read. Also, if 'CNetStorageObject' is in writing mode. |
Definition at line 229 of file netstorage.cpp.
References buffer, SNetStorageObjectIoMode::eBuffer, SNetStorageObjectIoMode::eRead, and CNetStorageObject::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_Download(), CNetCacheBlobFetchApp::ProcessRequest(), and CNetStorageHandler::x_ProcessRead().
string CNetStorage::Relocate | ( | const string & | object_loc, |
TNetStorageFlags | flags, | ||
TNetStorageProgressCb | cb = TNetStorageProgressCb() |
||
) |
Relocate a object according to the specified combination of flags.
object_loc | An existing object to relocate |
flags | Combination of flags that defines the new object location (storage) |
cb | Relocation progress callback ( |
Definition at line 343 of file netstorage.cpp.
References flags, and CNetStorage::Open().
Referenced by CGridCommandLineInterfaceApp::Cmd_Relocate().
string CNetStorageByKey::Relocate | ( | const string & | unique_key, |
TNetStorageFlags | flags, | ||
TNetStorageFlags | old_flags = 0 , |
||
TNetStorageProgressCb | cb = TNetStorageProgressCb() |
||
) |
Relocate a object according to the specified combination of flags.
flags | Combination of flags that defines the new object location |
old_flags | Combination of flags that defines the current object location |
cb | Relocation progress callback ( |
Definition at line 375 of file netstorage.cpp.
References flags, and CNetStorageByKey::Open().
Referenced by CGridCommandLineInterfaceApp::Cmd_Relocate().
ENetStorageRemoveResult CNetStorageByKey::Remove | ( | const string & | key, |
TNetStorageFlags | flags = 0 |
||
) |
Remove a object addressed by a key and a set of flags.
key | User-defined unique key that, in combination with the domain name specified in the constructor, addresses the object |
flags | Combination of flags that hints on the current object location |
Definition at line 389 of file netstorage.cpp.
References flags, ncbi::grid::netcache::search::fields::key, and CNetStorageByKey::Open().
Referenced by CGridCommandLineInterfaceApp::Cmd_RemoveNetStorageObject().
ENetStorageRemoveResult CNetStorage::Remove | ( | const string & | object_loc | ) |
Remove the object addressed by 'object_loc'.
object_loc | File to remove |
Definition at line 355 of file netstorage.cpp.
References CNetStorage::Open().
Referenced by CGridCommandLineInterfaceApp::Cmd_RemoveNetStorageObject(), CProjectStorage::Delete(), and CNetStorageGCApp::x_RemoveObjects().
Set the new value for the specified attribute.
If | the underlying storage does not support attributes, a CNetStorageException will be thrown. |
Definition at line 305 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_SetAttr(), and CProjectStorage::SaveObject().
Updates expiration on the object.
ttl | Expiration timeout, may be infinite |
If | the underlying storage does not support expiration, a CNetStorageException will be thrown. |
Definition at line 316 of file netstorage.cpp.
References CNetStorageObject::m_Impl.
Referenced by CProjectStorage::Clone(), CGridCommandLineInterfaceApp::Cmd_Upload(), CProjectStorage::SaveObject(), CProjectStorage::SaveProject(), CProjectStorage::SaveRawData(), CProjectStorage::SaveStream(), CProjectStorage::SaveString(), CNetStorageHandler::x_ProcessGetSize(), and CNetStorageHandler::x_ProcessSetExpTime().
CJsonNode CNetStorageObjectInfo::ToJSON | ( | ) |
Pack the whole structure in a single JSON object.
Definition at line 275 of file netstorageobjectinfo.cpp.
References CNetStorageObjectInfo::m_Impl.
Referenced by CGridCommandLineInterfaceApp::Cmd_NetStorageObjectInfo(), NAutomation::SNetStorageObject::ExecInfo(), and CNetStorageHandler::x_ProcessGetObjectInfo().
Write string to the object (starting at the current position)
data | Data to write to the object |
CNetStorageException | If unable to write ALL of the data, or if CNetStorageObject is in reading mode |
Definition at line 272 of file netstorage.cpp.
References data, SNetStorageObjectIoMode::eString, SNetStorageObjectIoMode::eWrite, CNetStorageObject::m_Impl, and NULL.
void CNetStorageObject::Write | ( | const void * | buffer, |
size_t | buf_size | ||
) |
Write data to the object (starting at the current position)
buffer | Pointer to the data to write |
buf_size | Data length in bytes |
CNetStorageException | If unable to write ALL of the data, or if CNetStorageObject is in reading mode |
Definition at line 266 of file netstorage.cpp.
References buffer, SNetStorageObjectIoMode::eBuffer, SNetStorageObjectIoMode::eWrite, CNetStorageObject::m_Impl, and NULL.
Referenced by CGridCommandLineInterfaceApp::Cmd_Upload(), CProjectStorage::SaveRawData(), CNetStorageHandler::x_OnData(), and CNetStorageHandler::x_SendWriteConfirmation().
|
protected |
Definition at line 97 of file netstorage.hpp.
Referenced by CNetStorageObjectInfo::GetCreationTime(), CNetStorageObjectInfo::GetLocation(), CNetStorageObjectInfo::GetObjectLocInfo(), CNetStorageObjectInfo::GetSize(), CNetStorageObjectInfo::GetStorageSpecificInfo(), and CNetStorageObjectInfo::ToJSON().
|
protected |
Definition at line 168 of file netstorage.hpp.
Referenced by CDirectNetStorageObject::CancelRelocate(), CNetStorageObject::Close(), CNetStorageObject::Eof(), CDirectNetStorageObject::FileTrack_Path(), CNetStorageObject::GetAttribute(), CNetStorageObject::GetAttributeList(), CNetStorageObject::GetInfo(), CNetStorageObject::GetLoc(), CNetStorageObject::GetReader(), CNetStorageObject::GetRWStream(), CNetStorageObject::GetSize(), CDirectNetStorageObject::GetUserInfo(), CNetStorageObject::GetWriter(), CDirectNetStorageObject::Locator(), CNetStorageObject::Read(), CDirectNetStorageObject::Relocate(), CDirectNetStorageObject::Remove(), CNetStorageObject::SetAttribute(), CNetStorageObject::SetExpiration(), and CNetStorageObject::Write().
|
protected |
Definition at line 369 of file netstorage.hpp.
Referenced by CDirectNetStorage::Create(), CNetStorage::Create(), CDirectNetStorage::Exists(), CNetStorage::Open(), CDirectNetStorage::Open(), and CDirectNetStorage::ReportConfig().
|
protected |
Definition at line 472 of file netstorage.hpp.
Referenced by CDirectNetStorageByKey::Exists(), CNetStorageByKey::Open(), and CDirectNetStorageByKey::Open().