class Novika::Resolver::RunnableRoot
- Novika::Resolver::RunnableRoot
- Reference
- Object
Overview
Runnable root is available to all containers, and therefore allows any runnable to escape deep nesting if need be.
Runnable root stores a pointer to the Disk
object, used throughout
the resolver to cache file system requests (the resolver is quite
ample in making them). It also stores the set of flags, which help
making OS-specific decisions using flag conditions in manifests.
Additionally, runnable root allows runnables to #wish
queries
to be resolved later, as requirements, and to talk to each other
via Signal
s and the SignalReceiver
interface (see #send
).
There's a lot more, but that's the gist.
Defined in:
novika/resolver.crConstructors
Instance Method Summary
-
#assign(group : RunnableGroup, *, container : RunnableContainer, overwrite = true) : RunnableContainer
Assigns container to the given group.
-
#assign(group : RunnableGroup, *, preamble : String)
Assigns preamble to the given runnable group.
-
#containerof(group : RunnableGroup) : RunnableContainer
Returns the container assigned to group.
-
#containerof?(group : RunnableGroup) : RunnableContainer | Nil
Returns the container of an application or library group, or nil if group is neither an application nor a library.
-
#cwd : Path
Returns the user's current working directory.
-
#default_env : RunnableEnvironment
Returns the default runnable environment.
-
#defenv(path : Path | Nil)
Returns the
RunnableEnvironment
for path, creating one if it does not exist. -
#defexplicit(query : RunnableQuery)
Marks query as explicit ("hand-written") within this runnable root.
-
#disk : Novika::Resolver::Disk
Returns the disk used by this runnable root.
-
#each_set_flag(& : String -> )
Yields all set (true) flags.
-
#each_wish(& : RunnableQuery -> )
Yields queries from this runnable root's wishlist of queries.
-
#new_primary_container : RunnableContainer
Creates and returns a new primary
RunnableContainer
. -
#preambleof?(group : RunnableGroup) : String | Nil
Returns the preamble of group, or nil if it has none.
-
#send(signal : Signal)
Sends signal to all
SignalReceiver
s subscribed to this runnable root. -
#serve_permissions(to env : RunnableEnvironment) : PermissionServer
Creates and returns a permission server in the given runnable environment env and capability collection caps.
-
#set_flag(name : String, state : Bool)
Assigns state to a boolean flag with the given name.
-
#subscribe(receiver : SignalReceiver)
Subscribes receiver to this runnable root.
-
#unsubscribe(receiver : SignalReceiver)
Unsubscribes receiver from this runnable root.
-
#wish(query : RunnableQuery)
Appends query to the wishlist of this runnable root (the wishlist is like "outbound queries" or "preload requests").
Constructor Detail
Instance Method Detail
Assigns container to the given group.
This is the only way someone from the outside can (reliably) get the container of a group.
overwrite specifies whether the existing container for group should be overwritten with container.
Returns the container that was assigned to group.
Assigns preamble to the given runnable group.
Returns the container assigned to group.
Raises if group is neither an application nor a library.
Returns the container of an application or library group, or nil if group is neither an application nor a library.
Returns the user's current working directory. It is also sometimes referred to as the "primary origin", "origin" as in "primary origin (source) of files".
Returns the default runnable environment.
Currently, current working directory environment is used as the default runnable environment.
Note that if the current working directory does not have an
environment, a "virtual", pathless environment is returned
(see #defenv
).
Returns the RunnableEnvironment
for path, creating one if
it does not exist.
Note that path can be nil, which means the created/returned environment will be so to speak "virtual". The only difference being the "virtual" environment's response to disk-related questions. Namely it'll answer does-not-exist (or something like that) to any disk-related question.
Note also, that only one pathless environment can ever created; as a consequence, all runnable containers that have no environments will share one pathless runnable environment.
Marks query as explicit ("hand-written") within this runnable root.
Yields queries from this runnable root's wishlist of queries.
See #wish
.
Creates and returns a new primary RunnableContainer
.
Returns the preamble of group, or nil if it has none.
Sends signal to all SignalReceiver
s subscribed to this
runnable root.
Creates and returns a permission server in the given runnable environment env and capability collection caps.
Assigns state to a boolean flag with the given name.
Note that by design, an unset flag is a false flag, and vice versa: if state is false, the flag is either not created, or removed.
root.set_flag("happy", true)
root.set_flag("sad", false)
Appends query to the wishlist of this runnable root (the wishlist is like "outbound queries" or "preload requests").
Wishes are picked up from the wishlist by outer infrastructure and loaded distinctly. The only guarantee is that they will indeed be preloaded relative to the query that made the wish, meaning loaded some time before it.
Does nothing if query is already in the wishlist.