diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-11-07 03:48:54 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-11-07 03:50:58 +0000 |
| commit | 67b7928cd489db4b274502c7b7643402a1be5990 (patch) | |
| tree | f9c6159446f74366156e19e461ea65cb5079d38c /docs | |
| parent | 9376ddbdb70cc95f285e3e6aeef5742df37415c0 (diff) | |
| download | RNT-67b7928cd489db4b274502c7b7643402a1be5990.tar.gz RNT-67b7928cd489db4b274502c7b7643402a1be5990.zip | |
Init system sketchesinit
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/init.org | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/docs/init.org b/docs/init.org new file mode 100644 index 0000000..746ce03 --- /dev/null +++ b/docs/init.org @@ -0,0 +1,64 @@ +The init system is the part of RNT responsible from taking a description of what a live system should look like and instantiating a system that matches this description, constructing and connecting different components as necessary. It is not a supervisor, that is, it is not responsible for maintaining the state of the system once it has been built, although it provides functionality that could support the implementation of a supervisor. + +More concretely, the role of the init system is to build a *system* out of a set of *components*. *Components* are the description of a building block of systems that can either require *services* from an existing component, extend an existing component and provide services to other components. A component that extends another component implicitly requires that component. Components, through this provision and requirement relationship, form a directed acyclic graph. Concretely, a component might look something like this: + +#+begin_src ocaml +type service = .. + +type component = + { provides: service BatSet.t; + requires: service BatSet.t; + (* extends: extension list; *) + construct: (service, Handle.t) BatMap.t -> (Handle.t, Concepts.Condition.condition) result } + + + +module type SUBSYSTEM = struct + type t + val create : unit -> t + val destroy : t -> unit +end + +module MySubsystem : SUBSYSTEM = struct + +end + + + +type ('a, 'b) service = .. + +type ('a, 'b) service += ServiceThatTakesAnInt +let makeServiceThatTakesAnInt : int service = ServiceThatTakesAnInt + +type ('a, 'b) extension = ('a, 'b) service * ('a -> ('b, Concepts.Condition.condition) result) + +type component = + { provides: service; + extends: extension BatSet.t + extend: ()} + +let _ = Component.make + ~provides:MySubsystem + ~extends:[extend Subsystem (fun h -> + MySubsystem.make <><>)] + +let _ = Component.make + ~requires:[SubsystemRegistry] + ~provides:[MySubsystem] + ~mount:(fun h -> + let myself = MySubstystem.make <><> in + SubssystemRegistry.register myself; + myself) + ~unmount:(fun h myself -> + Lifecycle.destroy myself) + +(* options: + - object destroy itself on unmount through lifecycles + - would require us to be able to notify the owner, which would mean we have to know who the owner is + ,*) + + + +type component = + { ex} +#+end_src |
