*
kKeyError=
"The given key is invalid or inaccessible!";
88m_CmprsFmt(eNC_Uncompressed),
91m_ServiceName(nc_service),
92m_HasNetStorage(
false),
108 stringns_service =
"client=";
120 if(sec > 0 &&
m_NC) {
121 unsigned intnum_sec = (
unsigned int)floor(sec);
122 unsigned intnum_msec = (
unsigned int)((sec - num_sec) * 1000000.0f);
133 unsigned inttime_to_live,
145 stringnc_key =
key;
159 if(time_to_live > 0)
172 unsigned inttime_to_live,
175 stringnc_key =
key;
187 if(time_to_live > 0)
198 unsigned inttime_to_live,
205 stringnc_key =
key;
207unique_ptr<CNcbiOstream> ostr =
x_GetOutputStream(nc_key, time_to_live, default_flags, nso);
212 if(time_to_live > 0)
222 unsigned inttime_to_live,
230 stringnc_key =
key;
232unique_ptr<CNcbiOstream> ostr =
x_GetOutputStream(nc_key, time_to_live, default_flags, nso);
237 if(time_to_live > 0)
247 unsigned inttime_to_live,
259 unsigned inttime_to_live,
276 unsigned inttime_to_live,
293 if(time_to_live > 0)
303 unsigned inttime_to_live,
307 stringnew_key =
key;
316 if(time_to_live > 0)
343 if(time_to_live > 0)
346new_key = nso_clone.
GetLoc();
369*obj_istr >> *real_project;
371 ERR_POST(
Error<<
"Can't deserialize the blob data as a GBProject ASN, msg: " 387 for(; annot_iter; ++annot_iter) {
392 for(; annot_iter; ++annot_iter) {
410*obj_istr >> *real_project;
416 ERR_POST(
Warning<<
"NCTools::GetObjects: failed to get GB project, msg: " 435 ERR_POST(
Warning<<
"NCTools::GetObjects: failed to get seq-annot, msg: " 473unique_ptr<CNcbiIstream> strm;
484 boolvalid_header =
false;
495valid_header =
true;
502p->GetDecompressor()->SetWindowBits(
kWindowBits);
503p->GetDecompressor()->SetMemoryLevel(
kMemLevel);
508 #if defined(HAVE_LIBLZO) 515eUnsupportedCompression,
516 "The blob is lzo-compressed, but the client code doesn't support lzo-compression.");
526strm.reset(zip_str.release());
532 if( !valid_header ) {
591 msg=
"Can't access the blob (may be it is password-protected)";
593 msg=
"Error when trying to connect to NetCache service";
599<<
"Error connecting to the net storage service: " 602}
catch(exception& e) {
604<<
"Error connecting to net storage service: " 614 #if !defined(HAVE_LIBLZO) 617 "The client code doesn't support lzo compression.");
620unique_ptr<CNcbiOstream> ostr;
635unique_ptr<CCompressionStreamProcessor> compressor;
640p->GetCompressor()->SetMemoryLevel(
kMemLevel);
644 #if defined(HAVE_LIBLZO) 650unique_ptr<CNcbiOstream> zip_ostr(
664 if(no_throw)
return false;
666 string msg=
"The serialization format (";
668 msg+=
") is not supported.";
680 if(no_throw)
return false;
682 string msg=
"The (de)serialization format for ASN objects must be " 683 "either ASN text or binary.";
696 if(no_throw)
return false;
698 string msg=
"The compression format (";
700 msg+=
") is not supported.";
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CBZip2StreamCompressor â bzip2 based compression stream processor.
CBZip2StreamDecompressor â bzip2 based decompression stream processor.
In-memory stream (a la strstream or stringstream)
CLZOStreamCompressor â lzo based compression stream processor.
CLZOStreamDecompressor â lzo based decompression stream processor.
Client API for NetCache server.
NetCache internal exception.
Basic network-based data object I/O.
Network BLOB storage API.
CProjectStorage(const string &client, const string &nc_service="", const string &password="", TNetStorageFlags default_flags=0)
Constructor.
CIRef< objects::IGBProject > GetProject(const string &key)
Retrieve a NC blob as a GB project.
bool Exists(const string &key)
Check existence of a NetCache blob.
void GetString(const string &key, string &str)
Download the data as a string from NetCache with a key.
string SaveString(const string &str, const string &key="", TCompressionFormat compression_fmt=eNC_ZlibCompressed, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Save a string to NetCache.
string Clone(const string &key, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Duplicate an existing data Blob.
bool x_ValidateSerialFormat(TDataFormat fmt, bool no_throw=false) const
Check if the object format is valid.
CRef< CSerialObject > GetObject(const string &key)
Construct and return a serializable ASN object.
string m_Password
For password-protected Blobs.
string SaveObject(const CSerialObject &obj, const string &key="", TCompressionFormat compression_fmt=eNC_ZlibCompressed, TDataFormat data_fmt=eSerial_AsnBinary, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Save a serializable ASN object to NetCache.
bool x_ValidateCompressionFormat(TCompressionFormat fmt, bool no_throw=false) const
Check if the compression is valid.
void GetVector(const string &key, vector< char > &vec)
Download the data as a blob from NetCache with a key.
Uint2 m_Version
Version number for stored data blob.
list< CRef< objects::CSeq_annot > > TAnnots
string SaveRawData(const void *buf, size_t size, const string &key="", unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Save any raw data to NetCache.
AutoPtr< CNetCacheAPI > m_NC
bool x_ValidateAsnSerialFormat(TDataFormat fmt, bool no_throw=false) const
Check if the object format is valid ASN format.
CObjectOStream * x_GetObjectOStream(TDataFormat data_fmt, CNetStorageObject &nso, string &key, TCompressionFormat compression_fmt=eNC_ZlibCompressed, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Get a object ostream to allow save data to NetCache.
string SaveProject(const objects::IGBProject &project, const string &key="", TCompressionFormat compression_fmt=eNC_ZlibCompressed, TDataFormat data_fmt=eSerial_AsnBinary, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Save a GB project to NetCache.
unique_ptr< CNcbiIstream > GetIstream(const string &key, bool raw=false)
Create an input stream using the key.
CObjectOStream * AsObjectOStream(TDataFormat data_fmt, string &key, TCompressionFormat compression_fmt=eNC_ZlibCompressed, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Get a object ostream to allow save data to NetCache.
TDataFormat m_DataFmt
Data serialization format (one of ESerialDataFormat).
string SaveStream(CNcbiIstream &istream, const string &key, TCompressionFormat compression_fmt=eNC_ZlibCompressed, unsigned int time_to_live=0, TNetStorageFlags default_flags=0)
Save data from an incoming stream to NetCache.
unique_ptr< CNcbiOstream > x_GetOutputStream(string &key, unsigned int time_to_live, TNetStorageFlags default_flags, CNetStorageObject &nso)
Create an output stream.
TAnnots GetAnnots(const string &key)
Return a NC blob as a list of seq-annots.
void Delete(const string &key)
Delete an existing Blob from NetCache.
unique_ptr< CObjectIStream > GetObjectIstream(const string &key)
Create a CObjectIStream.
TCompressionFormat m_CmprsFmt
Data compression format.
void SetCommTimeout(float sec)
Set netservice communication time out.
Uint2 m_Magic
Data/application related magic number.
Note about the "buf_size" parameter for streams in this API.
Base class for all serializable objects.
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
const value_type * data() const
CTimeout â Timeout interval.
Template class for iteration on objects of class C.
Writer-based output stream.
CZipStreamCompressor â zlib based compression stream processor.
CZipStreamDecompressor â zlib based decompression stream processor.
IGBProject - abstract interface for a project used by CGBProjectHandle.
static const char * str(char *buf, int n)
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
@ eTakeOwnership
An object can take ownership of another.
ELevel
Compression level.
void ToVector(vector< char > *)
fill in the data, NULL is not accepted
void ToString(string *)
The CConnMemoryStream::To* methods allow to obtain unread portion of the stream into a single contain...
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
#define nc_blob_password
Blob password.
#define nc_blob_ttl
Blob life span in seconds.
CNcbiOstream * CreateOStream(string &key, const CNamedParameterList *optional=NULL)
Create a stream object for sending data to a blob.
void Remove(const string &blob_id, const CNamedParameterList *optional=NULL)
Remove BLOB by key.
string PutData(const void *buf, size_t size, const CNamedParameterList *optional=NULL)
Put BLOB to server.
bool HasBlob(const string &blob_id, const CNamedParameterList *optional=NULL)
Check if the BLOB identified by the key "key" exists.
void SetCommunicationTimeout(const STimeout &to)
CNcbiIstream * GetIStream(const string &key, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL)
Create an istream object for reading blob data.
IReader * GetData(const string &key, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL)
Retrieve BLOB from server by key.
EReadResult
Status of GetData() call.
@ eNotFound
BLOB not found or error.
@ eAccessDenied
Blob could not be read completely.
IReader & GetReader()
Get a reference to the IReader interface for reading the data stream of this object.
bool Exists(const string &object_loc)
Check if the object addressed by 'object_loc' exists.
string GetLoc(void) const
Return object locator.
unsigned TNetStorageFlags
Bitwise OR of ENetStorageFlags.
CNetStorageObject Create(TNetStorageFlags flags=0)
Create new NetStorage object.
CNcbiIostream * GetRWStream()
Get an iostream instance for reading the data stream of this NetStorage object as well as storing dat...
void Write(const void *buffer, size_t buf_size)
Write data to the object (starting at the current position)
void SetExpiration(const CTimeout &ttl)
Updates expiration on the object.
void Close(void)
Finalize and close the current object stream.
void SetAttribute(const string &attr_name, const string &attr_value)
Set the new value for the specified attribute.
CNetStorageObject Open(const string &object_loc)
Open an existing NetStorage object for reading.
IEmbeddedStreamWriter & GetWriter()
Get a reference to the IWriter interface for storing data into this object.
ENetStorageRemoveResult Remove(const string &object_loc)
Remove the object addressed by 'object_loc'.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
uint16_t Uint2
2-byte (16-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void NcbiStreamCopyThrow(CNcbiOstream &os, CNcbiIstream &is)
Same as NcbiStreamCopy() but throws an CCoreException when copy fails.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
const string & GetName(void) const
Get name of this type.
const string & GetValue(const string &name, bool *is_found=0) const
Get value for the given name.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
@ eVoid
To create a void (uninitialized) instance of a component.
static const char * kKeyError
static const Uint2 kNC_StringMagic
string magic number This is used only when explicitly calling SaveString().
static const CCompression::ELevel kCompressionLevel
static const streamsize kBufSize
static const int kWindowBits
static const Uint2 kNC_CurrentVersion
version number
static const Uint2 kNC_ProjectMagic
Predefined constants.
static const int kMemLevel
Reader-writer based streams.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static CNamedPipeClient * client
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4