diff options
Diffstat (limited to '')
-rw-r--r-- | src/stable/myriad.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/stable/myriad.cpp b/src/stable/myriad.cpp index 1bf2301..0bd2ff2 100644 --- a/src/stable/myriad.cpp +++ b/src/stable/myriad.cpp | |||
@@ -74,7 +74,7 @@ Bu::MyriadStream Bu::Myriad::create( Bu::Myriad::Mode eMode, | |||
74 | mhStream.unlock(); | 74 | mhStream.unlock(); |
75 | bStructureChanged = true; | 75 | bStructureChanged = true; |
76 | 76 | ||
77 | return Bu::MyriadStream( *this, pStream, (Mode)(eMode&ReadWrite) ); | 77 | return Bu::MyriadStream( *this, pStream, eMode&ReadWrite ); |
78 | } | 78 | } |
79 | 79 | ||
80 | Bu::MyriadStream Bu::Myriad::open( Bu::Myriad::StreamId iStream, | 80 | Bu::MyriadStream Bu::Myriad::open( Bu::Myriad::StreamId iStream, |
@@ -144,6 +144,18 @@ void Bu::Myriad::setSize( Bu::Myriad::StreamId iStream, | |||
144 | pStream->setSize( iNewSize ); | 144 | pStream->setSize( iNewSize ); |
145 | } | 145 | } |
146 | 146 | ||
147 | int32_t Bu::Myriad::getSize( StreamId iStream ) const | ||
148 | { | ||
149 | Bu::MutexLocker l( mhStream ); | ||
150 | return hStream.get( iStream )->getSize(); | ||
151 | } | ||
152 | |||
153 | bool Bu::Myriad::exists( StreamId iStream ) const | ||
154 | { | ||
155 | Bu::MutexLocker l( mhStream ); | ||
156 | return hStream.has( iStream ); | ||
157 | } | ||
158 | |||
147 | Bu::String Bu::Myriad::getLocation() const | 159 | Bu::String Bu::Myriad::getLocation() const |
148 | { | 160 | { |
149 | Bu::MutexLocker l( mAccess ); | 161 | Bu::MutexLocker l( mAccess ); |
@@ -218,6 +230,11 @@ int32_t Bu::Myriad::getTotalUnusedBytes(int32_t iAssumeBlockSize ) const | |||
218 | return iTotal; | 230 | return iTotal; |
219 | } | 231 | } |
220 | 232 | ||
233 | void Bu::Myriad::sync() | ||
234 | { | ||
235 | writeHeader(); | ||
236 | } | ||
237 | |||
221 | bool Bu::Myriad::loadMyriad() | 238 | bool Bu::Myriad::loadMyriad() |
222 | { | 239 | { |
223 | Bu::println("Load myriad!"); | 240 | Bu::println("Load myriad!"); |
@@ -417,12 +434,12 @@ void Bu::Myriad::createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks ) | |||
417 | 434 | ||
418 | void Bu::Myriad::writeHeader() | 435 | void Bu::Myriad::writeHeader() |
419 | { | 436 | { |
437 | Bu::MutexLocker l( mAccess ); | ||
420 | if( !rBacking.isWritable() ) | 438 | if( !rBacking.isWritable() ) |
421 | return; | 439 | return; |
422 | Bu::println("Writing stream breakdown:"); | 440 | Bu::println("Writing stream breakdown:"); |
423 | Bu::MemBuf mbHeader; | 441 | Bu::MemBuf mbHeader; |
424 | { | 442 | { |
425 | Bu::MutexLocker l( mAccess ); | ||
426 | Bu::MutexLocker l2( mhStream ); | 443 | Bu::MutexLocker l2( mhStream ); |
427 | 444 | ||
428 | int32_t iHdrStreamSize = __calcHeaderSize(); | 445 | int32_t iHdrStreamSize = __calcHeaderSize(); |