diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 15:25:46 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 15:25:46 +0000 |
commit | 9098237f5bb16b204a5ea999b702e5eb170f68ac (patch) | |
tree | ddf0c3013f0877d1f406401c6b4509d11bfb23e3 /src/cachestorenids.h | |
parent | 8bc5ac336d5d684341a05e97d1cb1b18ecba0331 (diff) | |
download | libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.tar.gz libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.tar.bz2 libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.tar.xz libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.zip |
Corrected some larger read/write issues in corner cases that I hit suprisingly
often within nids. There's still a problem somewhere, but I'll find it.
Also, even after having the file class canRead and canWrite functions work
properly, and using them before trying to write to a nids to update info, we
never ever write anything, so something is still wrong there. For now, all
utilities that open a nids stream read-only will crash when it closes. Pretty
minor really.
Diffstat (limited to 'src/cachestorenids.h')
-rw-r--r-- | src/cachestorenids.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cachestorenids.h b/src/cachestorenids.h index 62d1555..bd0fcc7 100644 --- a/src/cachestorenids.h +++ b/src/cachestorenids.h | |||
@@ -7,6 +7,10 @@ | |||
7 | #include "bu/nidsstream.h" | 7 | #include "bu/nidsstream.h" |
8 | #include "bu/cachestore.h" | 8 | #include "bu/cachestore.h" |
9 | 9 | ||
10 | #include "bu/file.h" | ||
11 | |||
12 | static int iCnt = 0; | ||
13 | |||
10 | namespace Bu | 14 | namespace Bu |
11 | { | 15 | { |
12 | template<class obtype, class keytype> | 16 | template<class obtype, class keytype> |
@@ -44,6 +48,12 @@ namespace Bu | |||
44 | NidsStream ns = nStore.openStream( 0 ); | 48 | NidsStream ns = nStore.openStream( 0 ); |
45 | Bu::Archive ar( ns, Bu::Archive::save ); | 49 | Bu::Archive ar( ns, Bu::Archive::save ); |
46 | ar << hId; | 50 | ar << hId; |
51 | |||
52 | Bu::FString sName; | ||
53 | sName.format("hash-%d.%02d", time( NULL ), iCnt++ ); | ||
54 | Bu::File sTmp( sName, Bu::File::Write|Bu::File::Create ); | ||
55 | Bu::Archive artmp( sTmp, Bu::Archive::save ); | ||
56 | artmp << hId; | ||
47 | } | 57 | } |
48 | 58 | ||
49 | virtual obtype *load( const keytype &key ) | 59 | virtual obtype *load( const keytype &key ) |