lib/protocols.js
function Protocol(name, messages, types, handlers) {
  if (types === undefined) {
    // Let's be helpful in case this class is instantiated directly.
    return createProtocol(name, messages);
  }

  this._name = name;
  this._messages = messages;
  this._types = types;
  // Shared with subprotocols (via the prototype chain, overwriting is safe).
  this._handlers = handlers || {};
  // We cache a string rather than a buffer to not retain an entire slab. This
  // also lets us use hashes as keys inside maps (e.g. for resolvers).
  this._hs = utils.getHash(this.getSchema()).toString('binary');
}
function Protocol(name, messages, types, handlers) {
  if (types === undefined) {
    // Let's be helpful in case this class is instantiated directly.
    return createProtocol(name, messages);
  }

  this._name = name;
  this._messages = messages;
  this._types = types;
  // Shared with subprotocols (via the prototype chain, overwriting is safe).
  this._handlers = handlers || {};
  // We cache a string rather than a buffer to not retain an entire slab. This
  // also lets us use hashes as keys inside maps (e.g. for resolvers).
  this._hs = utils.getHash(this.getSchema()).toString('binary');
}
function Protocol ( name , messages , types , handlers ) { if ( types === undefined ) { // Let's be helpful in case this class is instantiated directly. return createProtocol ( name , messages ) ; } this . _name = name ; this . _messages = messages ; this . _types = types ; // Shared with subprotocols (via the prototype chain, overwriting is safe). this . _handlers = handlers || { } ; // We cache a string rather than a buffer to not retain an entire slab. This // also lets us use hashes as keys inside maps (e.g. for resolvers). this . _hs = utils . getHash ( this . getSchema ( ) ) . toString ( 'binary' ) ; }
An Avro protocol.
An Avro protocol .