Skip to content

Add support for multiple instances of databases backed by DurableObject  #31

@JayJamieson

Description

@JayJamieson

Is your feature request related to a problem? Please describe.
Currently only a single database DurableObject instance is support as per the here code and here.

It's not necessarily a bad thing, but it can be limiting in terms of storage capacity and being able to isolate data between users or use cases.

Describe the solution you'd like
As I understand from the documentation, It should be possible to create multiple DurableObject instances with separate storage and I/O.

It should be possible to use either idFromName(name: string) or newUniqueId() to create new DurableObject instances with separate storage from one another.

  • idFromName(name: string) could take in a URL parameter from a request to create an instance of a DurableObject. The name would then need to be saved somewhere centrally and linked to as user.
    • the name could/should be prefixed by user identifier to avoid accessing other users DurableObject instances
  • newUniqueId() similarly could be used as an alternative if the provided name is not URL safe

This would mean implementing additional routes for database provisioning, deleting and listing. The existing setup can still be used as a means to provision a "default" DurableObject instance named sql-durable-object to avoid breaking existing functionality.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
I'm not 100% across how CF works but happy to help on some of the changes if this aligns with starbasedb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions