summaryrefslogtreecommitdiff
path: root/lib/raidfile/RaidFileWrite.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/raidfile/RaidFileWrite.h')
-rwxr-xr-xlib/raidfile/RaidFileWrite.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/raidfile/RaidFileWrite.h b/lib/raidfile/RaidFileWrite.h
new file mode 100755
index 00000000..d7e51f21
--- /dev/null
+++ b/lib/raidfile/RaidFileWrite.h
@@ -0,0 +1,66 @@
+// --------------------------------------------------------------------------
+//
+// File
+// Name: RaidFileWrite.h
+// Purpose: Writing RAID like files
+// Created: 2003/07/10
+//
+// --------------------------------------------------------------------------
+
+#ifndef RAIDFILEWRITE__H
+#define RAIDFILEWRITE__H
+
+#include <string>
+
+#include "IOStream.h"
+
+class RaidFileDiscSet;
+
+// --------------------------------------------------------------------------
+//
+// Class
+// Name: RaidFileWrite
+// Purpose: Writing RAID like files
+// Created: 2003/07/10
+//
+// --------------------------------------------------------------------------
+class RaidFileWrite : public IOStream
+{
+public:
+ RaidFileWrite(int SetNumber, const std::string &Filename);
+ ~RaidFileWrite();
+private:
+ RaidFileWrite(const RaidFileWrite &rToCopy);
+
+public:
+ // IOStream interface
+ virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite); // will exception
+ virtual void Write(const void *pBuffer, int NBytes);
+ virtual pos_type GetPosition() const;
+ virtual void Seek(pos_type Offset, int SeekType);
+ virtual void Close(); // will discard the file! Use commit instead.
+ virtual bool StreamDataLeft();
+ virtual bool StreamClosed();
+
+ // Extra bits
+ void Open(bool AllowOverwrite = false);
+ void Commit(bool ConvertToRaidNow = false);
+ void Discard();
+ void TransformToRaidStorage();
+ void Delete();
+ pos_type GetFileSize();
+ pos_type GetDiscUsageInBlocks();
+
+ static void CreateDirectory(int SetNumber, const std::string &rDirName, bool Recursive = false, int mode = 0777);
+ static void CreateDirectory(const RaidFileDiscSet &rSet, const std::string &rDirName, bool Recursive = false, int mode = 0777);
+
+private:
+
+private:
+ int mSetNumber;
+ std::string mFilename;
+ int mOSFileHandle;
+};
+
+#endif // RAIDFILEWRITE__H
+