43 #if ((!defined(NCBI_COMPILER_WORKSHOP) || (NCBI_COMPILER_VERSION > 550)) && \
44 (!defined(NCBI_COMPILER_MIPSPRO)) )
52 : m_UseBothByteOrder(
false)
189 const string & title,
193 m_DataFile (& datafile),
235 const int kFormatVersion = 1;
236 const int kColumnType = 1;
237 const int kOffsetSize = 4;
274 _ASSERT((array_off & 0x7) == 0);
378 string index_extn =
"x_a";
379 index_extn[1] = file_id;
381 string data_extn = index_extn;
`Blob' Class for SeqDB (and WriteDB).
@ eString
Pad using NUL terminated string of '#' bytes.
static int VarIntSize(Int8 x)
Compute bytes used for a variable length integer.
int Size() const
Get size of blob contents.
int GetWriteOffset() const
Get the current write pointer offset.
void WritePadBytes(int align, EPadding fmt)
Align the offset by writing pad bytes.
void WriteInt4(Int4 x)
Write a 4 byte integer to the blob.
void WriteInt8(Int8 x)
Write an 8 byte integer to the blob.
CTempString Str() const
Get blob contents as a CTempString.
int WriteString(CTempString str, EStringFormat fmt)
Write string data to the blob.
void SeekWrite(int offset)
Seek write pointer to a specific location.
int WriteVarInt(Int8 x)
Write a variable length integer to the blob.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
void Close()
Complete and close the column files.
void AddMetaData(const string &key, const string &value)
Add meta data to the column.
class CWriteDB_Column * m_Impl
Implementation object.
void ListFiles(vector< string > &files) const
List Filenames.
CWriteDB_ColumnBuilder(const string &title, const string &basename, char file_id='a')
Construct a BlastDb format column.
void AddBlob(const CBlastDbBlob &blob)
Add a blob to the column.
~CWriteDB_ColumnBuilder()
Destructor.
CWriteDB_ColumnData class.
~CWriteDB_ColumnData()
Destructor.
Int8 GetDataLength() const
Get size of data file (so far).
bool Empty() const
Tests whether the data file is empty.
CWriteDB_ColumnData(const string &dbname, const string &extn, int index, Uint8 max_file_size)
Constructor for an column data file.
Int8 WriteBlob(const CBlastDbBlob &blob)
Write a new data blob.
void x_Flush()
Flush any stored data.
bool CanFit(int size) const
Tests whether there is room for some number of bytes.
Uint8 m_DataLength
Length of data written so far.
CWriteDB_ColumnIndex class.
string m_Title
Title of this column.
void x_BuildMetaData()
Serialize meta data strings into header object.
CRef< CBlastDbBlob > m_Offsets
Offsets of sequences in the data file.
CRef< CBlastDbBlob > m_Header
Header data.
string m_Date
Creation timestamp for this column.
static const CBlastDbBlob::EStringFormat kStringFmt
String format used by column files.
static const int kEntrySize
Size of an entry in the index file.
~CWriteDB_ColumnIndex()
Destructor.
CRef< CWriteDB_ColumnData > m_DataFile
The data file associated with this index file.
void x_BuildHeaderStrings()
Build header string data section.
void x_Flush()
Flush index data in preparation for Close().
TColumnMeta m_MetaData
Column meta data.
CWriteDB_ColumnIndex(const string &dbname, const string &extn, int index, CWriteDB_ColumnData &datafile, const string &title, const TColumnMeta &meta, Uint8 max_file_size)
Constructor for column index file.
void x_BuildHeaderFields()
Build fixed length header fields.
void AddMetaData(const string &key, const string &value)
Add meta data to the column.
bool CanFit() const
Tests whether there is room for another entry.
Uint8 m_DataLength
Length of data accounted for so far.
void WriteBlobIndex(Int8 offset)
Write the offset of a new data blob.
void RenameFileIndex(unsigned int num_digits)
void AddBlob(const CBlastDbBlob &blob)
Add a blob to the column.
CWriteDB_Column(const string &dbname, const string &extn1, const string &extn2, int index, const string &title, const TColumnMeta &meta, Uint8 max_file_size)
Construct WriteDB style database column.
void Close()
Flush data to disk and close all associated files.
void AddMetaData(const string &key, const string &value)
Add meta data to the column.
~CWriteDB_Column()
Destructor.
bool m_UseBothByteOrder
Support for multiple byte order.
bool CanFit(int bytes) const
Tests whether there is room for a given blob.
CRef< CWriteDB_ColumnData > m_DFile2
void RenameSingle()
Rename files to single-volume names.
void ListFiles(vector< string > &files, bool skip_empty) const
List Filenames.
CRef< CWriteDB_ColumnData > m_DFile
Data file, contains one record for each key/oid pair, in big and small endian.
CRef< CWriteDB_ColumnIndex > m_IFile
Index file, contains meta data and samples of the key/oid pairs.
void AddByteOrder(const string &dbname, const string &extn, int index, Uint8 max_file_size)
Add support for multiple byte order.
CWriteDB_IndexFile class.
Uint8 m_MaxFileSize
Maximum file size in bytes.
bool m_Created
True if the file has already been opened.
const string & GetFilename() const
Get the current filename for this file.
virtual void RenameFileIndex(unsigned int num_digits)
void Create()
Create and open the file.
void Close()
Close the file, flushing any remaining data to disk.
unsigned int Write(const CTempString &data)
Write contents of a string to the file.
virtual void RenameSingle()
Rename this file, disincluding the volume index.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
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.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
@ eCurrent
Use current time. See also CCurrentTime.
char * dbname(DBPROCESS *dbproc)
Get name of current database.
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Defines BLAST database construction classes.
USING_SCOPE(std)
Import C++ std namespace.
Code for arbitrary data `column' file construction.