diff options
Diffstat (limited to 'db/database.h')
-rw-r--r-- | db/database.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/db/database.h b/db/database.h index 0bf1e485bac..a8140089897 100644 --- a/db/database.h +++ b/db/database.h @@ -62,6 +62,18 @@ public: return getFile(n); } + PhysicalDataFile* suitableFile(int sizeNeeded) { + PhysicalDataFile* f = newestFile(); + for( int i = 0; i < 8; i++ ) { + if( f->getHeader()->unusedLength >= sizeNeeded ) + break; + f = addAFile(); + if( f->getHeader()->fileLength > 1500000000 ) // this is as big as they get so might as well stop + break; + } + return f; + } + PhysicalDataFile* newestFile() { int n = (int) files.size(); if( n > 0 ) n--; |