Skip to content

Commit

Permalink
Expose native pg.PoolClient in ent-framework
Browse files Browse the repository at this point in the history
  • Loading branch information
dimikot committed Sep 17, 2024
1 parent afbfef9 commit 7ba02ef
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 241 deletions.
10 changes: 5 additions & 5 deletions docs/classes/CanDeleteOutgoingEdge.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Checks that an Ent available via a field can be deleted, or Ent doesn't exist

#### Defined in

src/ent/predicates/CanDeleteOutgoingEdge.ts:15
[src/ent/predicates/CanDeleteOutgoingEdge.ts:15](https://github.com/clickup/ent-framework/blob/master/src/ent/predicates/CanDeleteOutgoingEdge.ts#L15)

## Properties

Expand All @@ -54,7 +54,7 @@ src/ent/predicates/CanDeleteOutgoingEdge.ts:15

#### Defined in

src/ent/predicates/CanDeleteOutgoingEdge.ts:13
[src/ent/predicates/CanDeleteOutgoingEdge.ts:13](https://github.com/clickup/ent-framework/blob/master/src/ent/predicates/CanDeleteOutgoingEdge.ts#L13)

___

Expand All @@ -64,7 +64,7 @@ ___

#### Defined in

src/ent/predicates/CanDeleteOutgoingEdge.ts:16
[src/ent/predicates/CanDeleteOutgoingEdge.ts:16](https://github.com/clickup/ent-framework/blob/master/src/ent/predicates/CanDeleteOutgoingEdge.ts#L16)

___

Expand All @@ -74,7 +74,7 @@ ___

#### Defined in

src/ent/predicates/CanDeleteOutgoingEdge.ts:17
[src/ent/predicates/CanDeleteOutgoingEdge.ts:17](https://github.com/clickup/ent-framework/blob/master/src/ent/predicates/CanDeleteOutgoingEdge.ts#L17)

## Methods

Expand All @@ -99,4 +99,4 @@ src/ent/predicates/CanDeleteOutgoingEdge.ts:17

#### Defined in

src/ent/predicates/CanDeleteOutgoingEdge.ts:22
[src/ent/predicates/CanDeleteOutgoingEdge.ts:22](https://github.com/clickup/ent-framework/blob/master/src/ent/predicates/CanDeleteOutgoingEdge.ts#L22)
35 changes: 31 additions & 4 deletions docs/classes/Cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,33 @@ the query), no matter whether it was an immediate call or a deferred one.

___

### shardByNo

**shardByNo**(`shardNo`): [`Shard`](Shard.md)\<`TClient`\>

Returns a Shard if we know its number. The idea: for each Shard number
(even for non-discovered yet Shards), we keep the corresponding Shard
object in a Memoize cache, so Shards with the same number always resolve
into the same Shard object. Then, an actual Island locating process happens
when the caller wants to get a Client of that Shard (and it throws if such
Shard hasn't been discovered actually).

#### Parameters

| Name | Type |
| :------ | :------ |
| `shardNo` | `number` |

#### Returns

[`Shard`](Shard.md)\<`TClient`\>

#### Defined in

[src/abstract/Cluster.ts:266](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L266)

___

### randomShard

**randomShard**(`seed?`): `Promise`\<[`Shard`](Shard.md)\<`TClient`\>\>
Expand All @@ -178,7 +205,7 @@ Returns a random Shard among the ones which are currently known

#### Defined in

[src/abstract/Cluster.ts:261](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L261)
[src/abstract/Cluster.ts:276](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L276)

___

Expand All @@ -200,7 +227,7 @@ Returns an Island by its number.

#### Defined in

[src/abstract/Cluster.ts:280](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L280)
[src/abstract/Cluster.ts:295](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L295)

___

Expand All @@ -216,7 +243,7 @@ Returns all Islands in the Cluster.

#### Defined in

[src/abstract/Cluster.ts:291](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L291)
[src/abstract/Cluster.ts:306](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L306)

___

Expand All @@ -234,4 +261,4 @@ cluster configuration.

#### Defined in

[src/abstract/Cluster.ts:301](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L301)
[src/abstract/Cluster.ts:316](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L316)
75 changes: 27 additions & 48 deletions docs/classes/PgClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Initializes an instance of PgClient.

#### Defined in

[src/pg/PgClient.ts:151](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L151)
[src/pg/PgClient.ts:152](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L152)

## Properties

Expand All @@ -62,7 +62,7 @@ Default values for the constructor options.

#### Defined in

[src/pg/PgClient.ts:96](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L96)
[src/pg/PgClient.ts:101](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L101)

___

Expand All @@ -78,7 +78,7 @@ PgClient configuration options.

#### Defined in

[src/pg/PgClient.ts:125](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L125)
[src/pg/PgClient.ts:130](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L130)

___

Expand All @@ -94,7 +94,7 @@ Name of the shard associated to this Client.

#### Defined in

[src/pg/PgClient.ts:128](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L128)
[src/pg/PgClient.ts:133](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L133)

___

Expand All @@ -110,7 +110,7 @@ An active TimelineManager for this particular Client.

#### Defined in

[src/pg/PgClient.ts:131](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L131)
[src/pg/PgClient.ts:136](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L136)

## Methods

Expand Down Expand Up @@ -282,63 +282,42 @@ full-text dictionaries).

___

### acquireConn
### poolStats

**acquireConn**(): `Promise`\<[`PgClientConn`](../interfaces/PgClientConn.md)\>
**poolStats**(): `Object`

Called when the Client needs a connection to run a query against.
Returns statistics about the connection pool.

#### Returns

`Promise`\<[`PgClientConn`](../interfaces/PgClientConn.md)\>

#### Defined in

[src/pg/PgClient.ts:136](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L136)

___

### releaseConn

**releaseConn**(`conn`): `void`

Called when the Client is done with the connection.

#### Parameters

| Name | Type |
| :------ | :------ |
| `conn` | [`PgClientConn`](../interfaces/PgClientConn.md) |

#### Returns
`Object`

`void`
| Name | Type | Description |
| :------ | :------ | :------ |
| `totalConns` | `number` | Total number of connections in the pool. |
| `idleConns` | `number` | Connections not busy running a query. |
| `queuedReqs` | `number` | Once all idle connections are over, requests are queued waiting for a new available connection. This is the number of such queued requests. |

#### Defined in

[src/pg/PgClient.ts:141](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L141)

___

### poolStats
### acquireConn

**poolStats**(): `Object`
**acquireConn**(): `Promise`\<[`PgClientConn`](../interfaces/PgClientConn.md)\>

Returns statistics about the connection pool.
Called when the Client needs a connection to run a query against. Implies
than the caller MUST call release() method on the returned object.

#### Returns

`Object`

| Name | Type | Description |
| :------ | :------ | :------ |
| `totalConns` | `number` | Total number of connections in the pool. |
| `idleConns` | `number` | Connections not busy running a query. |
| `queuedReqs` | `number` | Once all idle connections are over, requests are queued waiting for a new available connection. This is the number of such queued requests. |
`Promise`\<[`PgClientConn`](../interfaces/PgClientConn.md)\>

#### Defined in

[src/pg/PgClient.ts:146](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L146)
[src/pg/PgClient.ts:147](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L147)

___

Expand Down Expand Up @@ -374,7 +353,7 @@ should expect that role() returns the actual master/replica role.

#### Defined in

[src/pg/PgClient.ts:198](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L198)
[src/pg/PgClient.ts:199](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L199)

___

Expand All @@ -395,7 +374,7 @@ database.

#### Defined in

[src/pg/PgClient.ts:378](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L378)
[src/pg/PgClient.ts:380](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L380)

___

Expand All @@ -422,7 +401,7 @@ wait for at least the provided number of milliseconds.

#### Defined in

[src/pg/PgClient.ts:402](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L402)
[src/pg/PgClient.ts:404](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L404)

___

Expand All @@ -448,7 +427,7 @@ Extracts Shard number from an ID.

#### Defined in

[src/pg/PgClient.ts:420](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L420)
[src/pg/PgClient.ts:422](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L422)

___

Expand All @@ -475,7 +454,7 @@ new Client will share the same connection pool with the parent's Client.

#### Defined in

[src/pg/PgClient.ts:476](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L476)
[src/pg/PgClient.ts:478](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L478)

___

Expand All @@ -497,7 +476,7 @@ we only know the role after a query.

#### Defined in

[src/pg/PgClient.ts:487](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L487)
[src/pg/PgClient.ts:489](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L489)

___

Expand All @@ -520,4 +499,4 @@ until e.g. the next discovery query to it (or any query) succeeds.

#### Defined in

[src/pg/PgClient.ts:491](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L491)
[src/pg/PgClient.ts:493](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClient.ts#L493)
Loading

0 comments on commit 7ba02ef

Please sign in to comment.