From d1f985c8191326292dd2ae5a85a63993ad68ddd7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 16 Sep 2024 10:27:52 -0700 Subject: It could use more testing, but...it works. --- src/stable/myriad.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/stable/myriad.h') diff --git a/src/stable/myriad.h b/src/stable/myriad.h index 6d99ee4..7cf6041 100644 --- a/src/stable/myriad.h +++ b/src/stable/myriad.h @@ -40,8 +40,8 @@ namespace Bu Write = 0x02, ///< Open file for writing Create = 0x04, ///< Create file if it doesn't exist Truncate = 0x08, ///< Truncate file if it does exist - Append = 0x10, ///< Always append on every write - NonBlock = 0x20, ///< Open file in non-blocking mode + Append = 0x10, ///< Start writing at end of file + //NonBlock = 0x20, ///< Open file in non-blocking mode Exclusive = 0x44, ///< Create file, if it exists then fail // Helpful mixes @@ -80,8 +80,12 @@ namespace Bu private: bool loadMyriad(); void createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks ); + void writeHeader(); + int32_t __calcHeaderSize(); int32_t allocateBlock(); + int32_t __allocateBlock(); void releaseBlock( int32_t iBlockId, bool bBlank=true ); + void __releaseBlock( int32_t iBlockId, bool bBlank=true ); void blankBlock( int32_t iBlockId ); void openStream( StreamId id ); @@ -124,6 +128,7 @@ namespace Bu int32_t read( int32_t iStart, void *pTarget, int32_t iSize ); int32_t write( int32_t iStart, const void *pTarget, int32_t iSize ); Bu::String getLocation() const; + Bu::Array getBlockList() const; /** * Doesn't actually open, just increments the open counter. @@ -150,9 +155,7 @@ namespace Bu }; private: - typedef Bu::Hash StreamHash; - typedef Bu::List IndexList; mutable Bu::Mutex mAccess; mutable Bu::Mutex mBacking; @@ -160,8 +163,10 @@ namespace Bu int32_t iBlockSize; int32_t iBlockCount; bool bIsNewStream; + bool bStructureChanged; StreamHash hStream; IndexList lFreeBlocks; + StreamId iLastUsedIndex; }; }; -- cgit v1.2.3