Menu

#178 Database service API should be extended

closed-fixed
C++ API
4
2013-07-09
2008-07-25
No

Supose I register two service instances for the same service:
string service = "Sardana";
string inst1 = "XAS";
string inst2 = "NCD";
string d1 = "my/first/device";
string d2 = "my/second/device";
db.register_service(service, inst1, d1);
db.register_service(service, inst2, d2);

Later in time I would like to know the service providers for all "Sardana" service:
I can do:
DbDatum result = db.get_services(service,"*")
vector<string> providers;
result >> providers;

As a result I get a list of devices that provide the service but I do not know which device provides the service for which instance.

I propose adding another method to extract service instances:
DbDatum get_service_instances(string &servicename);

(up to here it would be the minimum)

and to avoid multiple calls to the database, another get_services:
DbData get_services(string &service, vector<string> &serviceinstances );

In fact, ideally I think the get_propety API should be replicated by having:
DbData get_services(string &servicename, string &serviceinstance);
void get_services(string &servicename, DbData &inst);
DbData get_service_instances(string &servicename);

but this would break compatibility with older versions (although I think nobody is using the "Service" feature yet)

Discussion

  • Emmanuel Taurel

    Emmanuel Taurel - 2013-06-07
    • Category: --> C++ API
     
  • Emmanuel Taurel

    Emmanuel Taurel - 2013-07-09
    • status: open --> closed-fixed
     
  • Emmanuel Taurel

    Emmanuel Taurel - 2013-07-09

    Fixed in release 8.1.2

     

Log in to post a comment.

MongoDB Logo MongoDB