NAME
Convos::Core::Backend - Convos storage backend
DESCRIPTION
Convos::Core::Backend is a base class for storage backends. See Convos::Core::Backend::File for code that actually perist data.
ATTRIBUTES
Convos::Core::Backend inherits all attributes from Mojo::EventEmitter and implements the following new ones.
METHODS
Convos::Core::Backend inherits all methods from Mojo::EventEmitter and implements the following new ones.
connections
$self = $self->connections($user, sub { my ($self, $err, $connections) = @_ });
Used to find a list of connection names for a given $user.
emit_single
$self = $self->emit_single($event => @args, sub { my ($self, $err) = @_; });
$self = $self->emit_single($event => @args);
Will "emit" in Mojo::EventEmitter $event
to a single subscriber, if any. This method willdie()
or pass an error to the callback, if none or more than one listens to $event
.
delete_object
$self = $self->delete_object($obj, sub { my ($self, $err) = @_ });
This method is called to remove a given object from persistent storage.
load_object
$self = $self->load_object($obj, sub { my ($self, $err, $data) = @_ });
This method will load $data
for $obj
.
messages
$self->messages(\%query, sub { my ($self, $err, $messages) = @_; });
Used to search for messages stored in backend. The callback will be called with the messages found.
Possible %query
:
{
after => $datetime, # find messages after a given ISO 8601 timestamp
before => $datetime, # find messages before a given ISO 8601 timestamp
level => $str, # debug, info (default), warn, error
limit => $int, # max number of messages to retrieve
match => $regexp, # filter messages by a regexp
}
new
Will also call _setup()
after the object is created.
notifications
$self->notifications($user, \%query, sub { my ($self, $err, $notifications) = @_; });
This method will return notifications, in the same structure as "messages".
save_object
$self->save_object($obj, sub { my ($self, $err) = @_; });
This method is called to save a given object to persistent storage.
users
$self = $self->users(sub { my ($self, $err, $users) = @_ });
Used to find a list of user emails.
AUTHOR
Jan Henning Thorsen - jhthorsen@cpan.org