public void Setup() { _consumer = A.Fake <IntObjConsumer <string> >(); _metaData = A.Fake <CountersReader.MetaData>(); _labelsBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(NumberOfCounters * CountersReader.METADATA_LENGTH)); _counterBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(NumberOfCounters * CountersReader.COUNTER_LENGTH)); _manager = new CountersManager(_labelsBuffer, _counterBuffer, Encoding.ASCII); _otherManager = new CountersManager(_labelsBuffer, _counterBuffer, Encoding.ASCII); }
/// <summary> /// Wrap a <seealso cref="BroadcastReceiver"/> to simplify the API for receiving messages. /// </summary> /// <param name="receiver"> to be wrapped. </param> public CopyBroadcastReceiver(BroadcastReceiver receiver) { _receiver = receiver; _scratchBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(ScratchBufferSize)); while (receiver.ReceiveNext()) { // If we're reconnecting to a broadcast buffer then we need to // scan ourselves up to date, otherwise we risk "falling behind" // the buffer due to the time taken to catchup. } }
public void ShouldVerifyBufferAlignment() { var buffer = new UnsafeBuffer(BufferUtil.AllocateDirect(1024)); try { buffer.VerifyAlignment(); } catch (InvalidOperationException ex) { Assert.Fail("All buffers should be aligned " + ex); } }
public void Setup() { _testClock = new TestEpochClock(); _consumer = A.Fake <IntObjConsumer <string> >(); _metaData = A.Fake <CountersReader.MetaData>(); _labelsBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(NumberOfCounters * CountersReader.METADATA_LENGTH)); _counterBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(NumberOfCounters * CountersReader.COUNTER_LENGTH)); _manager = new CountersManager(_labelsBuffer, _counterBuffer, Encoding.ASCII); _reader = new CountersManager(_labelsBuffer, _counterBuffer, Encoding.ASCII); _managerWithCooldown = new CountersManager(_labelsBuffer, _counterBuffer, Encoding.ASCII, _testClock, FREE_TO_REUSE_TIMEOUT); }
/// <summary> /// Wrap a <seealso cref="BroadcastReceiver"/> to simplify the API for receiving messages. /// </summary> /// <param name="receiver"> to be wrapped. </param> public CopyBroadcastReceiver(BroadcastReceiver receiver) { _receiver = receiver; _scratchBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(ScratchBufferSize)); }
/// <summary> /// Wrap a <seealso cref="BroadcastReceiver"/> to simplify the API for receiving messages. /// </summary> /// <param name="receiver"> to be wrapped. </param> /// <param name="scratchBufferLength"> is the maximum length of a message to be copied when receiving.</param> public CopyBroadcastReceiver(BroadcastReceiver receiver, int scratchBufferLength) { _receiver = receiver; _scratchBuffer = new UnsafeBuffer(BufferUtil.AllocateDirect(scratchBufferLength)); }
public void Setup() { conductorBuffer = new ManyToOneRingBuffer(new UnsafeBuffer(BufferUtil.AllocateDirect(RingBufferDescriptor.TrailerLength + 1024))); conductor = new DriverProxy(conductorBuffer, CLIENT_ID); }