aboutsummaryrefslogtreecommitdiff
path: root/src/stable/myriad.h
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2024-09-16 10:27:52 -0700
committerMike Buland <mike@xagasoft.com>2024-09-16 10:27:52 -0700
commitd1f985c8191326292dd2ae5a85a63993ad68ddd7 (patch)
tree51d3f648936f28421bacc18c3bb0d4670b58259e /src/stable/myriad.h
parent0886ad4f53deb8e148f87f77b9e7ff690c02b069 (diff)
downloadlibbu++-d1f985c8191326292dd2ae5a85a63993ad68ddd7.tar.gz
libbu++-d1f985c8191326292dd2ae5a85a63993ad68ddd7.tar.bz2
libbu++-d1f985c8191326292dd2ae5a85a63993ad68ddd7.tar.xz
libbu++-d1f985c8191326292dd2ae5a85a63993ad68ddd7.zip
It could use more testing, but...it works.
Diffstat (limited to 'src/stable/myriad.h')
-rw-r--r--src/stable/myriad.h13
1 files changed, 9 insertions, 4 deletions
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
40 Write = 0x02, ///< Open file for writing 40 Write = 0x02, ///< Open file for writing
41 Create = 0x04, ///< Create file if it doesn't exist 41 Create = 0x04, ///< Create file if it doesn't exist
42 Truncate = 0x08, ///< Truncate file if it does exist 42 Truncate = 0x08, ///< Truncate file if it does exist
43 Append = 0x10, ///< Always append on every write 43 Append = 0x10, ///< Start writing at end of file
44 NonBlock = 0x20, ///< Open file in non-blocking mode 44 //NonBlock = 0x20, ///< Open file in non-blocking mode
45 Exclusive = 0x44, ///< Create file, if it exists then fail 45 Exclusive = 0x44, ///< Create file, if it exists then fail
46 46
47 // Helpful mixes 47 // Helpful mixes
@@ -80,8 +80,12 @@ namespace Bu
80 private: 80 private:
81 bool loadMyriad(); 81 bool loadMyriad();
82 void createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks ); 82 void createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks );
83 void writeHeader();
84 int32_t __calcHeaderSize();
83 int32_t allocateBlock(); 85 int32_t allocateBlock();
86 int32_t __allocateBlock();
84 void releaseBlock( int32_t iBlockId, bool bBlank=true ); 87 void releaseBlock( int32_t iBlockId, bool bBlank=true );
88 void __releaseBlock( int32_t iBlockId, bool bBlank=true );
85 void blankBlock( int32_t iBlockId ); 89 void blankBlock( int32_t iBlockId );
86 90
87 void openStream( StreamId id ); 91 void openStream( StreamId id );
@@ -124,6 +128,7 @@ namespace Bu
124 int32_t read( int32_t iStart, void *pTarget, int32_t iSize ); 128 int32_t read( int32_t iStart, void *pTarget, int32_t iSize );
125 int32_t write( int32_t iStart, const void *pTarget, int32_t iSize ); 129 int32_t write( int32_t iStart, const void *pTarget, int32_t iSize );
126 Bu::String getLocation() const; 130 Bu::String getLocation() const;
131 Bu::Array<int32_t> getBlockList() const;
127 132
128 /** 133 /**
129 * Doesn't actually open, just increments the open counter. 134 * Doesn't actually open, just increments the open counter.
@@ -150,9 +155,7 @@ namespace Bu
150 }; 155 };
151 156
152 private: 157 private:
153
154 typedef Bu::Hash<StreamId, Stream *> StreamHash; 158 typedef Bu::Hash<StreamId, Stream *> StreamHash;
155
156 typedef Bu::List<int32_t> IndexList; 159 typedef Bu::List<int32_t> IndexList;
157 mutable Bu::Mutex mAccess; 160 mutable Bu::Mutex mAccess;
158 mutable Bu::Mutex mBacking; 161 mutable Bu::Mutex mBacking;
@@ -160,8 +163,10 @@ namespace Bu
160 int32_t iBlockSize; 163 int32_t iBlockSize;
161 int32_t iBlockCount; 164 int32_t iBlockCount;
162 bool bIsNewStream; 165 bool bIsNewStream;
166 bool bStructureChanged;
163 StreamHash hStream; 167 StreamHash hStream;
164 IndexList lFreeBlocks; 168 IndexList lFreeBlocks;
169 StreamId iLastUsedIndex;
165 }; 170 };
166}; 171};
167 172