Giter Club home page Giter Club logo

eventsourcing's People

Contributors

thoferon avatar tomferon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

agentultra essic

eventsourcing's Issues

Library to handle public identifiers

Helpers to create a global registry (possibly sharded) of public identifiers such that we can go from a pair of a public identifier and a stream family to a fully qualified stream identifier (FQSI) containing a database pool, a shard ID, the stream family and a stream identifier.

From a FQSI, we have all the information required to actually find the corresponding stream.

Public identifiers could have a form such as "[shard]:[UUIDv4]" while FQSI could be "[pool name]:[shard number]:[stream family name]:[integer ID]"..

Use read model as base for projection

If a projection produces actions of type Action that, for example, get turned into SQL statements that are sent to a database.
If we have a read model that is essentially equivalent to streamId -> m ProjectedState.
If we have a function of type ProjectedState -> Action -> ProjectedState.

Then we can have a helper that:

  • gets the projected state from the read model and the identifier of the last event and the internal state of the projection from the corresponding tracking table,
  • fetches any new event for that stream,
  • transforms the new events into actions with the projection and the internal state (which can be discarded after that),
  • applies the actions to the projected state and
  • return the final projected state.

This can be used when we want to get the latest version of something without having to wait for the projection to catch up in the background and when using AggregateStore is not appropriate.

The user would have to be careful that applying the action to the projected state in memory yields the same result than applying the transformed action to a database. Maybe some helper functions could help write tests for this.

CLI generator to debug aggregators

Add new library eventsourcing-cli to create command-line tools that can be used to replay aggregators/projections on event streams interactively (thing gdb-style).

Use types to make interface more explicit

Some feedback I received:

[...] possibly some type aliases / newtype wrappers would make the code more readable I think, take

data StreamFamily streamId eventId metadata event = StreamFamily
{ connectionPool :: forall a. (PG.Connection -> IO a) -> IO a
, relation :: PG.Query
, notificationChannel :: PG.Query
, parseNotification :: BS.ByteString -> Either String (streamId, eventId)
, streamIdentifierColumn :: PG.Query
, eventIdentifierColumn :: PG.Query
, metadataColumns :: [PG.Query]
, eventColumn :: PG.Query
}

all those PG.Query don't give much info, you need to look at the selector to understand their use (disclaimer: I like to look at type name more than anything else so I'm biased here). eventColumn maybe can be a bit clearer e.g. eventDataColumn / dataColumn or the likes?

Debugging endpoints

There could be a library eventsourcing-debugging or something that provides helpers to serve the internal state of the program on some port with HTTP, e.g. the aggregates contained in an aggregate store.

Basic support for sharding

Add a 'ShardedStreamFamily' which groups different stream families into one and dispatches to one of the underlying stream family based on the stream identifier.

Update tracking state even if the projection produced no actions

Given an aggregator of type Aggregator event st ~ event -> State st (), a projection can be derived of type Projection event st Void ~ event -> State st [Void] since () is equivalent to [Void].

Together with TopUpReadModel, it enables the aggregated state to be pre-computed by the derived projection.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.