Skip to content

Commit de95f01

Browse files
committed
doc: fix connection_pool Mode description
The patch fixes PREFER_RW/PREFER_RO usage. It also make comments in Go-style. See `Const` section in `Go Doc Comments` guide [1]. 1. https://go.dev/doc/comment Part of #208
1 parent bda4442 commit de95f01

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
1616

1717
### Fixed
1818

19+
- Mode type description in the connection_pool subpackage (#208)
20+
1921
## [1.8.0] - 2022-08-17
2022

2123
### Added

connection_pool/const.go

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
package connection_pool
22

3-
type Mode uint32
4-
type Role uint32
5-
type State uint32
6-
73
/*
8-
Mode parameter:
9-
10-
- ANY (use any instance) - the request can be executed on any instance (master or replica).
11-
12-
- RW (writeable instance (master)) - the request can only be executed on master.
13-
14-
- RO (read only instance (replica)) - the request can only be executed on replica.
15-
16-
- PREFER_RO (prefer read only instance (replica)) - if there is one, otherwise fallback to a writeable one (master).
17-
18-
- PREFER_RW (prefer write only instance (master)) - if there is one, otherwise fallback to a read only one (replica).
4+
Default mode for each request table:
195
206
Request Default mode
217
---------- --------------
@@ -30,21 +16,27 @@ Mode parameter:
3016
| select | ANY |
3117
| get | ANY |
3218
*/
19+
type Mode uint32
20+
3321
const (
34-
ANY = iota
35-
RW
36-
RO
37-
PreferRW
38-
PreferRO
22+
ANY Mode = iota // The request can be executed on any instance (master or replica).
23+
RW // The request can only be executed on master.
24+
RO // The request can only be executed on replica.
25+
PreferRW // If there is one, otherwise fallback to a writeable one (master).
26+
PreferRO // If there is one, otherwise fallback to a read only one (replica).
3927
)
4028

29+
type Role uint32
30+
4131
// master/replica role
4232
const (
4333
unknown = iota
4434
master
4535
replica
4636
)
4737

38+
type State uint32
39+
4840
// pool state
4941
const (
5042
connConnected = iota

0 commit comments

Comments
 (0)