Skip to content
Merged

V2 #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

## v2.0.0 - 2024-12-29

- Switch to a builder pattern for pool configuration.
- Change the `shutdown` API to take a `force` argument instead of having a separate
`force_shutdown` function.
- Improve reliability by tracking live resources and monitoring the calling process,
re-adding resources to the pool if the caller dies.
- Add checkout strategies (`FIFO` and `LIFO`).
- Add resource creation strategies (`Lazy` and `Eager`).
- Added `child_spec` and `from_subject` functions for creating a pool as part of a
supervision tree.

Thanks to @lpil for their help debugging this release!

## v1.0.0 - 2024-12-12

- Initial release
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ any value, such as database connections, file handles, or other resources.
## Installation

```sh
gleam add bath@1
gleam add bath@2
```

## Usage
Expand All @@ -20,7 +20,11 @@ import fake_db

pub fn main() {
// Create a pool of 10 connections to some fictional database.
let assert Ok(pool) = bath.init(10, fn() { fake_db.connect() })
let assert Ok(pool) =
bath.new(fn() { fake_db.connect() })
|> bath.with_size(10)
|> bath.with_shutdown(fn(conn) { fake_db.close(conn) })
|> bath.start(1000)

// Use the pool. Shown here in a block to use `use`.
let assert Ok("Hello!") = {
Expand Down
6 changes: 4 additions & 2 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name = "bath"
version = "1.0.0"
version = "2.0.0"
description = "A resource pool for Gleam!"
licences = ["MIT"]
repository = { type = "github", user = "Pevensie", repo = "bath" }
# links = [{ title = "Website", href = "" }]

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_stdlib = ">= 0.51.0 and < 2.0.0"
gleam_otp = ">= 0.16.0 and < 1.0.0"
gleam_erlang = ">= 0.33.0 and < 1.0.0"
gleam_deque = ">= 1.0.0 and < 2.0.0"
logging = ">= 1.3.0 and < 2.0.0"

[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
6 changes: 5 additions & 1 deletion manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
# You typically do not need to edit this file

packages = [
{ name = "gleam_deque", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_deque", source = "hex", outer_checksum = "64D77068931338CF0D0CB5D37522C3E3CCA7CB7D6C5BACB41648B519CC0133C7" },
{ name = "gleam_erlang", version = "0.33.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "A1D26B80F01901B59AABEE3475DD4C18D27D58FA5C897D922FCB9B099749C064" },
{ name = "gleam_otp", version = "0.16.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "FA0EB761339749B4E82D63016C6A18C4E6662DA05BAB6F1346F9AF2E679E301A" },
{ name = "gleam_stdlib", version = "0.51.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "14AFA8D3DDD7045203D422715DBB822D1725992A31DF35A08D97389014B74B68" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" },
]

[requirements]
gleam_deque = { version = ">= 1.0.0 and < 2.0.0" }
gleam_erlang = { version = ">= 0.33.0 and < 1.0.0" }
gleam_otp = { version = ">= 0.16.0 and < 1.0.0" }
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.51.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
logging = { version = ">= 1.3.0 and < 2.0.0" }
Loading
Loading