Skip to content

The search box knows all the secrets -- try it!

Polecat is part of the Critter Stack ecosystem.

JasperFx Logo JasperFx provides formal support for Polecat and other Critter Stack libraries. Please check our Support Plans for more details.

Archiving Streams

Polecat supports archiving event streams to logically remove them from active queries without permanently deleting the data.

Archiving a Stream

cs
session.Events.ArchiveStream(streamId);
await session.SaveChangesAsync();

This sets is_archived = 1 on both the pc_streams and pc_events tables for the stream.

Effects of Archiving

When a stream is archived:

  • FetchStreamAsync excludes the archived stream
  • The async daemon's event loader skips archived events
  • Attempting to append to an archived stream throws InvalidStreamException

Unarchiving a Stream

Restore an archived stream:

cs
session.Events.UnArchiveStream(streamId);
await session.SaveChangesAsync();

This sets is_archived = 0 on both tables, making the stream active again.

Tombstoning (Hard Delete)

For permanent removal of a stream and all its events:

cs
session.Events.TombstoneStream(streamId);
await session.SaveChangesAsync();

WARNING

Tombstoning permanently DELETEs the stream record and all associated events from the database. This cannot be undone.

Tombstoning works with both Guid and string stream IDs.

Archiving vs Tombstoning

OperationReversibleData PreservedUse Case
ArchiveYesYesSoft removal, compliance holds
TombstoneNoNoGDPR right to erasure, cleanup

Released under the MIT License.