You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asyncband.apache.org by "tisonkun (via GitHub)" <gi...@apache.org> on 2026/08/26 04:07:55 UTC

Re: [PR] feat(once): Add async LazyCell implementation [asyncband]

tisonkun commented on PR #168:
URL: https://github.com/apache/asyncband/pull/168#issuecomment-5420439579

   Maintainer design follow-up after the latest rewrite (the PR description above describes the earlier prototype):
   
   - The current `LazyCell` was reimplemented around one narrow contract: a stored zero-argument `FnOnce() -> Future` produces exactly one initialization attempt. Cancellation preserves that pinned attempt so a later `force` resumes it; an initializer panic poisons the cell. A returned `Result` is cached like any other value.
   - `LazyCell` no longer depends on `Once` or `OnceCell`. The `lazy-cell` feature depends only on `mutex`; `LazyCell` and `OnceCell` merely share the private `ValueCell` storage primitive. `force_mut` uses exclusive access directly and avoids the async lock and atomic publication path.
   - Fallible retry and access-time arguments deliberately remain `OnceCell::get_or_try_init` concerns. The OpenDAL prototype made this boundary concrete: Hugging Face canonicalization needs the latest operation context and must be retryable, so it should remain a `OnceCell` use case rather than expanding `LazyCell` with `try_force`/`*_with` variants.
   - We are not adding `force_into` now. An owned caller can bind the cell mutably and use the optimized `force_mut` path. A consuming method would additionally commit us to extraction and poisoning semantics without a demonstrated use case, while the analogous std `into_inner` API is still unstable and has a different contract ([rust-lang/rust#125623](https://github.com/rust-lang/rust/issues/125623)). We can add such an API later if a concrete need justifies it.
   - We are also not exposing a named boxed-future type. `new` remains generic over the caller's concrete future. Pinning and boxing are private machinery needed to retain the same in-flight future across cancellation without adding that future type to the public `LazyCell` type; a public alias would only expose an implementation detail callers do not need to name.
   
   The inaccurate `async-lazy` provenance entry has therefore been removed from `HISTORY.md`; the implementation does not derive from it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org