NCBI C++ ToolKit
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
SNetStorage_NetCacheBlob::SIState Struct Reference

Search Toolkit Book for SNetStorage_NetCacheBlob::SIState

+ Inheritance diagram for SNetStorage_NetCacheBlob::SIState:
+ Collaboration diagram for SNetStorage_NetCacheBlob::SIState:

Public Member Functions

ERW_Result Read (void *buf, size_t count, size_t *read) override
 Read as many as "count" bytes into a buffer pointed to by the "buf" argument. More...
 
ERW_Result PendingCount (size_t *count) override
 Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that are ready to be read from the input device without blocking. More...
 
bool Eof () override
 
void Close () override
 
void Abort () override
 
string GetLoc () const override
 
- Public Member Functions inherited from SNetStorageObjectIState
ERW_Result Write (const void *buf, size_t count, size_t *written) final
 Write up to "count" bytes from the buffer pointed to by the "buf" argument onto the output device. More...
 
ERW_Result Flush () final
 Flush pending data (if any) down to the output device. More...
 
- Public Member Functions inherited from SNetStorageObjectIoState
Uint8 GetSize () final
 
list< stringGetAttributeList () const final
 
string GetAttribute (const string &name) const final
 
void SetAttribute (const string &name, const string &value) final
 
CNetStorageObjectInfo GetInfo () final
 
void SetExpiration (const CTimeout &ttl) final
 
string FileTrack_Path () final
 
string Relocate (TNetStorageFlags flags, TNetStorageProgressCb cb) final
 
bool Exists () final
 
ENetStorageRemoveResult Remove () final
 
- Public Member Functions inherited from INetStorageObjectState
virtual pair< string, stringGetUserInfo ()
 
virtual CNetStorageObjectLocLocator ()
 
virtual void CancelRelocate ()
 
- Public Member Functions inherited from IReader
virtual ERW_Result Pushback (const void *buf, size_t count, void *del_ptr=0)
 This method gets called by RStream buffer destructor to return buffered yet still unread (from the stream) portion of data back to the device. More...
 
virtual ~IReader ()
 
- Public Member Functions inherited from IWriter
virtual ~IWriter ()
 

Public Attributes

unique_ptr< CNetCacheReaderreader
 

Protected Member Functions

 SIState (string &blob_key)
 
- Protected Member Functions inherited from INetStorageObjectState
void EnterState (INetStorageObjectState *state)
 
void ExitState ()
 

Private Attributes

stringm_BlobKey
 

Detailed Description

Definition at line 44 of file netstorage_direct_nc.hpp.

Constructor & Destructor Documentation

◆ SIState()

SNetStorage_NetCacheBlob::SIState::SIState ( string blob_key)
inlineprotected

Definition at line 58 of file netstorage_direct_nc.hpp.

Member Function Documentation

◆ Abort()

void SNetStorage_NetCacheBlob::SIState::Abort ( void  )
overridevirtual

Implements IEmbeddedStreamWriter.

Definition at line 265 of file netstorage_direct_nc.cpp.

References INetStorageObjectState::ExitState().

◆ Close()

void SNetStorage_NetCacheBlob::SIState::Close ( void  )
overridevirtual

Implements IEmbeddedStreamWriter.

Definition at line 248 of file netstorage_direct_nc.cpp.

References INetStorageObjectState::ExitState().

◆ Eof()

bool SNetStorage_NetCacheBlob::SIState::Eof ( void  )
overridevirtual

Implements INetStorageObjectState.

Definition at line 94 of file netstorage_direct_nc.cpp.

◆ GetLoc()

string SNetStorage_NetCacheBlob::SIState::GetLoc ( void  ) const
inlineoverridevirtual

Implements INetStorageObjectState.

Definition at line 55 of file netstorage_direct_nc.hpp.

References m_BlobKey.

◆ PendingCount()

ERW_Result SNetStorage_NetCacheBlob::SIState::PendingCount ( size_t *  count)
overridevirtual

Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that are ready to be read from the input device without blocking.

Return eRW_Success if the number of pending bytes has been stored at the location pointed to by "count". Return eRW_NotImplemented if the number cannot be determined. Otherwise, return other eRW_... condition to reflect the problem ("*count" does not need to be updated in the case of non-eRW_Success). Note that if reporting 0 bytes ready, the method may return either both eRW_Success and zero "*count", or return eRW_NotImplemented alone.

Implements IReader.

Definition at line 84 of file netstorage_direct_nc.cpp.

◆ Read()

ERW_Result SNetStorage_NetCacheBlob::SIState::Read ( void *  buf,
size_t  count,
size_t *  bytes_read 
)
overridevirtual

Read as many as "count" bytes into a buffer pointed to by the "buf" argument.

Always store the number of bytes actually read (0 if read none) via the pointer "bytes_read", if provided non-NULL. Return non-eRW_Success code if EOF / error condition has been encountered during the operation (some data may have been read, nevertheless, and reflected in "*bytes_read"). Special case: if "count" is passed as 0, then the value of "buf" must be ignored, and no change should be made to the state of the input device (but may return non-eRW_Success to indicate that the input device has already been in an error condition).

Note
Apparently, may not return eRW_Success if hasn't been able to read "count" bytes as requested, and "bytes_read" was provided as NULL.
When returning "*bytes_read" as zero for a non-zero "count" requested, the return status should not indicate eRW_Success.
Warning
"*bytes_read" may never be returned greater than "count".
Attention
It is implementation-dependent whether the call blocks until the entire buffer is read or the call returns when at least some data are available. In general, it is advised that this call is made within a loop that checks for EOF condition and proceeds with the reading until the required amount of data has been retrieved.

Implements IReader.

Definition at line 59 of file netstorage_direct_nc.cpp.

References buffer, eRW_Eof, eRW_Success, g_RW_ResultToString(), NCBI_THROW_FMT, NETSTORAGE_CONVERT_NETCACHEEXCEPTION, and reader.

Member Data Documentation

◆ m_BlobKey

string& SNetStorage_NetCacheBlob::SIState::m_BlobKey
private

Definition at line 61 of file netstorage_direct_nc.hpp.

Referenced by GetLoc().

◆ reader

unique_ptr<CNetCacheReader> SNetStorage_NetCacheBlob::SIState::reader

Definition at line 46 of file netstorage_direct_nc.hpp.

Referenced by Read().


The documentation for this struct was generated from the following files:
Modified on Sat Apr 20 12:18:46 2024 by modify_doxy.py rev. 669887