205 lines · 5.8 KB · Text
RawDownload
.TH REGISTRY 4.SH NAMEregistry, regquery \- registration of services dynamically.SH SYNOPSIS.B ndb/registry[.BI -f " dbfile"].PP.B ndb/regquery[.BI -m " mntpt"][.B -n][.I "attr value"] ....SH DESCRIPTION.I Registryis a file server thatprovides registration and location of services by their attributeswhere services come and go.It was originally intended to register Grid resourcesbut has much wider use..I Registryserves Styx on its standard input.That can be mounted in the local name space (see below for an example),or served over a connection(eg, via.IR listen (1)).The conventional local mount point is.BR /mnt/registry ,which is where.IR registries (2)expects to find the local registry by default.There can, however, be any number of registries active,each supporting a different group of users and services,in different authentication domains..PP.I Registryserves a one-level directory containing a few control filesand one file per registered service.All the files are text files with similar format:zero or more lines of one or more words, separated by white space (blank or tab).A word can be quoted, using single quotes in the style of.IR sh (1),allowing it to contain white spaceor represent the empty string.BR \&'' .Within a quoted word, a single quote character is represented by two adjacent ones.(In programs, use.B String->quotedfrom.IR string (2),or more simply the.B %qstring format of.IR sys-print (2)to quote strings appropriately.).PPThe control files are:.TF index.PD.TP.B newA text file that is opened and written to register a new service.Opening.B newreturns a file descriptor to a new but anonymous service file.It must be written to set its name and initial description.The first write contains one or more words:.RS.IP.IR svcname " [" " attr value " ] ...".PPThe first word,.IR svcname ,is the proposed service name.The write returns an error if the name duplicates any existing name.Otherwise, a new file.I svcnamewill appear in the directory.The optional attribute value pairs form the initial service description.The service is removed from the register by default when the file is closed.To advertise a service without having to hold open a file descriptor, include an.I attrnamed.B persistwith non-zero.IR value ;the service will then remain registered until explicitly removed (see below)..RE.TP.B indexA read-only text file containing a list of all the currently-registered services, one per line.Each line contains a sequence of words.The first word is the service name and the remaining ones are paired: attribute name then value..TP.B findA text file which should be opened for reading and writing.Each write provides a set of attribute/value pairs that acts as a filter, selecting only thoseservices that possess all the given attributes with the given values;the value.B \&"*"matches any value.Subsequent reads return a list of services, in the same formatas.BR index ,but listing only the selected services.The selection is made from those available at the time of the write.There is a separate filter for each open instance of.BR find ,so that several processes can set different filters simultaneously.(Note that after the write, the file offset must be set to zero using.IR sys-seek (2)before reading.).TP.B eventA read-only text file that can be used to detect when changes are made to the registry.Reading from it blocks until a change is made. At that point, the read completes and returns astring with a newline terminated decimal version number representingthe number of changes made to the registry, which matches.B Qid.versfor the registry directory.Multiple changes are coalesced into one report..PPA service file created by.B newmay be read by anyone, but may be written only by its owner.Each write must contain a set of attribute/value pairs, formatted as above, which adds new attributes to the servicedescription and changes the value ofexisting attributes.The file remains until the service is struck off the register.The owner of a service can remove its registration at any time by removing the correspondingservice file (eg, using.IR rm (1)or.IR sys-remove (2))..PPTypically, most services register themselves dynamically, perhaps using their locations (eg, network address)as their service names..RI ( Registryitself does not interpret the name.)The.B -foption causes.I registryto load initially a set of static service descriptions from.IR dbfile ,which is in.IR attrdb (6)format.The database entry for each service contains the pair.BI service= svcname,causing.I registryto make an entry for the given.I svcnamewith attribute/value pairs initialised from the rest of that database entry.For example:.IP.EXservice=net!click!1234	description='snapshot service' auth=none.EE.PPStatic entries are regarded as persistent but can be removed explicitly by the registry owner..PP.I Regquerylooks for services in the registry mounted at.I mntpt(default:.BR /mnt/registry )that match all the given attribute/value pairs.It prints the resulting list of services, one per line.If the.B -noption is given,.I regqueryprints only the service name(s); otherwise it prints the service description as well.If no attributes are given on the command line,.I regqueryprompts for successive queries, one per line, and prints each result..SH EXAMPLEStart a registry that appears at the standard location for local registries,.BR /mnt/registry :.IP.EXmount -A ${pipe to ndb/register} /mnt/registry.EE.PPMake that registry available to the network on authenticated connections:.IP.EXlisten -v 'tcp!*!registry' {export /mnt/registry&}.EE.SH SOURCE.B /appl/cmd/ndb/registry.b.SH SEE ALSO.IR attrdb (2),.IR registries (2).SH BUGSIt is not currently possible to have two values with the same attribute name in the same service description.