Closed alex-saoulis closed 1 year ago
When you say "all pvs across all the servers", have you considered servers coming up and going down over time?
I do have a plan, and some very early prototyping, of an API. It currently appears on my very volatile ci
branch. I would summarize the current interface design as:
struct Discovered {
std::string peer;
std::string server;
ServerGUID guid;
};
class PVXS_API Context {
...
DiscoverBuilder discover(std::function<void(const Discovered &)> &&);
This is enough to implement a pvlist
-like executable, but I think it needs more work. Specifically, I'd like to handle notification when a server going offline as well. This would allow something like casw
to ~efficiently manage a list of active servers without having to repeatedly spam with global discovery broadcasts (as pvlist
does).
When you say "all pvs across all the servers", have you considered servers coming up and going down over time?
Good point - no, all I do is gather the pvs on initialisation. Even better, using something like casw
to passively monitor available servers would be ideal, so I'm glad to hear that it's in active development! Where in ci
is your prototype?
A place to start is the pvxlist
executable https://github.com/mdavidsaver/pvxs/blob/ci/tools/list.cpp
Starting with 0.3.0, pvxslist -w 0
combines a one-shot discovery ping with continuing reception of beacons to detect servers comes up and going down (like casw
). This is based on an evolution of the Context::discover()
method mentioned above.
$ pvxlist -h
Usage:
Discover Servers:
./bin/linux-x86_64/pvxlist [options]
List PVs:
./bin/linux-x86_64/pvxlist [options] <IP[:Port] ...>
Server Info:
./bin/linux-x86_64/pvxlist [options] -i <IP[:Port] ...>
Examples:
Monitor server beacons to detect servers coming online, and going offline.
./bin/linux-x86_64/pvxlist -w 0 -v
List all PV names. (Warning: high network load)
./bin/linux-x86_64/pvxlist -w 5 | ./bin/linux-x86_64/pvxlist
-h Show this message.
-V Print version and exit.
-A Active discovery mode (default). Send broadcast ping, then continue
listening for Beacons.
Warning: Active discovery pings result in a lot of network traffic.
-p Passive discovery mode. Only listen for server Beacons.
-i Query server info. Requires address(es)
-v Make more noise.
-d Shorthand for $PVXS_LOG="pvxs.*=DEBUG". Make a lot of noise.
-w <sec> Operation timeout in seconds. Default 5 sec. '0' disables timeout,
useful in combination with '-v'.
Are there any plans to add support for using the EPICS
pvlist
command line tool? I've been able to hack something together using system calls topvlist
within my C++ project to get a list of servers, and then pull down all pvs across all the servers, but it may be more convenient for a similar function to be handled within the pvxs library.