Mercurial > lbo > hg > clusterrpc-java
changeset 7:0c24a0ee0c34
Lay groundwork for filter stack
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 24 Sep 2016 16:47:46 +0200 |
parents | 0e608c466a58 |
children | 7da0ba664d74 |
files | src/main/java/net/borgac/clusterrpc/client/OutgoingFilter.java src/main/java/net/borgac/clusterrpc/client/Request.java src/main/java/net/borgac/clusterrpc/client/Response.java |
diffstat | 3 files changed, 55 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/net/borgac/clusterrpc/client/OutgoingFilter.java Sat Sep 24 16:47:46 2016 +0200 @@ -0,0 +1,26 @@ +package net.borgac.clusterrpc.client; + +/** + * OutgoingFilters are used to influence the behavior of outgoing RPCs. + * + * An outgoing RPC is given to the first filter, which can modify the request; + * after doing its work, it gives the request to the next filter down the stack + * until the final SendFilter is encountered, which sends the request. + * + * After a response has been received, it goes up through the stack of filters, + * which then can modify or act on the response (for example, retry a failed + * request or log something). + * + * @author lbo + */ +public interface OutgoingFilter { + + /** + * Set the filter that this filter will call. + * + * @param inner + */ + void setInner(OutgoingFilter inner); + + public Response go(Request request); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/net/borgac/clusterrpc/client/Request.java Sat Sep 24 16:47:46 2016 +0200 @@ -0,0 +1,16 @@ +package net.borgac.clusterrpc.client; + +import proto.Rpc; + +/** + * An RPC request issued by a client application. + * + * It goes through the stack of filters before being sent off to the server. + * + * @author lbo + */ +public class Request { + + private Rpc.RPCRequest.Builder rpcRequest; + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/net/borgac/clusterrpc/client/Response.java Sat Sep 24 16:47:46 2016 +0200 @@ -0,0 +1,13 @@ +package net.borgac.clusterrpc.client; + +import proto.Rpc; + +/** + * A response from the remote server, bubbling back up the filter stack. + * + * @author lbo + */ +public class Response { + + Rpc.RPCResponse.Builder rpcResponse; +}