Skip to content
  • Libing Song's avatar
    cf10f4ad
    WL#10956 Binlog Storage Access API - Step1 Output Stream · cf10f4ad
    Libing Song authored
    Output stream means a place(object) where bytes data can be written into.
    - Basic_ostream
      It is the basic output stream interface, which only defines write()
      operation for writing bytes into somewhere.
    
      Basic_ostream interface is used in below functions of Log_event class and
      its children classes to replace IO_CACHE.
      - Log_event::write_header(Basic_ostream ostream, ...)
      - Log_event::write_footer(Basic_ostream ostream)
      - Log_event::write_data_header(Basic_ostream ostream)
      - Log_event::write_data_body(Basic_ostream ostream)
      - Log_event::write(Basic_ostream *ostream)
      and a few other write functions as well.
    
      With this change, binary events could be written anywhere we want.
      Below classes derives from Basic_ostream and implement the interface.
      - class Binlog_cache
      - class Binlog_ofile
      - class StringBuffer_ostream
      - class Transaction_message
    
      So binary events could be written into binlog cache or binary log directly.
      They also could be written into a memory buffer(StringBuffer_ostream) or
      a group replication Transaction_message.
    
      Because of StringBuffer_ostream and Transaction_message, Some IO_CACHEs and
      a IO_CACHE list(IO_CACHE_unused_list) is able removed from group replication
      code.
    
    - Binlog_ofile
      It defines a logical binlog file which wraps and hides the real storage
      layer operations. It provides the operations for controlling binlog files,
      like open, close, write, flush etc. When opening Binlog_file, it initializes
      the real storage. When writing an event to Binlog_file, it writes the
      event into the real storage. MYSQL_BIN_LOG code operates on a plain binlogs.
      It doesn't need to know/care the detail of low level storage
      operates(e.g. if it is encrypted or not).
    
    It derives from Basic_ostream, so events can be written into it directly.
    
    - Binlog_cache
      It defines a binlog cache container for store binlog events.
      It provides a few elegant interfaces for writing or reading binlog events
      into or from the container. It hides the detail of level storage details
      which binlog code doesn't need to know.
    
    It is derived from Basic_ostream, So we can pass it as argument to
      Xxx_log_evnet::write() for writing events into binlog cache.
    cf10f4ad
    WL#10956 Binlog Storage Access API - Step1 Output Stream
    Libing Song authored
    Output stream means a place(object) where bytes data can be written into.
    - Basic_ostream
      It is the basic output stream interface, which only defines write()
      operation for writing bytes into somewhere.
    
      Basic_ostream interface is used in below functions of Log_event class and
      its children classes to replace IO_CACHE.
      - Log_event::write_header(Basic_ostream ostream, ...)
      - Log_event::write_footer(Basic_ostream ostream)
      - Log_event::write_data_header(Basic_ostream ostream)
      - Log_event::write_data_body(Basic_ostream ostream)
      - Log_event::write(Basic_ostream *ostream)
      and a few other write functions as well.
    
      With this change, binary events could be written anywhere we want.
      Below classes derives from Basic_ostream and implement the interface.
      - class Binlog_cache
      - class Binlog_ofile
      - class StringBuffer_ostream
      - class Transaction_message
    
      So binary events could be written into binlog cache or binary log directly.
      They also could be written into a memory buffer(StringBuffer_ostream) or
      a group replication Transaction_message.
    
      Because of StringBuffer_ostream and Transaction_message, Some IO_CACHEs and
      a IO_CACHE list(IO_CACHE_unused_list) is able removed from group replication
      code.
    
    - Binlog_ofile
      It defines a logical binlog file which wraps and hides the real storage
      layer operations. It provides the operations for controlling binlog files,
      like open, close, write, flush etc. When opening Binlog_file, it initializes
      the real storage. When writing an event to Binlog_file, it writes the
      event into the real storage. MYSQL_BIN_LOG code operates on a plain binlogs.
      It doesn't need to know/care the detail of low level storage
      operates(e.g. if it is encrypted or not).
    
    It derives from Basic_ostream, so events can be written into it directly.
    
    - Binlog_cache
      It defines a binlog cache container for store binlog events.
      It provides a few elegant interfaces for writing or reading binlog events
      into or from the container. It hides the detail of level storage details
      which binlog code doesn't need to know.
    
    It is derived from Basic_ostream, So we can pass it as argument to
      Xxx_log_evnet::write() for writing events into binlog cache.
Loading