CachedMessageBlock
class
Namespace: Orleans.Providers.Streams.Common
CachedMessageBlock is a block of tightly packed structures containing tracking data for cached messages. This data is tightly packed to reduced GC pressure. The tracking data is used by the queue cache to walk the cache serving ordered queue messages by stream.
public class CachedMessageBlock : PooledResource<CachedMessageBlock>Constructors
CachedMessageBlock(int)Block of cached messages.
Properties
HasCapacityGets a value indicating whether more messages can be added to the block.IsEmptyGets a value indicating whether this block is empty.ItemCountGets the number of messages in this block.NewestMessageGets the newest message in this block.NewestMessageIndexGets the index of most recent message added to the block.NodeLinked list node, so this message block can be kept in a linked list.OldestMessageGets the oldest message in the block.OldestMessageIndexGets the index of the oldest message in this block.
Methods
Add(CachedMessage)Add a message from the queue to the block. Converts the queue message to a cached message and stores it at the end of the block.GetIndexOfFirstMessageLessThanOrEqualTo(StreamSequenceToken)Gets the index of the first message in this block that has a sequence token at or before the provided tokenGetNewestSequenceToken(ICacheDataAdapter)Gets the sequence token of the newest message in this blockGetOldestSequenceToken(ICacheDataAdapter)Gets the sequence token of the oldest message in this blockGetSequenceToken(int, ICacheDataAdapter)Gets the sequence token of the cached message a the provided indexOnResetStateNotifies the object that it has been purged, so it can reset itself to the state of a newly allocated object.RemoveRemoves a message from the start of the block (oldest data).TryFindFirstMessage(StreamId, ICacheDataAdapter, int)Tries to find the first message in the block that is part of the provided stream.TryFindNextMessage(int, StreamId, ICacheDataAdapter, int)Tries to get the next message from the provided stream, starting at the start index.
Indexers
this[int]Access the cached message at the provided index.
