.format = GetFileFormat(
info);
87shared_ptr<CNcbiIstream>
106 return f.Exists() ?
f.GetLength() : -1;
139LDS2_MAX_CACHED_STREAMS);
145 size_tmax_streams = TMaxCachedStreams::GetDefault();
146 if(max_streams == 0) {
148unique_ptr<CNcbiIfstream> fin(
new CNcbiIfstream(file_info.
name.c_str(), ios::binary));
149 if(!fin->is_open()) {
152 returnshared_ptr<CNcbiIstream>(fin.release());
156TStreamCache::iterator found = cache.end();
158 if(it->first == file_info.
name) {
164 if(found != cache.end()) {
167cache.emplace_front(
str);
171unique_ptr<CNcbiIfstream> fin(
new CNcbiIfstream(file_info.
name.c_str(), ios::binary));
172 if(!fin->is_open()) {
176 str.second.reset(fin.release());
177 while(!cache.empty() && cache.size() >= max_streams) {
180cache.emplace_front(
str);
215: m_FileInfo(file_info),
234unique_ptr<CNcbiIfstream>
in(
236 if( !
in->is_open() ) {
244shared_ptr<CNcbiIstream>
257 if( db->
FindChunk(file_info, chunk, stream_pos) ) {
268unique_ptr<CCompressionIStream> zin(
274 returnshared_ptr<CNcbiIstream>(zin.release());
Checksum and hash calculation classes.
CChecksum â Checksum calculator.
EFormat
The formats are checked in the same order as declared here.
@ eUnknown
unknown format
static EFormat Format(const string &path, EOnError onerror=eDefault)
Guess file format.
const SLDS2_File & m_FileInfo
CGZipChunkHandler(const SLDS2_File &file_info, CLDS2_Database &db)
virtual ~CGZipChunkHandler(void)
virtual EAction OnChunk(TPosition raw_pos, TPosition data_pos)
Callback method, to be implemented by the end user.
void AddChunk(const SLDS2_File &file_info, const SLDS2_Chunk &chunk_info)
Store the chunk info in the database.
bool FindChunk(const SLDS2_File &file_info, SLDS2_Chunk &chunk_info, Int8 stream_pos)
Load chunk containing the required stream position.
Base class for URL handler.
virtual SLDS2_File::TFormat GetFileFormat(const SLDS2_File &file_info)
Methods for getting file information.
virtual shared_ptr< CNcbiIstream > OpenStream(const SLDS2_File &, Int8, CLDS2_Database *)=0
Open input stream for the URL at the specified position.
void SetHandlerName(const string &new_name)
Allow to change handler name by derived classes.
pair< string, TStream > TNamedStream
shared_ptr< CNcbiIstream > OpenStream(const SLDS2_File &file_info, Int8 stream_pos, CLDS2_Database *db) override
Open input stream for the URL at the specified position.
static const string s_GetHandlerName(void)
shared_ptr< CNcbiIstream > OpenOrGetStream(const SLDS2_File &file_info)
Int8 GetFileTime(const SLDS2_File &file_info) override
Get file timestamp - returns 0 by default.
Int8 GetFileSize(const SLDS2_File &file_info) override
Get file size - returns 0 by default.
CLDS2_UrlHandler_File(void)
deque< TNamedStream > TStreamCache
TStreamCache & x_GetStreamCache(void)
CRef< CTls< TStreamCache > > m_StreamCache
Uint4 GetFileCRC(const SLDS2_File &file_info) override
Get file CRC - returns 0 by default.
shared_ptr< CNcbiIstream > OpenStream(const SLDS2_File &file_info, Int8 stream_pos, CLDS2_Database *db) override
Open input stream for the URL at the specified position.
static const string s_GetHandlerName(void)
void SaveChunks(const SLDS2_File &file_info, CLDS2_Database &db) override
Save information about chunks for the URL in the database.
CLDS2_UrlHandler_GZipFile(void)
Create GZip file handler.
CZipStreamDecompressor â zlib based decompression stream processor.
Interface class to scan data source for seekable data chunks.
static const char * str(char *buf, int n)
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void AddFile(const string &file_path)
Update checksum with the file data.
Uint4 GetChecksum(void) const
Return calculated checksum.
@ fOwnReader
Delete the reader.
void g_GZip_ScanForChunks(CNcbiIstream &is, IChunkHandler &handler)
Get list of positions of separate gzip files in the concatenated gzip file.
Uint8 TPosition
Type to store stream positions.
@ eAction_Continue
Continue scanning to the next data chunk, if any.
@ fGZip
Set of flags for gzip file support. See each flag description above.
long mtime_nsec
Nanoseconds for modification time.
@ eParam_NoThread
Do not use per-thread values.
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
NCBI_NS_STD::char_traits< char >::pos_type NcbiInt8ToStreampos(Int8 pos)
Convert plain numeric stream position (offset) into stream position usable with STL stream library.
void SetValue(TValue *value, FCleanup cleanup=0, void *cleanup_data=0, ENativeThreadCleanup native=eSkipCleanup)
Set value.
TValue * GetValue(void) const
Get the pointer previously stored by SetValue().
typedef NCBI_PARAM_TYPE(LDS2, MAX_CACHED_STREAMS) TMaxCachedStreams
NCBI_PARAM_DECL(size_t, LDS2, MAX_CACHED_STREAMS)
NCBI_PARAM_DEF_EX(size_t, LDS2, MAX_CACHED_STREAMS, 3, eParam_NoThread, LDS2_MAX_CACHED_STREAMS)
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
Alternate stat structure for use instead of the standard struct stat.
Int8 stream_pos
Chunk position in the processed (e.g. unzipped) stream.
Int8 raw_pos
Chunk position in the raw file.
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