THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class RouteLoader(IRouteLoader): (source)
Constructor: RouteLoader(app, router, compiler, cache)
Load route declarations from configured application modules.
| Method | __get |
Build the cache persistence handle for compiled routes. |
| Method | __import |
Import a route file by kind so its fluent registrations run. |
| Method | __init__ |
Initialise the RouteLoader with its required collaborators. |
| Method | __load |
Load compiled routes, using the persistent cache when available. |
| Method | load |
Return all compiled routes, loading them first if necessary. |
| Constant | _KINDS |
Keep a deterministic import order so route registration is stable. |
| Instance Variable | __app |
Application instance used to resolve paths and settings. |
| Instance Variable | __app |
App middleware produced by app.getMiddleware. |
| Instance Variable | __cache |
Serialiser/deserialiser for the compiled route cache. |
| Instance Variable | __compiler |
Compiler that converts raw routes to CompiledRoute objects. |
| Instance Variable | __fallback |
Handler or route selected when no ordinary route matches. |
| Instance Variable | __loaded |
Loaded flag used by RouteLoader. |
| Instance Variable | __persistence |
Persistence produced by self.__getCachePersistence. |
| Instance Variable | __router |
Router that holds the raw registered routes. |
| Instance Variable | __routes |
Route definitions registered in this routing context. |
| Instance Variable | __use |
Use cache flag used by RouteLoader. |
| Property | fallback |
Return the registered fallback handler, if any. |
Build the cache persistence handle for compiled routes.
| Returns | |
orionis.cache.contracts.IFileBasedCache | None | A FileBasedCache instance when the application has a compiled cache directory configured, None otherwise. |
IApplication, router: IRouter, compiler: RouteCompiler, cache: RouteCache):
(source)
¶
Initialise the RouteLoader with its required collaborators.
| Parameters | |
app:orionis.IApplication | Application instance used to resolve paths and settings. |
router:orionis.http.routes.contracts.router.IRouter | Router that holds the raw registered routes. |
compiler:orionis.http.routes.route_compiler.RouteCompiler | Compiler that converts raw routes to CompiledRoute objects. |
cache:orionis.http.routes.route_cache.RouteCache | Serialiser/deserialiser for the compiled route cache. |
| Returns | |
None | The instance is initialised; no value is returned. |
Load compiled routes, using the persistent cache when available.
On a cache hit the routes and fallback are deserialised directly. On a cache miss all route files are imported (which registers routes in the router), the compiler builds CompiledRoute objects, and the result is persisted for subsequent requests. An absent fallback is normalized to None before persistence, matching the representation restored from cache.
| Returns | |
None | Populates self.__routes and self.__fallback in place; no value is returned. |
Return the registered fallback handler, if any.
The fallback is used when no route matches the incoming request. Accessing this property triggers route loading if it has not already occurred.
| Returns | |
tuple | None | (class, method_name) for controller-based fallbacks, (None, callable) for callable-based fallbacks, or None if no fallback has been registered, whether routes are compiled on demand or restored from cache. |