51 using objects::CCache_blob;
82 <<
" does not exist. Creating." );
89 "Unable to open a chunk file for writing at " + file_path ;
111 if ( file_path !=
GetPath() ) {
121 string error_string =
122 "Unable to open a chunk file for reading at " + file_path ;
123 error_string +=
" (errno = " +
132 string error_string =
"Tried to read nonexistant chunk file at "
144 asn_stream << cache_blob;
167 asn_stream >> target_blob;
175 "CChunkFile::RawRead(): " +
177 ": requested a larger than supported number of bytes: " +
180 streamsize
size(raw_data_size);
185 "CChunkFile::RawRead(): " +
187 ": failed to read specified number of bytes: got " +
204 Uint8 new_chunk_size;
216 input_chunk_stream.seekg( input_offset );
219 <<
" at offset " << input_offset <<
" failed." );
231 ostringstream serial_number_stream;
232 serial_number_stream << setw( 5 ) << setfill(
'0' ) << serial_number;
239 unsigned int serial_num,
244 if ( ! chunk_file.
Exists() )
261 unsigned int serial_num = 1;
264 if ( ! chunk_file.
Exists() ) {
270 return serial_num - 1;
User-defined methods of the data storage class.
size_t Append(const string &root_path, const CFile &input_chunk_file, Uint8 input_offset=0)
void Read(CCache_blob &target, std::streampos offset, size_t blob_size)
static std::string s_MakeChunkFileName(const std::string &root_path, unsigned int serial_num)
unsigned int m_ChunkSerialNum
static unsigned int s_FindNextChunk(const std::string &root_path, unsigned int serial_num, Uint8 &size)
CNcbiFstream m_FileStream
void OpenForWrite(const std::string &root_path="")
void RawWrite(const char *raw_blob, size_t raw_blob_size)
CSimpleBufferT< char > m_Buffer
void Write(const CCache_blob &cache_blob)
void OpenForRead(const std::string &root_path="", unsigned int chunk=0)
static const Int8 m_kMaxChunkSize
void RawRead(std::streampos offset, char *raw_blob, size_t raw_blob_size)
static unsigned int s_FindLastChunk(const std::string &root_path)
std::string m_OpenFileRootPath
CObjectIStreamAsnBinary –.
CObjectOStreamAsnBinary –.
void resize(size_type new_size)
std::ofstream out("events_result.xml")
main entry point for tests
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_ERRNO_CODE_WRAPPER
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_ERRNO_STR_WRAPPER
void Info(CExceptionArgs_Base &args)
Int8 GetLength(void) const
Get size of file.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
void Reset(const string &path)
Reset path string.
const string & GetPath(void) const
Get entry path.
virtual bool Exists(void) const
Check existence of file.
CNcbiStreampos GetStreamPos(void) const
Get the current stream position.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to 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.
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
std::istream & in(std::istream &in_, double &x_)