-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the Internal Lifecycle of Actor
This PR simplifies the mechanism for tracking reference counts in the Actor introduced in #44. Previously, the reference count was managed by invoking the `launchIn(scope)` function via `XxxRef` interface, controlling the increment and decrement of references based on the lifecycle of the CoroutineScope. However, this approach proved inconvenient for short-lived scopes, such as those used with the prefetch function. In this change, a UUID is assigned to each Ref instance, and a simpler attach/detach mechanism is introduced. Naturally, Ref instances must guarantee these calls. To enforce this, the [AutoCloseable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-auto-closeable.html) interface is implemented, making it clear that the close function must be invoked once the instance is no longer needed. For short-lived use cases like prefetch, the use extension function can be employed to ensure proper cleanup reliably. ``` getQuery(key, marker).use { query -> ... } ```
- Loading branch information
1 parent
94d8190
commit dad16b3
Showing
26 changed files
with
383 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.