A minimal event sourcing framework
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/EventStore
t
.gitignore
.travis.yml
Changes
LICENSE.txt
Makefile.PL
README.md
TODO_DIST.md
perlcritic.rc

README.md

CPAN version Travis CI tests Codecov test coverage Coveralls test coverage CPANTS kwalitee score
CPAN testers reports CPAN testers matrix GitHub repository GitHub issue tracker

EventStore::Tiny

A minimal event sourcing framework.

Example

use EventStore::Tiny;

my $store = EventStore::Tiny->new;

# Register event type
$store->register_event(UserAdded => sub {
    my ($state, $data) = @_;

    # Use $data to inject the new user into the given $state
    $state->{users}{$data->{id}} = {
        name => $data->{name},
    };
});

# ...

# Store an event instance represented by type and data
$store->store_event(UserAdded => {id => 17, name => 'Bob'});

# ...

# Work with the current state snapshot generated by event application
say 'His name is ' . $store->snapshot->state->{users}{17}{name}; # Bob

Intro

In Event Sourcing, the state of a system is calculated as the application of a stream of events representing each change of the system. This framework is a minimal approach to use these mechanics in simple perl systems.

Features

  • Flexible snapshots (high-resolution timestamps) and event substreams
  • Customizable event logging
  • Simple storage solution for events in the file system
  • Transparent snapshot caching mechanism to improve performance

Read more

Author and license

Copyright (c) 2018 Mirko Westermeier (@memowe, mirko@westermeier.de)

Released under the MIT License (see LICENSE.txt).

Contributors