grpc-haskell-0.1.0: Haskell implementation of gRPC layered on shared C library.
Safe HaskellNone
LanguageHaskell2010

Network.GRPC.HighLevel

Synopsis

Types

newtype MetadataMap #

Represents metadata for a given RPC, consisting of key-value pairs. Keys are allowed to be repeated. Since repeated keys are unlikely in practice, the IsList instance uses key-value pairs as items. For example, fromList [("key1","val1"),("key2","val2"),("key1","val3")].

newtype MethodName #

Constructors

MethodName 

Instances

Instances details
Eq MethodName 
Instance details

Defined in Network.GRPC.LowLevel.Call

Show MethodName 
Instance details

Defined in Network.GRPC.LowLevel.Call

IsString MethodName 
Instance details

Defined in Network.GRPC.LowLevel.Call

data GRPCIOError #

Describes all errors that can occur while running a GRPC-related IO action.

Constructors

GRPCIOCallError CallError

Errors that can occur while the call is in flight. These errors come from the core gRPC library directly.

GRPCIOTimeout

Indicates that we timed out while waiting for an operation to complete on the CompletionQueue.

GRPCIOShutdown

Indicates that the CompletionQueue is shutting down and no more work can be processed. This can happen if the client or server is shutting down.

GRPCIOShutdownFailure

Thrown if a CompletionQueue fails to shut down in a reasonable amount of time.

GRPCIOUnknownError 
GRPCIOBadStatusCode StatusCode StatusDetails 
GRPCIODecodeError String 
GRPCIOInternalUnexpectedRecv String 
GRPCIOHandlerException String 

data GRPCImpl Source #

Used at the kind level as a parameter to service definitions generated by the grpc compiler, with the effect of having the field types reduce to the appropriate types for the method types.

Constructors

ServerImpl 
ClientImpl 

type family MkHandler (impl :: GRPCImpl) (methodType :: GRPCMethodType) i o Source #

GHC does not let us partially apply a type family. However, we can define a type to use as an interpreter, and then use this interpreter type fully applied to get the same effect.

data ServiceOptions Source #

Options for a service that was generated from a .proto file. This is essentially ServerOptions with the handler fields removed.

Constructors

ServiceOptions 

Fields

Server

data ServerOptions Source #

Constructors

ServerOptions 

Fields

data ServerCall a #

Represents one registered GRPC call on the server. Contains pointers to all the C state needed to respond to a registered call.

Instances

Instances details
Functor ServerCall 
Instance details

Defined in Network.GRPC.LowLevel.Call

Methods

fmap :: (a -> b) -> ServerCall a -> ServerCall b #

(<$) :: a -> ServerCall b -> ServerCall a #

Show a => Show (ServerCall a) 
Instance details

Defined in Network.GRPC.LowLevel.Call

Client

data ClientCall #

Represents one GRPC call (i.e. request) on the client. This is used to associate send/receive Ops with a request.

Client and Server Auth

data AuthContext #

Context for auth. This is essentially just a set of key-value pairs that can be mutated. Note: it appears that any keys set or modified on this object do not appear in the AuthContext of the peer, so you must send along auth info in the metadata. It's currently unclear to us what the purpose of modifying this is, but we offer the ability for the sake of completeness.

data AuthProperty #

Represents one key/value pair in an AuthContext.

Instances

Instances details
Eq AuthProperty 
Instance details

Defined in Network.GRPC.Unsafe.Security

Show AuthProperty 
Instance details

Defined in Network.GRPC.Unsafe.Security

addAuthProperty :: AuthContext -> AuthProperty -> IO () #

Adds a new property to the given AuthContext.

Server Auth

data ServerSSLConfig #

Configuration for SSL.

Constructors

ServerSSLConfig 

Fields

type ProcessMeta = AuthContext -> MetadataMap -> IO AuthProcessorResult #

A custom auth metadata processor. This can be used to implement customized auth schemes based on the metadata in the request.

data AuthProcessorResult #

Constructors

AuthProcessorResult 

Fields

  • resultConsumedMetadata :: MetadataMap

    Metadata to remove from the request before passing to the handler.

  • resultResponseMetadata :: MetadataMap

    Metadata to add to the response.

  • resultStatus :: StatusCode

    StatusOk if auth was successful. Using any other status code here will cause the request to be rejected without reaching a handler. For rejected requests, it's suggested that this be StatusUnauthenticated or StatusPermissionDenied. NOTE: if you are using the low-level interface and the request is rejected, then handling functions in the low-level interface such as serverHandleNormalCall will not unblock until they receive another request that is not rejected. So, if you write a buggy auth plugin that rejects all requests, your server could hang.

  • resultStatusDetails :: StatusDetails
     

data SslClientCertificateRequestType #

Instances

Instances details
Bounded SslClientCertificateRequestType 
Instance details

Defined in Network.GRPC.Unsafe.Security

Enum SslClientCertificateRequestType 
Instance details

Defined in Network.GRPC.Unsafe.Security

Eq SslClientCertificateRequestType 
Instance details

Defined in Network.GRPC.Unsafe.Security

Ord SslClientCertificateRequestType 
Instance details

Defined in Network.GRPC.Unsafe.Security

Show SslClientCertificateRequestType 
Instance details

Defined in Network.GRPC.Unsafe.Security

Client Auth

data ClientSSLConfig #

SSL configuration for the client. It's perfectly acceptable for both fields to be Nothing, in which case default fallbacks will be used for the server root cert.

Constructors

ClientSSLConfig 

Fields

type ClientMetadataCreate = AuthMetadataContext -> IO ClientMetadataCreateResult #

Optional plugin for attaching custom auth metadata to each call.

data ClientMetadataCreateResult #

Constructors

ClientMetadataCreateResult 

Fields

data AuthMetadataContext #

The context which a client-side auth metadata plugin sees when it runs.

Constructors

AuthMetadataContext 

Fields

Streaming utilities

type StreamSend a = a -> IO (Either GRPCIOError ()) #