typelevel / typelevel/cats-effect
"`ResourceSupervisor`"
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 576
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
This is an idea @TimWSpence and I cooked up once on Discord, starting from https://github.com/typelevel/fs2/pull/2300#issuecomment-1325010963.
The idea is very similar to the existing Supervisor which allows to start a fiber, and bind its lifecycle to some outer scope. Here, we want to allocate a Resource and bind its lifecycle to the outer scope.
ResourceSupervisor[F].use { supervisor =>
resourceA.allocateSupervised(supervisor).flatMap { (a, release) =>
// do stuff
}
}
allocateSupervised (or superviseAllocated ?) would work like allocated, except in case the release is not invoked for some reason, it will be cleaned up once the supervisor scope ends.
tl;dr start is to allocated what supervise is to (we need something here :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked PR discussion and the existing Supervisor, allocated, and Resource APIs. Clarify the proposed ResourceSupervisor and allocateSupervised lifecycle semantics, including cleanup when release is not invoked, then define the API and tests needed to demonstrate cleanup at supervisor-scope end.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100