Skip to content

Extend 'capabilities' to be more dynamic? #5

@myndzi

Description

@myndzi

Spawned by the discussion here: knex/knex#802

Use case: prepared statements are connection-specific; the capabilities function could be used to request connections from the pool which have a given prepared statement available.

For this to work, a few things are needed:

  • "strong" and "weak" capabilities requests: A strong request would return a resource from the pool that can fulfill the capability or wait until one is available; a weak request would return a resource from the pool that can fulfill the capability if available, otherwise return any available resource
  • Ability to dynamically manipulate a resource's capabilities, primarily to "upgrade" plain connections to connections that have the query prepared

Also worth considering:

  • affinity / anti-affinity?
  • pool prioritization? (try to serve allocation requests with the "least-capable" resource, to leave more specialized resources idle as much as possible?)
  • potential use case for hooks? (allow client to prepare statements on new resources when they are requested or when they become idle, for example)

Questions:

  • Is the additional complexity worth implementing the feature?
  • What would the API look like?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions