05 / ROUTING
discov
A moonsd Discovery over a file: publish writes what a memory registry holds, FileDiscovery resolves from it and watches it through moonbitlang/async's fs.
WHERE IT SITS
INTERFACE
async fn publish(path : String, registry : @memory.Registry) -> UnititemWrite everything registry holds to path, replacing what was there.
struct FileDiscoverystructA @moonsd.Discovery over the file at path, and a file that is not there is no instances, so a reader can start before the publisher has written anything. It reads the file on every resolve, and a watcher wakes when the file's directory changes.
fn FileDiscovery::new(path : String) -> FileDiscoveryfn
extend FileDiscovery with @moonsd.Discovery::item
impl @moonsd.Discovery for FileDiscovery with fn resolve(self, service)item
impl @moonsd.Discovery for FileDiscovery with fn watch(self, service)item