/// <summary>Construct an edit log output stream which writes to a ledger.</summary> /// <exception cref="System.IO.IOException"/> protected internal BookKeeperEditLogOutputStream(Configuration conf, LedgerHandle lh) : base() { bufCurrent = new DataOutputBuffer(); outstandingRequests = new AtomicInteger(0); syncLatch = null; this.lh = lh; this.writer = new FSEditLogOp.Writer(bufCurrent); this.transmissionThreshold = conf.GetInt(BookKeeperJournalManager.BkjmOutputBufferSize , BookKeeperJournalManager.BkjmOutputBufferSizeDefault); }
/// <summary>Generate byte array representing a set of GarbageMkdirOp</summary> /// <exception cref="System.IO.IOException"/> public static byte[] CreateGabageTxns(long startTxId, int numTxns) { DataOutputBuffer buf = new DataOutputBuffer(); FSEditLogOp.Writer writer = new FSEditLogOp.Writer(buf); for (long txid = startTxId; txid < startTxId + numTxns; txid++) { FSEditLogOp op = new TestEditLog.GarbageMkdirOp(); op.SetTransactionId(txid); writer.WriteOp(op); } return(Arrays.CopyOf(buf.GetData(), buf.GetLength())); }
/// <exception cref="System.Exception"/> public static byte[] CreateTxnData(int startTxn, int numTxns) { DataOutputBuffer buf = new DataOutputBuffer(); FSEditLogOp.Writer writer = new FSEditLogOp.Writer(buf); for (long txid = startTxn; txid < startTxn + numTxns; txid++) { FSEditLogOp op = NameNodeAdapter.CreateMkdirOp("tx " + txid); op.SetTransactionId(txid); writer.WriteOp(op); } return(Arrays.CopyOf(buf.GetData(), buf.GetLength())); }
public TxnBuffer(int initBufferSize) : base(initBufferSize) { writer = new FSEditLogOp.Writer(this); Reset(); }