Patrick Ellul
6a68341f62
maintain lastIUsedTime so clients can use it as a factor in idle and health check logic
2020-01-25 21:41:34 +11:00
Jack Christensen
11cab39313
Fix spelling error
2019-06-08 17:40:51 -05:00
Jack Christensen
e4ced69a3a
Ensure maxSize > 0
2019-04-13 18:43:25 -05:00
Jack Christensen
0395a39c2d
Use int32 for pool sizes
2019-04-13 18:39:08 -05:00
Jack Christensen
0d93e0ec11
Add Go modules
2019-04-08 19:40:18 -05:00
Jack Christensen
9236ccde06
Improve description in README
2018-12-26 18:54:41 -06:00
Jack Christensen
3d17e25ee5
Make simpler example
2018-12-26 18:51:04 -06:00
Jack Christensen
5cb5ce10c3
Add more docs and example
2018-12-26 18:36:59 -06:00
Jack Christensen
893989abad
Use godoc badge for doc link
2018-12-26 17:27:29 -06:00
Jack Christensen
fce9fbe2b4
Add Travis CI
2018-12-26 17:26:50 -06:00
Jack Christensen
617626eddc
Add MIT license
2018-12-26 17:21:07 -06:00
Jack Christensen
2b7acc5e28
Link to godoc in README.md
2018-12-26 17:19:52 -06:00
Jack Christensen
fefda73679
Add documention
2018-12-26 17:17:25 -06:00
Jack Christensen
383709a0b4
Achieve 100% test coverage
2018-12-26 17:17:08 -06:00
Jack Christensen
75889e9497
Fix test with race
2018-12-26 16:36:54 -06:00
Jack Christensen
33a5f62a2e
Add stress test and fix race it detected
2018-12-26 16:35:01 -06:00
Jack Christensen
ba34bdd8ef
Add Pool.AcquireAllIdle
2018-12-26 15:52:48 -06:00
Jack Christensen
df3f83d1f7
Store resource creation time
2018-12-26 15:35:13 -06:00
Jack Christensen
99fde4bb49
Use (con|de)structor names in tests
2018-12-26 15:30:42 -06:00
Jack Christensen
d3964763bb
Track successful acquire duration
...
Rename slow acquire to empty acquire to be more clear that it means the
pool was empty on acquire, not that it took some large amount of time.
2018-12-26 15:25:14 -06:00
Jack Christensen
ec686c76d0
Add canceled acquire counting
2018-12-26 14:59:35 -06:00
Jack Christensen
109e4356b9
Track acquire and slow acquire count
2018-12-26 14:35:23 -06:00
Jack Christensen
aa05ab2ade
Use more detailed stat names
2018-12-26 14:12:00 -06:00
Jack Christensen
d83b67b4a8
Fix use waitgroup after close race
2018-12-26 14:09:49 -06:00
Jack Christensen
80b43a4df9
Add Pool.Stat
2018-12-26 14:00:31 -06:00
Jack Christensen
fddf7bbdb9
Rename avaible resources to idle resources
2018-12-26 13:22:46 -06:00
Jack Christensen
ebf42e3ab9
Consistently use term acquired instead of borrowed
2018-12-26 13:20:14 -06:00
Jack Christensen
47190588bc
Remove runtime changing of pool size
...
Reducing pool to minimize required functionality
2018-12-26 13:11:49 -06:00
Jack Christensen
3edeea2574
Remove min size
...
Pruning pool functionality
2018-12-26 13:05:03 -06:00
Jack Christensen
7df4afe7d3
Add Resource.Hijack
2018-12-26 13:03:07 -06:00
Jack Christensen
af5402c2dd
Add fast path, tests, and benchmarks for non-cancellable contexts
2018-12-26 03:11:49 -06:00
Jack Christensen
ab3795c24c
Pool.Close blocks until all resources released and destructed
...
Renamed resource constructor and destructor callbacks.
2018-12-26 02:59:36 -06:00
Jack Christensen
f718a625cf
Resolve some potential deadlocks
...
Tweak benchmarks
2018-12-26 02:24:07 -06:00
Jack Christensen
dd010296a6
Convert allResources from map to array
2018-12-26 00:18:30 -06:00
Jack Christensen
667f04e9f7
Remove resource limits
...
Acquire health check will be able to take over this functionality.
2018-12-25 20:13:36 -06:00
Jack Christensen
179bc9b8c7
Better benchmarking
2018-12-25 19:54:51 -06:00
Jack Christensen
590f7e07cb
Remove unnecessary wrapping func
2018-12-25 19:27:33 -06:00
Jack Christensen
4ef5d16aa8
Rename Get to Acquire
2018-12-25 19:23:50 -06:00
Jack Christensen
3afe49e88b
Releasing or destroying Resource is called by resource
...
This makes it impossible to return a resource to a pool that it did
not come from.
2018-12-25 19:17:57 -06:00
Jack Christensen
09852e05d7
Simplify close logic
2018-12-25 14:47:00 -06:00
Jack Christensen
7c5f3f0446
Define close resource not to return an error
...
There is nothing the pool can do on an error. If the client code
wishes to handle or log errors it can do so in the close resource
function.
This removes the need for background error reporting.
2018-12-25 14:25:10 -06:00
Jack Christensen
d4f6b3dbba
Only create resources in Get
...
Add context to create func.
2018-12-25 14:09:45 -06:00
Jack Christensen
98fd1f3693
More benchmarks
2018-12-24 13:08:32 -06:00
Jack Christensen
1396b8ec46
Rename max resource uses to max resource checkouts
2018-12-24 12:19:18 -06:00
Jack Christensen
2090b0ade1
Remove refactor tests from todo list
2018-12-24 12:12:24 -06:00
Jack Christensen
b3026d0d8f
Improve test robustness
2018-12-24 12:12:02 -06:00
Jack Christensen
9ede55618e
Use createCreateResourceFunc
2018-12-24 12:09:57 -06:00
Jack Christensen
49b32fb7f3
Extract createCloseResourceFuncWithNotifierChan
2018-12-24 12:07:48 -06:00
Jack Christensen
3559b7b000
Extract createCreateResourceFuncWithNotifierChan()
2018-12-24 12:02:59 -06:00
Jack Christensen
d5a4c6123d
Extract waitForRead
2018-12-24 11:49:58 -06:00