[INFRAUTILS-99] Revise DiagStatus API Created: 08/Nov/22  Updated: 18/Jun/23  Resolved: 18/Jun/23

Status: Resolved
Project: infrautils
Component/s: diagstatus
Affects Version/s: None
Fix Version/s: 6.0.0

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There are a number of lifecycle problems in this API.

ServiceRegistration is not idempotent. It would be nice if it were an AutoCloseable instance – yangtools.concepts.Registration preferrably, but we cannot quite have that now. Anyway unregister() should have a much-preferred idempotent close().

Furthermore ServiceDescriptor takes moduleServiceName which is also supplied to DiagStatusService.register(). This means that ServiceRegistration knows this name and hence could provide a newDescriptor(ServiceState) method without users passing this in.

Finally DiagStatusService.report() takes a ServiceDescriptor and a ServiceState, both of which are required.

Let us have a:

interface DiagStatus implements AutoCloseable {

   void report(ServiceState state);

   @Override
   close();
}

which replaces ServiceRegistration.


Generated at Wed Feb 07 20:02:15 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.