MySQL  8.0.27
Source Code Documentation
IO_CACHE_ostream Class Reference

An output stream based on IO_CACHE class. More...

#include <basic_ostream.h>

Inheritance diagram for IO_CACHE_ostream:
Truncatable_ostream Basic_ostream

Public Member Functions

 IO_CACHE_ostream ()
 
IO_CACHE_ostreamoperator= (const IO_CACHE_ostream &)=delete
 
 IO_CACHE_ostream (const IO_CACHE_ostream &)=delete
 
 ~IO_CACHE_ostream () override
 
bool open (PSI_file_key log_file_key, const char *file_name, myf flags)
 Open the output stream. More...
 
bool close ()
 Closes the stream. More...
 
bool write (const unsigned char *buffer, my_off_t length) override
 Write some bytes into the output stream. More...
 
bool seek (my_off_t offset) override
 Put the write position to a given offset. More...
 
bool truncate (my_off_t offset) override
 Truncate some data at the end of the output stream. More...
 
bool flush () override
 Flush data to IO_CACHE's file if there is any data in IO_CACHE's buffer. More...
 
bool sync () override
 Syncs the file to disk. More...
 
- Public Member Functions inherited from Truncatable_ostream
 ~Truncatable_ostream () override=default
 
- Public Member Functions inherited from Basic_ostream
virtual ~Basic_ostream ()=default
 

Private Attributes

IO_CACHE m_io_cache
 

Detailed Description

An output stream based on IO_CACHE class.

Constructor & Destructor Documentation

◆ IO_CACHE_ostream() [1/2]

IO_CACHE_ostream::IO_CACHE_ostream ( )
default

◆ IO_CACHE_ostream() [2/2]

IO_CACHE_ostream::IO_CACHE_ostream ( const IO_CACHE_ostream )
delete

◆ ~IO_CACHE_ostream()

IO_CACHE_ostream::~IO_CACHE_ostream ( )
override

Member Function Documentation

◆ close()

bool IO_CACHE_ostream::close ( )

Closes the stream.

It deinitializes IO_CACHE and close the file it opened.

Return values
falseSuccess
trueError

◆ flush()

bool IO_CACHE_ostream::flush ( )
overridevirtual

Flush data to IO_CACHE's file if there is any data in IO_CACHE's buffer.

Return values
falseSuccess
trueError

Implements Truncatable_ostream.

◆ open()

bool IO_CACHE_ostream::open ( PSI_file_key  log_file_key,
const char *  file_name,
myf  flags 
)

Open the output stream.

It opens related file and initialize IO_CACHE.

Parameters
[in]log_file_keyThe PSI_file_key for this stream
[in]file_nameThe file will be opened
[in]flagsThe flags used by IO_CACHE.
Return values
falseSuccess
trueError

◆ operator=()

IO_CACHE_ostream& IO_CACHE_ostream::operator= ( const IO_CACHE_ostream )
delete

◆ seek()

bool IO_CACHE_ostream::seek ( my_off_t  offset)
overridevirtual

Put the write position to a given offset.

The offset counts from the beginning of the file.

Parameters
[in]offsetWhere the write position will be
Return values
falseSuccess
trueError

Implements Truncatable_ostream.

◆ sync()

bool IO_CACHE_ostream::sync ( )
overridevirtual

Syncs the file to disk.

It doesn't check and flush any remaining data still left in IO_CACHE's bufffer. So a call to flush() is necessary in order to persist all data including the data in buffer.

Return values
falseSuccess
trueError

Implements Truncatable_ostream.

◆ truncate()

bool IO_CACHE_ostream::truncate ( my_off_t  offset)
overridevirtual

Truncate some data at the end of the output stream.

Parameters
[in]offsetWhere the output stream will be truncated to.
Return values
falseSuccess
trueError

Implements Truncatable_ostream.

◆ write()

bool IO_CACHE_ostream::write ( const unsigned char *  buffer,
my_off_t  length 
)
overridevirtual

Write some bytes into the output stream.

When all data is written into the stream successfully, then it return false. Otherwise, true is returned. It will never returns false when partial data is written into the stream.

Parameters
[in]bufferData to be written
[in]lengthLength of the data
Return values
falseSuccess.
trueError.

Implements Basic_ostream.

Member Data Documentation

◆ m_io_cache

IO_CACHE IO_CACHE_ostream::m_io_cache
private

The documentation for this class was generated from the following files: