|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -class PoolMonitoringEvent { |
| 3 | +class ConnectionPoolMonitoringEvent { |
4 | 4 | constructor(type, pool) { |
5 | 5 | this.time = new Date(); |
6 | 6 | this.type = type; |
7 | 7 | this.address = pool.address; |
8 | 8 | } |
9 | 9 | } |
10 | 10 |
|
11 | | -class PoolCreatedEvent extends PoolMonitoringEvent { |
| 11 | +class ConnectionPoolCreatedEvent extends ConnectionPoolMonitoringEvent { |
12 | 12 | constructor(pool) { |
13 | 13 | super('ConnectionPoolCreated', pool); |
14 | 14 | this.options = pool.options; |
15 | 15 | } |
16 | 16 | } |
17 | 17 |
|
18 | | -class PoolClosedEvent extends PoolMonitoringEvent { |
| 18 | +class ConnectionPoolClosedEvent extends ConnectionPoolMonitoringEvent { |
19 | 19 | constructor(pool) { |
20 | 20 | super('ConnectionPoolClosed', pool); |
21 | 21 | } |
22 | 22 | } |
23 | 23 |
|
24 | | -class ConnectionCreatedEvent extends PoolMonitoringEvent { |
| 24 | +class ConnectionCreatedEvent extends ConnectionPoolMonitoringEvent { |
25 | 25 | constructor(pool, connection) { |
26 | 26 | super('ConnectionCreated', pool); |
27 | 27 | this.connectionId = connection.id; |
28 | 28 | } |
29 | 29 | } |
30 | 30 |
|
31 | | -class ConnectionReadyEvent extends PoolMonitoringEvent { |
| 31 | +class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent { |
32 | 32 | constructor(pool, connection) { |
33 | 33 | super('ConnectionReady', pool); |
34 | 34 | this.connectionId = connection.id; |
35 | 35 | } |
36 | 36 | } |
37 | 37 |
|
38 | | -class ConnectionClosedEvent extends PoolMonitoringEvent { |
| 38 | +class ConnectionClosedEvent extends ConnectionPoolMonitoringEvent { |
39 | 39 | constructor(pool, connection, reason) { |
40 | 40 | super('ConnectionClosed', pool); |
41 | 41 | this.connectionId = connection.id; |
42 | 42 | this.reason = reason || 'unknown'; |
43 | 43 | } |
44 | 44 | } |
45 | 45 |
|
46 | | -class ConnectionCheckOutStartedEvent extends PoolMonitoringEvent { |
| 46 | +class ConnectionCheckOutStartedEvent extends ConnectionPoolMonitoringEvent { |
47 | 47 | constructor(pool) { |
48 | 48 | super('ConnectionCheckOutStarted', pool); |
49 | 49 | } |
50 | 50 | } |
51 | 51 |
|
52 | | -class ConnectionCheckOutFailedEvent extends PoolMonitoringEvent { |
| 52 | +class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitoringEvent { |
53 | 53 | constructor(pool, reason) { |
54 | 54 | super('ConnectionCheckOutFailed', pool); |
55 | 55 | this.reason = reason; |
56 | 56 | } |
57 | 57 | } |
58 | 58 |
|
59 | | -class ConnectionCheckedOutEvent extends PoolMonitoringEvent { |
| 59 | +class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringEvent { |
60 | 60 | constructor(pool, connection) { |
61 | 61 | super('ConnectionCheckedOut', pool); |
62 | 62 | this.connectionId = connection.id; |
63 | 63 | } |
64 | 64 | } |
65 | 65 |
|
66 | | -class ConnectionCheckedInEvent extends PoolMonitoringEvent { |
| 66 | +class ConnectionCheckedInEvent extends ConnectionPoolMonitoringEvent { |
67 | 67 | constructor(pool, connection) { |
68 | 68 | super('ConnectionCheckedIn', pool); |
69 | 69 | this.connectionId = connection.id; |
70 | 70 | } |
71 | 71 | } |
72 | 72 |
|
73 | | -class PoolClearedEvent extends PoolMonitoringEvent { |
| 73 | +class ConnectionPoolClearedEvent extends ConnectionPoolMonitoringEvent { |
74 | 74 | constructor(pool) { |
75 | 75 | super('ConnectionPoolCleared', pool); |
76 | 76 | } |
77 | 77 | } |
78 | 78 |
|
79 | 79 | module.exports = { |
80 | | - PoolCreatedEvent, |
81 | | - PoolClosedEvent, |
| 80 | + ConnectionPoolCreatedEvent, |
| 81 | + ConnectionPoolClosedEvent, |
82 | 82 | ConnectionCreatedEvent, |
83 | 83 | ConnectionReadyEvent, |
84 | 84 | ConnectionClosedEvent, |
85 | 85 | ConnectionCheckOutStartedEvent, |
86 | 86 | ConnectionCheckOutFailedEvent, |
87 | 87 | ConnectionCheckedOutEvent, |
88 | 88 | ConnectionCheckedInEvent, |
89 | | - PoolClearedEvent |
| 89 | + ConnectionPoolClearedEvent |
90 | 90 | }; |
0 commit comments