18 #ifndef FOEDUS_FS_DIRECT_IO_FILE_HPP_
19 #define FOEDUS_FS_DIRECT_IO_FILE_HPP_
188 file_descriptor descriptor_;
197 uint64_t current_offset_;
201 #endif // FOEDUS_FS_DIRECT_IO_FILE_HPP_
The offset is set to its current location plus offset bytes.
ErrorCode truncate(uint64_t new_length, bool sync=false)
Discard the content of the file after the given offset.
ErrorCode write(uint64_t desired_bytes, const foedus::memory::AlignedMemory &buffer)
Sequentially write the given amount of contents from the current position.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
bool close()
Close the file if not yet closed.
ErrorCode open(bool read, bool write, bool append, bool create)
Tries to open the file for the specified volume.
uint64_t get_current_offset() const
~DirectIoFile()
Automatically closes the file if it is opened.
ErrorCode read_raw(uint64_t desired_bytes, void *buffer)
A version that receives a raw pointer that has to be aligned (be careful to use this ver)...
Analogue of boost::filesystem::path.
The offset is set to the size of the file plus offset bytes.
Constants
Constant values.
bool is_opened() const
Whether the file is already and successfully opened.
SeekType
Analogue of SEEK_SET/SEEK_CUR/SEEK_END in POSIX.
ErrorCode sync()
Analogues of POSIX fsync().
ErrorCode seek(uint64_t offset, SeekType seek_type)
Sets the position of the next byte to be written/extracted from/to the stream.
ErrorCode read(uint64_t desired_bytes, foedus::memory::AlignedMemory *buffer)
Sequentially read the given amount of contents from the current position.
A slice of foedus::memory::AlignedMemory.
ErrorCode write_raw(uint64_t desired_bytes, const void *buffer)
A version that receives a raw pointer that has to be aligned (be careful to use this ver)...
Forward declarations of classes in memory package.
int file_descriptor
Represents low-level file descriptor.
file_descriptor get_descriptor() const
Set of configurations to emulate slower devices for some experiments.
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
Represents an I/O stream on one file without filesystem caching.
friend std::ostream & operator<<(std::ostream &o, const DirectIoFile &v)
Represents one memory block aligned to actual OS/hardware pages.
POSIX open() semantics says -1 is invalid or not-yet-opened.
The offset is set to offset bytes.
ErrorCode
Enum of error codes defined in error_code.xmacro.
std::string to_string() const
DeviceEmulationOptions get_emulation() const