Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memowe/eventstore-tiny
A minimal event sourcing framework
https://github.com/memowe/eventstore-tiny
event-sourcing framework perl
Last synced: about 1 month ago
JSON representation
A minimal event sourcing framework
- Host: GitHub
- URL: https://github.com/memowe/eventstore-tiny
- Owner: memowe
- License: mit
- Created: 2018-01-16T15:20:10.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2021-07-22T14:15:28.000Z (over 3 years ago)
- Last Synced: 2024-11-06T08:08:45.505Z (3 months ago)
- Topics: event-sourcing, framework, perl
- Language: Perl
- Size: 157 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE.txt
Awesome Lists containing this project
README
[![CPAN testers reports](https://img.shields.io/badge/testers-reports-blue.svg)](http://www.cpantesters.org/distro/E/EventStore-Tiny.html?distmat=1)
[![CPAN testers matrix](https://img.shields.io/badge/testers-matrix-blue.svg)](http://matrix.cpantesters.org/?dist=EventStore-Tiny)
[![CPAN version](https://badge.fury.io/pl/EventStore-Tiny.svg)](https://badge.fury.io/pl/EventStore-Tiny)
[![GitHub repository](https://img.shields.io/badge/github-code-blue.svg)](https://github.com/memowe/EventStore-Tiny)
[![GitHub issue tracker](https://img.shields.io/badge/github-issues-blue.svg)](https://github.com/memowe/EventStore-Tiny/issues)
[![Linux tests](https://github.com/memowe/EventStore-Tiny/actions/workflows/linux-tests.yml/badge.svg?branch=main)](https://github.com/memowe/EventStore-Tiny/actions/workflows/linux-tests.yml)# EventStore::Tiny
A minimal event sourcing framework.
## Example
```perl
use EventStore::Tiny;my $store = EventStore::Tiny->new;
# Register event type
$store->register_event(UserAdded => sub ($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
- See the module's POD ([EventStore::Tiny on MetaCPAN][mcpan]) for details.
- See [Tamagotchi.pm][tpm] and [tamagotchi.t][tt] for a non-trivial demo.[mcpan]: https://metacpan.org/pod/EventStore::Tiny
[tpm]: t/9_demo/lib/Tamagotchi.pm
[tt]: t/9_demo/tamagotchi.t## Author and license
Copyright (c) 2018-2021 [Mirko Westermeier][mw] ([\@memowe][gh], [[email protected]][mail])
Released under the MIT License (see [LICENSE.txt][license]).
### Contributors
- Mohammad S Anwar ([\@manwar][manwar])
- Toby Inkster ([\@tobyink][tobyink])[mw]: http://mirko.westermeier.de
[gh]: https://github.com/memowe
[mail]: mailto:[email protected]
[license]: LICENSE.txt
[manwar]: https://github.com/manwar
[tobyink]: https://github.com/tobyink