[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. |