Hi,
I employ a client-server model evermore extensively in my designs. Practically everything is a client/actor/service.
Many services are touch-and-go -- but, many other relationships are long standing: a client connects to a service and uses it for very long periods of time (e.g., a display service).
Since I can't know what all clients will require over the length of a session -- nor the lifetime of the product -- I allow clients and servers to *negotiate* their contracts at the start of each session. If a service can't provide the characteristics that the client requires, the client balks and refuses to run (at that time).
Services are shared, of course. So, the characteristics that a service is able/willing to provide to a particular client can change -- based on what other clients' requirements are current.
A negotiated level of service is NEVER REDUCED during a session (!).
The interesting case comes when a level of service has the potential of being *elevated* during a session. Persistent clients can often want to take advantage of those extra capabilities -- "renegotiate" their contracts (though still not giving up the level of service previously agreed upon!).
The problem is determining the most appropriate way to notify existing clients [1] of the possibility for service improvements.
One scheme is to just tag subsequent requests made of the service with some sort of status field ("Oh, by the way, we're currently running a sale on men's shoes. Contact a sales agent for more details...".) This has a relatively low overhead and requires no
*additional* mechanisms beyond those already present (add an IN/OUT to each service request?).It doesn't address clients who are not presently connected to the service (see [1]). And, it relies on clients transacting with the service "often enough" to get timely notifications. ("Gee, we're sorry but the men's shoe sale expired some time ago...") I.e., it effectively requires the clients to *poll* the service if they want this status (imagine if they have no real needs for the *service*, presently, but just want to check to see if the service might be *improvable*!)
Another scheme is to implement an upcall from the service to the client(s). Neglecting the "unclean" feeling that comes with this, it suffers from the fact that it doesn't allow unconnected clients to be notified (again, [1]). And, opens the service up to an *unbounded* obligation on behalf of the client! (ignoring the security implications, etc.)
A variation on this is something akin to an ASR issued on the client by the service -- let the *client* incur the cost of this obligation!
Any "callback" mechanism is complicated by RPC (one of the C-S models's biggest assets!).
And, of course, I've not even mentioned how fairness and priorities can be implemented. Nor race avoidance issues, etc. Before I head down that path, I'd like to see if there are any other techniques I may have overlooked?