diff options
| author | Mike Buland <mike@xagasoft.com> | 2024-09-26 14:43:22 -0700 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2024-09-26 14:43:22 -0700 |
| commit | 76821551f312dd447a03748a01670f3718cd8345 (patch) | |
| tree | aca702a69c9eb3f7dd8080dcd20d7f238bbbaa81 /src/stable/myriad.cpp | |
| parent | d5e966a0563e3f01c02c3cfb1f3a83fec852168b (diff) | |
| download | libbu++-76821551f312dd447a03748a01670f3718cd8345.tar.gz libbu++-76821551f312dd447a03748a01670f3718cd8345.tar.bz2 libbu++-76821551f312dd447a03748a01670f3718cd8345.tar.xz libbu++-76821551f312dd447a03748a01670f3718cd8345.zip | |
Basic update to new API for existing components.
This may not all work yet, but it all compiles!
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(); |
