Redigera

Dela via


CachedMessageBlock<TCachedMessage> Class

Definition

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<TCachedMessage> : Orleans.Providers.Streams.Common.PooledResource<Orleans.Providers.Streams.Common.CachedMessageBlock<TCachedMessage>> where TCachedMessage : struct
type CachedMessageBlock<'CachedMessage (requires 'CachedMessage : struct)> = class
    inherit PooledResource<CachedMessageBlock<'CachedMessage>>
Public Class CachedMessageBlock(Of TCachedMessage)
Inherits PooledResource(Of CachedMessageBlock(Of TCachedMessage))

Type Parameters

TCachedMessage

Tightly packed structure. Struct should contain only value types.

Inheritance
CachedMessageBlock<TCachedMessage>

Constructors

CachedMessageBlock<TCachedMessage>(Int32)

Block of cached messages

Properties

HasCapacity

More messages can be added to the blocks

IsEmpty

Block is empty

Item[Int32]

Access the cached message at the provided index.

ItemCount

Message count in this block

NewestMessage

Newest message in this block

NewestMessageIndex

Index of most recent message added to the block

Node

Linked list node, so this message block can be kept in a linked list

OldestMessage

Oldest message in the block

OldestMessageIndex

Index of oldest message in this block

Pool

Gets the pool to return this resource to upon disposal. A pool must set this property upon resource allocation.

(Inherited from PooledResource<T>)

Methods

Add<TQueueMessage>(TQueueMessage, DateTime, ICacheDataAdapter<TQueueMessage,TCachedMessage>)

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.

Dispose()

Returns item to pool.

(Inherited from PooledResource<T>)
GetIndexOfFirstMessageLessThanOrEqualTo(StreamSequenceToken, ICacheDataComparer<TCachedMessage>)

Gets the index of the first message in this block that has a sequence token at or before the provided token

GetNewestSequenceToken<TQueueMessage>(ICacheDataAdapter<TQueueMessage,TCachedMessage>)

Gets the sequence token of the newest message in this block

GetOldestSequenceToken<TQueueMessage>(ICacheDataAdapter<TQueueMessage,TCachedMessage>)

Gets the sequence token of the oldest message in this block

GetSequenceToken<TQueueMessage>(Int32, ICacheDataAdapter<TQueueMessage,TCachedMessage>)

Gets the sequence token of the cached message a the provided index

OnResetState()

Resets this blocks state to that of an empty block.

Remove()

Removes a message from the start of the block (oldest data). Returns true if more items are still available.

SignalPurge()

If this object is to be used in a fixed size object pool, this call should be overridden with the purge implementation that returns the object to the pool.

(Inherited from PooledResource<T>)
TryFindFirstMessage(IStreamIdentity, ICacheDataComparer<TCachedMessage>, Int32)

Tries to find the first message in the block that is part of the provided stream.

TryFindNextMessage(Int32, IStreamIdentity, ICacheDataComparer<TCachedMessage>, Int32)

Tries to get the next message from the provided stream, starting at the start index.

Applies to