Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event stream deletion #170

Closed
slashdotdash opened this issue Jun 28, 2019 · 1 comment · Fixed by #203
Closed

Event stream deletion #170

slashdotdash opened this issue Jun 28, 2019 · 1 comment · Fixed by #203
Assignees

Comments

@slashdotdash
Copy link
Member

Allow an event stream to be soft or hard deleted.

  • Soft deletion will make the stream unreadable, but keep the events in the database.

    :ok = EventStore.delete_stream(stream_uuid, :soft)
  • Hard delete will remove the stream and its events from the database.

    :ok = EventStore.delete_stream(stream_uuid, :hard)

Events are included in the global $all stream by default. When a stream is deleted the events should also be removed from this stream.

@Freyskeyd
Copy link

Freyskeyd commented Jul 15, 2019

Hello,

Some questions related to the soft/hard deletion:

  • How do we manage event numbers in case of deleted events on $all ?
  • What's about linked event when a stream is deleted ?

What I want to do:

Soft deletion

An event shouldn't be removed from the store. When we want to soft delete a stream we just need to add an event to it like a SoftDeletionEvent (or something else).
The stream metadata must be reflect that the last event is the SoftDeletionEvent and must return a :stream_not_found when consuming a stream which have a SoftDeletionEvent has current event.

Creating and adding new event to the stream will revive the stream but only events added after the latest SoftDeletionEvent will be returned.

Question:

  • How to handle $all subscription in that case ?
  • Should we update the last_seen subscription to the SoftDeletionEvent ?

Hard Deletion

A hard deletion must produce an event reflecting the action (HardDeletionEvent). Any previous events must be deleted.

When requesting a stream which have an HardDeletionEvent a :stream_not_found must be returned.

An HardDeleted stream can be revive and no events can be pushed to it.

Question:

  • How to deal with $all subscription in that case ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants