Soft Deletes

Hello,

I was reading this document https://eventstore.org/docs/server/deleting-streams-and-events/index.html regarding deletion of events in a stream.

I’m wondering which kind of deletion – hard or soft is done when I choose “Delete” on a stream in the UI?

Another thing: do I understand correctly that in order to truncate-before, I need to write $tb = X to stream metada, where X is event number until which it should be to truncated? If so, is it possible to write metadata via UI?

Thank you!

  • Karolis

Hello,

I have found an answer to my question. According to https://eventstore.org/docs/server/metadata-and-reserved-names/index.html?q=metadata every stream’s metadata is just another $$ prefixed stream, i.e. stream ZZ has it’s metadata in $$ZZ.

So all I need to do to write metadata from ES UI is to “Add Event” to this metadata stream.

Cheers

  • Karolis

You can also just delete the stream providing you want all events gone if you want which does this for you… There is an operation for this both on the client API and on the http API.

Where you likely are more interested in using $tb directly is when you have say 11 events in a stream and want to remove the first 5.

There are two other pieces of metadata you likely want to be familiar with. $maxAge and $maxCount which represent limits on the stream automatically making things eligible for scavenging. As example I might have a sensor writing events and always want to keep the last 5 days worth of measurements or the last 500 measurements, but older are ok to be deleted. I can set $maxAge on this stream and it will happen automatically.

Cheers,

Greg