1Registries: module { 2 PATH: con "/dis/lib/registries.dis"; 3 init: fn(); 4 5 Attributes: adt { 6 attrs: list of (string, string); 7 8 get: fn(a: self ref Attributes, attr: string): string; 9 set: fn(a: self ref Attributes, attr, val: string); 10 new: fn(attrs: list of (string, string)): ref Attributes; 11 }; 12 13 Attached: adt { 14 fd: ref Sys->FD; 15 signerpkhash: string; 16 localuser: string; 17 remoteuser: string; 18 }; 19 20 Service: adt { 21 addr: string; # dial this to connect to the service. 22 attrs: ref Attributes; # information about the nature of the service. 23 24 attach: fn(s: self ref Service, user: string, keydir: string): ref Attached; 25 }; 26 27 Registered: adt { 28 addr: string; 29 reg: ref Registry; 30 fd: ref Sys->FD; 31 }; 32 33 Registry: adt { 34 dir: string; 35 indexfd: ref Sys->FD; 36 37 new: fn(dir: string): ref Registry; 38 connect: fn(svc: ref Service, user: string, keydir: string): ref Registry; 39 services: fn(r: self ref Registry): (list of ref Service, string); 40 find: fn(r: self ref Registry, a: list of (string, string)): (list of ref Service, string); 41 register: fn(r: self ref Registry, addr: string, attrs: ref Attributes, persist: int): (ref Registered, string); 42 unregister: fn(r: self ref Registry, addr: string): string; 43 }; 44}; 45