srvFS
srvFS():
Fileserver&SrvCapable&SrvObservable
Defined in: packages/core/src/kernel/fileservers/srv.ts:152
Create a /srv fileserver — a programmatic registry of posted Fileservers.
Returns
Section titled “Returns”Fileserver & SrvCapable & SrvObservable
A Fileserver that also implements SrvCapable (post / get / remove) and SrvObservable (subscribe).
Remarks
Section titled “Remarks”Plan 9’s /srv as a runtime service registry: processes post mountable
fileservers via postServer(name, fs) and the mount / bind bins read
them back via getServer(name). The byte view at /srv/<name> is
intentionally trivial — reading returns the name followed by a newline —
because the useful channel is the SrvCapable methods on the
fileserver object itself, not the file contents.
write, mkdir, rename, wstat, and remove all throw EPERM at
the Fileserver protocol level: posting is programmatic, not byte-oriented.
Use removeServer(name) to unpost.
Example
Section titled “Example”import { srvFS, memoryFS } from '@fishnet/core'const srv = srvFS()const unsub = srv.subscribe(e => console.log(e.type, e.name))srv.postServer('scratch', memoryFS())// now `bind /srv/scratch /mnt/scratch` in the shell mounts itsrv.removeServer('scratch')unsub()Caveat
Section titled “Caveat”Namespaces are snapshot-on-fork. A postServer call visible in
the posting process’s /srv is NOT automatically visible to
unrelated processes that forked their namespace earlier — they
need to re-bind or share the same srv reference.