Skip to content

feat: implement delete stream#16

Merged
markwylde merged 1 commit intomainfrom
feat/implement-delete-stream
Feb 9, 2025
Merged

feat: implement delete stream#16
markwylde merged 1 commit intomainfrom
feat/implement-delete-stream

Conversation

@markwylde
Copy link
Owner

@markwylde markwylde commented Feb 9, 2025

This PR introduces a new deleteStream method to the Eventbase instance, enabling complete cleanup of a stream and its associated resources. In addition, it removes an obsolete database creation function from src/db.ts, simplifying our codebase.

Key Changes:

  1. Removed src/db.ts:

    • The createDb function (which handled creating or opening a doubledb instance) has been removed as it was no longer used in the project.
  2. Updated src/index.ts:

    • Added a new deleteStream method to the Eventbase interface. This method:
      • Purges the JetStream stream via jsm.streams.purge.
      • Deletes the stream using jsm.streams.delete.
      • Closes the Eventbase instance.
      • Closes all underlying databases (db, metaDb, settingsDb).
      • Removes the filesystem directory (using rmdir) where the database files reside
    • Wrapped the stream stop sequence in a try-catch to gracefully handle potential errors.

@markwylde markwylde merged commit 39b6276 into main Feb 9, 2025
3 checks passed
@markwylde markwylde deleted the feat/implement-delete-stream branch February 9, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant