1. Fix work with big index files

2. Increase limit of node elements while build index
This commit is contained in:
Abs62 2021-03-05 16:28:10 +03:00
parent 9fb467abf3
commit 968690654f
3 changed files with 10 additions and 10 deletions

View file

@ -49,7 +49,7 @@ using std::pair;
enum enum
{ {
BtreeMinElements = 64, BtreeMinElements = 64,
BtreeMaxElements = 5120 BtreeMaxElements = 8192
}; };
BtreeIndex::BtreeIndex(): BtreeIndex::BtreeIndex():

10
file.cc
View file

@ -239,7 +239,7 @@ std::string Class::gets( bool stripNl ) THROW_SPEC( exReadError, exWriteError )
return std::string( buf ); return std::string( buf );
} }
void Class::seek( long offset ) THROW_SPEC( exSeekError, exWriteError ) void Class::seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
{ {
if ( writeBuffer ) if ( writeBuffer )
flushWriteBuffer(); flushWriteBuffer();
@ -248,7 +248,7 @@ void Class::seek( long offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError(); throw exSeekError();
} }
void Class::seekCur( long offset ) THROW_SPEC( exSeekError, exWriteError ) void Class::seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
{ {
if ( writeBuffer ) if ( writeBuffer )
flushWriteBuffer(); flushWriteBuffer();
@ -257,7 +257,7 @@ void Class::seekCur( long offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError(); throw exSeekError();
} }
void Class::seekEnd( long offset ) THROW_SPEC( exSeekError, exWriteError ) void Class::seekEnd( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
{ {
if ( writeBuffer ) if ( writeBuffer )
flushWriteBuffer(); flushWriteBuffer();
@ -271,7 +271,7 @@ void Class::rewind() THROW_SPEC( exSeekError, exWriteError )
seek( 0 ); seek( 0 );
} }
size_t Class::tell() THROW_SPEC( exSeekError ) qint64 Class::tell() THROW_SPEC( exSeekError )
{ {
qint64 result = f.pos(); qint64 result = f.pos();
@ -281,7 +281,7 @@ size_t Class::tell() THROW_SPEC( exSeekError )
if ( writeBuffer ) if ( writeBuffer )
result += ( WriteBufferSize - writeBufferLeft ); result += ( WriteBufferSize - writeBufferLeft );
return ( size_t ) result; return result;
} }
bool Class::eof() THROW_SPEC( exWriteError ) bool Class::eof() THROW_SPEC( exWriteError )

View file

@ -95,17 +95,17 @@ public:
std::string gets( bool stripNl = true ) THROW_SPEC( exReadError, exWriteError ); std::string gets( bool stripNl = true ) THROW_SPEC( exReadError, exWriteError );
/// Seeks in the file, relative to its beginning. /// Seeks in the file, relative to its beginning.
void seek( long offset ) THROW_SPEC( exSeekError, exWriteError ); void seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError );
/// Seeks in the file, relative to the current position. /// Seeks in the file, relative to the current position.
void seekCur( long offset ) THROW_SPEC( exSeekError, exWriteError ); void seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError );
/// Seeks in the file, relative to the end of file. /// Seeks in the file, relative to the end of file.
void seekEnd( long offset = 0 ) THROW_SPEC( exSeekError, exWriteError ); void seekEnd( qint64 offset = 0 ) THROW_SPEC( exSeekError, exWriteError );
/// Seeks to the beginning of file /// Seeks to the beginning of file
void rewind() THROW_SPEC( exSeekError, exWriteError ); void rewind() THROW_SPEC( exSeekError, exWriteError );
/// Tells the current position within the file, relative to its beginning. /// Tells the current position within the file, relative to its beginning.
size_t tell() THROW_SPEC( exSeekError ); qint64 tell() THROW_SPEC( exSeekError );
/// Returns true if end-of-file condition is set. /// Returns true if end-of-file condition is set.
bool eof() THROW_SPEC( exWriteError ); bool eof() THROW_SPEC( exWriteError );