Documentation ¶
Index ¶
- type Queue
- func (q *Queue[V]) Container() sdkcollections.Map[uint64, V]
- func (q *Queue[V]) Len(ctx context.Context) (uint64, error)
- func (q *Queue[V]) Peek(ctx context.Context) (V, error)
- func (q *Queue[V]) PeekMulti(ctx context.Context, n uint64) ([]V, error)
- func (q *Queue[V]) Pop(ctx context.Context) (V, error)
- func (q *Queue[V]) PopMulti(ctx context.Context, n uint64) ([]V, error)
- func (q *Queue[V]) Push(ctx context.Context, value V) error
- func (q *Queue[V]) PushMulti(ctx context.Context, values []V) error
- func (q *Queue[V]) UnsafePeek(ctx context.Context) (V, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue[V any] struct { // contains filtered or unexported fields }
Queue is a simple queue implementation that uses a map and two sequences. TODO: Check atomicity of write operations.
func NewQueue ¶
func NewQueue[V any]( schema *sdkcollections.SchemaBuilder, name string, valueCodec sdkcodec.ValueCodec[V], ) *Queue[V]
NewQueue creates a new queue with the provided prefix and name.
func (*Queue[V]) Container ¶
func (q *Queue[V]) Container() sdkcollections.Map[uint64, V]
Container returns the underlying map container of the queue.
func (*Queue[V]) PopMulti ¶
PopMulti returns the top n elements of the queue and removes them from the queue.
Click to show internal directories.
Click to hide internal directories.