Skip to content

Feature: Thread-safe database reloading #2

Description

@a1ekas

Hi folks.

Thank you very much for your work on the library.
The current implementation is already very useful and the ability to safely reload the database will make it even more convenient.

It would be cool if you could add support for thread-safe reloading of the binary database, so that when you update a file on disk you can pick up the new version without disrupting the running goroutines.

What might this look like?

  • A goroutine is running in the background, which keeps track of the base file (for example, by date of change).
  • If the file is updated, we call some Reload function, but in such a way that the current requests continue to work without errors.
  • The new database data is loaded and replaced in the library used as safely as possible.

It is important that nothing crashes during the update. Goroutines reading data should not stumble upon closed files or invalid structures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions