Now that flush is only called at extreme events, such as before crashes
and abnormal termination, we really want the flush method to really
flush everything to disk, to prevent dropping calls.
-void ZLibFile::rawFlush(FlushType type)
+void ZLibFile::rawFlush()
{
gzflush(m_gzFile, Z_SYNC_FLUSH);
}
{
gzflush(m_gzFile, Z_SYNC_FLUSH);
}
- enum FlushType {
- FlushShallow,
- FlushDeep
- };
public:
static bool isZLibCompressed(const std::string &filename);
static bool isSnappyCompressed(const std::string &filename);
public:
static bool isZLibCompressed(const std::string &filename);
static bool isSnappyCompressed(const std::string &filename);
bool write(const void *buffer, int length);
bool read(void *buffer, int length);
void close();
bool write(const void *buffer, int length);
bool read(void *buffer, int length);
void close();
- void flush(FlushType type = FlushShallow);
virtual bool rawRead(void *buffer, int length) = 0;
virtual int rawGetc() = 0;
virtual void rawClose() = 0;
virtual bool rawRead(void *buffer, int length) = 0;
virtual int rawGetc() = 0;
virtual void rawClose() = 0;
- virtual void rawFlush(FlushType type) = 0;
+ virtual void rawFlush() = 0;
protected:
std::string m_filename;
protected:
std::string m_filename;
-inline void File::flush(File::FlushType type)
+inline void File::flush(void)
}
inline int File::getc()
}
inline int File::getc()
virtual bool rawRead(void *buffer, int length);
virtual int rawGetc();
virtual void rawClose();
virtual bool rawRead(void *buffer, int length);
virtual int rawGetc();
virtual void rawClose();
- virtual void rawFlush(FlushType type);
+ virtual void rawFlush();
private:
void *m_gzFile;
};
private:
void *m_gzFile;
};
-void SnappyFile::rawFlush(FlushType type)
+void SnappyFile::rawFlush()
- if (type == FlushDeep) {
- flushCache();
- }
virtual bool rawRead(void *buffer, int length);
virtual int rawGetc();
virtual void rawClose();
virtual bool rawRead(void *buffer, int length);
virtual int rawGetc();
virtual void rawClose();
- virtual void rawFlush(FlushType type);
+ virtual void rawFlush();
private:
inline int freeCacheSize() const
private:
inline int freeCacheSize() const