class (NFData (Input rpc), NFData (Output rpc), Show (Input rpc), Show (Output rpc), Show (RequestMetadata rpc), Show (ResponseInitialMetadata rpc), Show (ResponseTrailingMetadata rpc)) => IsRPC (rpc :: k) whereAbstract definition of an RPC
Note on encoding: the gRPC specification does not say anything about text encoding issues for paths (service names and method names) or message types. The Protobuf compiler (by far the most common instantation of gRPC) does not allow for non-ASCII character at all ("interpreting non ascii codepoint"). We therefore punt on the encoding issue here, and use bytestrings. If applications want to use non-ASCII characters, they can choose their own encoding.
Methods
rpcContentType :: Proxy rpc -> ByteStringContent-type
gRPC is agnostic to the message format; the spec defines the
Content-Typeheader asContent-Type → "content-type" "application/grpc" [("+proto" / "+json" / {custom})]defaultRpcContentType can be used in the case that the format (such as
proto) is known.Note on terminology: throughout this codebase we avoid the terms "encoding" and "decoding", which can be ambiguous. Instead we use "serialize"/"deserialize" and "compress"/"decompress".
rpcServiceName :: HasCallStack => Proxy rpc -> ByteStringService name
For Protobuf, this is the fully qualified service name.
rpcMethodName :: HasCallStack => Proxy rpc -> ByteStringMethod name
For Protobuf, this is just the method name (no qualifier required).
rpcMessageType :: HasCallStack => Proxy rpc -> Maybe ByteStringMessage type, if specified
This is used to set the (optional)
grpc-message-typeheader. For Protobuf, this is the fully qualified message type.
Instances3IsRPC
(KnownSymbol serv, KnownSymbol meth, NFData (Input (JsonRpc serv meth)), NFData (Output (JsonRpc serv meth)), Show (Input (JsonRpc serv meth)), Show (Output (JsonRpc serv meth)), Show (RequestMetadata (JsonRpc serv meth)), Show (ResponseInitialMetadata (JsonRpc serv meth)), Show (ResponseTrailingMetadata (JsonRpc serv meth))) => IsRPC (JsonRpc serv meth)Defined in grpc-spec-1.0.0 · Network.GRPC.Spec.RPC.JSON(KnownSymbol serv, KnownSymbol meth, Show (RequestMetadata (RawRpc serv meth)), Show (ResponseInitialMetadata (RawRpc serv meth)), Show (ResponseTrailingMetadata (RawRpc serv meth))) => IsRPC (RawRpc serv meth)Defined in grpc-spec-1.0.0 · Network.GRPC.Spec.RPC.Raw(HasMethodImpl serv meth, Show (MethodInput serv meth), Show (MethodOutput serv meth), NFData (MethodInput serv meth), NFData (MethodOutput serv meth), Show (RequestMetadata (Protobuf serv meth)), Show (ResponseInitialMetadata (Protobuf serv meth)), Show (ResponseTrailingMetadata (Protobuf serv meth))) => IsRPC (Protobuf serv meth)Defined in grpc-spec-1.0.0 · Network.GRPC.Spec.RPC.Protobuf