Esempio n. 1
0
/**
 * Binlog Sequence
 * @param {Object}   options  Binlog Options
 * @param {Function} callback When packet is decrypted
 */
function Binlog(options, callback) {
  if (!callback && typeof options === 'function') {
    callback = options;
    options = {};
  }

  /**
   * Default options
   */
  options = options || {};

  /**
   * Call the super()
   */
  Sequences.Sequence.call(this, callback);

  /**
   * Set the options locally.
   */
  this._position    = options.binlog_position   || 4;
  this._server_id   = options.server_id         || 1;
  this._filename    = options.binlog_file       || "";
  this._flags       = options.non_blocking      ? 1 : 0;
  this._checksums   = options.checksum_enabled  ? true : false;

  /**
   * Table map container, this is used by events to lookup
   * extra row data based on the tablerow event that was
   * received in a preveius packet
   */
  this._maps = {};

  /**
   * Fetch the parsers
   * @type {Object}
   */
  this._parsers = options.parsers;
}