Skip to content

Cluster replication#32

Merged
swansontec merged 6 commits intomasterfrom
william/cluster-replication
May 12, 2025
Merged

Cluster replication#32
swansontec merged 6 commits intomasterfrom
william/cluster-replication

Conversation

@swansontec
Copy link
Contributor

@swansontec swansontec commented May 7, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

@swansontec swansontec force-pushed the william/cluster-replication branch 2 times, most recently from 94ff252 to 4a66703 Compare May 9, 2025 17:32
Copy link
Contributor

@samholmes samholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All optional except for one concern

Comment on lines +8 to +29
export interface CouchPool {
/** The default connection, to use for most queries. */
default: ServerScope

/** The cluster name being used for the default connection. */
defaultName: string

/** Lists the clusters that are available for connection. */
clusterNames: string[]

/**
* Grab a connection to a specific cluster.
* Throws if the name is missing.
*/
connect: (name: string) => ServerScope

/** Grabs authentication information for a specific cluster. */
getCredential: (name: string) => CouchCredential | undefined

/** Grab a connection, returning undefined if the cluster is missing. */
maybeConnect: (name: string) => ServerScope | undefined
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good API. A part of me wonders if we can do without the maybeConnect via static type checking. connect can still throw, but wouldn't ever be written to through if it constrained it's parameter. Inferring the name keys from connectCouch is where it gets tricky though because you inject 'default' into the internal type, but I suppose the internal type doesn't need to be constrained by the name keys.

Copy link
Contributor Author

@swansontec swansontec May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input comes from cleaner-config in the login server, so there's no type information at that point. In other situations, we get the list of credentials from the info server, so it's even worse.

Copy link
Contributor

@samholmes samholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve with changes optional

@swansontec swansontec force-pushed the william/cluster-replication branch from 48b7fbd to aed6555 Compare May 9, 2025 23:05
@swansontec swansontec force-pushed the william/cluster-replication branch from aed6555 to 0ef6d21 Compare May 12, 2025 19:33
@swansontec swansontec merged commit 5a75bec into master May 12, 2025
3 checks passed
@swansontec swansontec deleted the william/cluster-replication branch May 12, 2025 23:35
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.

2 participants