// Generated by CoffeeScript 1.7.1
var TXNDESCRIPTOR_HEADER_DATA_LEN, TXNDESCRIPTOR_HEADER_LEN, TYPE, WritableTrackingBuffer;

WritableTrackingBuffer = require('./tracking-buffer/tracking-buffer').WritableTrackingBuffer;

TYPE = {
  QUERY_NOTIFICATIONS: 1,
  TXN_DESCRIPTOR: 2,
  TRACE_ACTIVITY: 3
};

TXNDESCRIPTOR_HEADER_DATA_LEN = 4 + 8;

TXNDESCRIPTOR_HEADER_LEN = 4 + 2 + TXNDESCRIPTOR_HEADER_DATA_LEN;

exports.writeToTrackingBuffer = function(buffer, txnDescriptor, outstandingRequestCount) {
  var data;
  buffer.writeUInt32LE(0);
  buffer.writeUInt32LE(TXNDESCRIPTOR_HEADER_LEN);
  buffer.writeUInt16LE(TYPE.TXN_DESCRIPTOR);
  buffer.writeBuffer(txnDescriptor);
  buffer.writeUInt32LE(outstandingRequestCount);
  data = buffer.data;
  data.writeUInt32LE(data.length, 0);
  return buffer;
};
