Skip to content

WIP: transition to eio #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

WIP: transition to eio #843

wants to merge 6 commits into from

Conversation

balat
Copy link
Member

@balat balat commented Jul 6, 2025

No description provided.

@@ -242,7 +242,6 @@ type 'a cookie_info1 =
(* None = new cookie
(not sent by the browser) *)
* one_persistent_cookie_info session_cookie ref)
Promise.t
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@@ -40,14 +40,14 @@ val find : ('a, 'b) t -> ('a -> 'b) -> 'a -> 'b
result in a single call to [get_from_db]. Exceptions are not
cached. *)

val do_cache : ('a, 'b) t -> 'a -> 'b -> unit
val do_cache : ('a, 'b) t -> 'a -> 'b Eio.Promise.or_exn -> unit
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

(** [do_cache cache key value] adds the association from [key] to
[value] in [cache], or replaces it if not already present. Called
from client side, it affects only client side cache. Called from
server side, it will have effect both on the server cache (scope:
request) and the client side cache. *)

val local_find : ('a, 'b) t -> 'a -> 'b
val local_find : ('a, 'b) t -> 'a -> 'b Eio.Promise.or_exn
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local_find returns a promise because that's what the cache contains.

-> (string * string) list Promise.t option
-> (string * Eliom_lib.file_info) list Promise.t option
-> (string * string) list option
-> (string * Eliom_lib.file_info) list option
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

| Ocsiper of 'a option Ocsipersist.t Promise.t (* Global persist. table *)
| Ocsiper_sit of 'a Ocsipersist.table Promise.t (* Persist. table for site *)
| Per of 'a persistent_table Promise.t
| Ocsiper of 'a option Ocsipersist.t Lazy.t (* Global persist. table *)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@@ -29,16 +27,16 @@ module Ocsipersist = struct
include Eliom_common.Ocsipersist.Polymorphic
end

let pers_ref_store = Ocsipersist.open_store "eliom__persistent_refs"
let pers_ref_store = lazy (Ocsipersist.open_store "eliom__persistent_refs")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a Lwt.t before. This is an attempt to make sure that effects are caught by Eio_main.

Julow added 6 commits July 15, 2025 16:11
`Lwt_stream` is difficult to migrate to other concurrency libraries
because of its vast API and its many usecases.

Its usage in `Eliom_comet` can easily be changed to a callback-based
approach. This might increase performances as well.
Add a new callback-based API, `Eliom_bus.register`, which avoids using
`Lwt_stream` internally.

`Eliom_bus.stream` is re-implemented against the register API.
`Eliom_bus.original_stream` is not re-implemented yet.
`Eliom_comet.register` and `Eliom_bus.register` propagate errors from
the server using an `option` type.
`Eliom_bus` ensures that the callback won't be called again after being
called with `None`.

This "end of stream or error" signal was present before through
`Lwt_stream`, which could propagate the `Closed` exception.

In both `Eliom_comet` and `Eliom_bus`, the callbacks are released when
the channel closes to allow memory to be collected.
Implement the callback-based API that can be used with values of type
[Eliom_comet.Channel.t] that can be passed from the server.
- Remove `Eliom_bus.stream` and `Eliom_bus.original_stream`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants