NAME

Myriad::Transport::Memory - In-Memory data layer that mimics Redis behaviour..

SYNOPSIS

my $transport = Myriad::Transport::Memory->new();

$transport->publish('channel_name', 'event...');

DESCRIPTION

Exceptions

StreamNotFound

Thrown when the operation requires the stream to be created beforehand but the stream is not currently available.

GroupExists

Thrown when the user is trying to re-create a group but the operation doesn't allow that.

GroupNotFound

Thrown when the operation requires the group to be exist but it's not.

create_stream

Creats an empty stream.

  • stream_name - The name of the stream.

stream_info

Return stream details

  • stream_name - The name of the stream.

add_to_stream

Adds a new item to a stream, if the stream doesn't exist it'll be created.

  • stream_name - The name of the stream.

  • data - A perl hash that contains the user data.

create_consumer_group

Creates a consumer group for a given stream.

  • stream_name - The name of the stream.

  • group_name - The name of the group that is going to be created.

  • offset - If set the group will see this value as the first message in the stream.

  • make_stream - If set and the stream doesn't exist it'll be created.

read_from_stream

Read elements from the stream.

This operation is stateless you can re-read the same message as long as it exists in the stream.

  • stream_name - The name of the stream.

  • offset - The number of messages to skip.

  • count - The limit of messages to be received.

read_from_stream_by_consumer

Read elements from the stream for the given group.

This operation is stateful if the message read by a consumer "A" it won't be available for consumer "B" also consumer "A" won't be able to re-read the message using this call.

This is not exaclty how Redis works but it covers our need at the moment.

  • stream_name - The name of the stream should exist before calling this sub.

  • group_name - The name of the group should exist before callingg this sub.

  • consumer_name - The current consumer name, will be used to keep tracking of pendign messages.

  • offset - If given the consumer can skip the given number of messages.

  • count - The limit of messages to be received.

pending_stream_by_consumer

Read pending elements from the stream for the given group.

This operation will return messages consumed but not yet acknowledged only. It will return items regardless of their consumer.

  • stream_name - The name of the stream should exist before calling this sub.

  • group_name - The name of the group should exist before callingg this sub.

  • consumer_name - The current consumer name, will be used to keep tracking of pendign messages.

  • offset - If given the consumer can skip the given number of messages.

  • count - The limit of messages to be received.

  • stream_name - The name of the stream.

  • group_name - The name of group that has this message as pending.

  • message_id - The Id of the message that we want to acknowledge.

claim_message

Re-assign a message to another consumer.

It'll return the full message.

  • stream_name - The name of the stream.

  • group_name - The name of the group that has the message as pending.

  • consumer_name - The name of the new consumer.

  • message_id - The id of the message to be claimed.

publish

Publish a message, if no consumer exists the message will be lost.

  • channel_name - The name of the channel that the message will be published to.

  • message - A scalar that is going to be published.

subscribe

Subscribe to a channel by optaining a Ryu::Source that'll receive events.

  • channel_name - The name of the channel.

stream_groups_info

Get information about the stream's groups.

exists

Checks if a given key exists or not.

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, adopted_futures, can_event, children, configure, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, notifier_name, parent, remove_child, remove_from_parent

Object::Pad::UNIVERSAL

BUILDARGS