second-transfer-0.10.0.4: Second Transfer HTTP/2 web server

Safe HaskellNone
LanguageHaskell2010

SecondTransfer.Sessions.Config

Description

Configuration and settings for the server. All constructor names are exported, but notice that they start with an underscore. They also have an equivalent lens without the underscore. Please prefer to use the lens interface.

Synopsis

Documentation

sessionId :: Functor f => (Int -> f Int) -> SessionCoordinates -> f SessionCoordinates

Get/set a numeric Id from a SessionCoordinates. For example, to get the session id with this, import `Control.Lens.(^.)` and then do

     session_id = session_coordinates ^. sessionId

defaultSessionsConfig :: SessionsConfig

Creates a default sessions context. Modify as needed using the lenses interfaces

defaultSessionsEnrichedHeaders :: SessionsEnrichedHeaders

Don't insert any extra-headers by default.

data SessionComponent

Components at an individual session. Used to report where in the session an error was produced. This interface is likely to change in the future, as we add more metadata to exceptions

newtype SessionCoordinates

Information used to identify a particular session.

Constructors

SessionCoordinates Int 

data SessionsCallbacks

Callbacks that you can provide your sessions to notify you of interesting things happening in the server.

Constructors

SessionsCallbacks 

Fields

_reportErrorCallback_SC :: Maybe ErrorCallback

Used to report errors during this session

_dataDeliveryCallback_SC :: Maybe DataFrameDeliveryCallback

Used to report delivery of individual data frames

_newSessionCallback_SC :: Maybe NewSessionCallback

Used to notify the session manager of new sessions, so that the session manager registers them (in a weak map) if need comes

data SessionsEnrichedHeaders

This is a temporal interface, but an useful one nonetheless. By setting some values here to True, second-transfer will add some headers to inbound requests, and some headers to outbound requests.

This interface is deprecated in favor of the AwareWorker functionality....

Constructors

SessionsEnrichedHeaders 

Fields

_addUsedProtocol :: Bool

Adds a second-transfer-eh--used-protocol header to inbound requests. Default: False

data SessionsConfig

Configuration information you can provide to the session maker.

Constructors

SessionsConfig 

Fields

_sessionsCallbacks :: SessionsCallbacks

Session callbacks

_sessionsEnrichedHeaders :: SessionsEnrichedHeaders
 
_dataFrameSize :: Int

Size to use when splitting data in data frames, to be sent. TODO: An equivalent maxRecvSize should be defined here...

_pushEnabled :: Bool

Should we enable PUSH in sessions? Notice that the client can still disable PUSH at will. Also users of the library can decide not to use it. This just puts another layer ...

_firstPushStream :: Int

The number to use for the first pushed stream. Should be even

_networkChunkSize :: Int

Max amount of bytes to try to send in one go. The session will send less data if less is available, otherwise it will send slightly more than this amount, depending on packet boundaries. This is used to avoid TCP and TLS fragmentation at the network layer

_trayMaxSize :: Int

Max number of packets to hold in the output tray. A high number means that more memory is used by the packets have a higher chance of going out in a favourable order.

data SessionGenericHandle where

An object with information about a new session, wrapped in a weak pointer. At the time the newSessionCallback_SC is invoked, the reference inside the weak pointer is guranteed to be alive. It may die later though.

type ErrorCallback = (SessionComponent, SessionCoordinates, SomeException) -> IO ()

Used by this session engine to report an error at some component, in a particular session.

type DataFrameDeliveryCallback = Int -> Int -> Int -> TimeSpec -> IO ()

Used by the session engine to report delivery of each data frame. Keep this callback very light, it runs in the main sending thread. It is called as f session_id stream_id ordinal when_delivered

newtype NewSessionCallback

Callback to be invoked when a client establishes a new session. The first parameter is the address of the client, and the second parameter is a controller that can be used to reduce the number of connections from time to time, the third parameter is a key on which the second paramter should be made a weak pointer

Constructors

NewSessionCallback (HashableSockAddr -> SessionGenericHandle -> forall a. a -> IO ()) 

data HashableSockAddr

Since SockAddr is not hashable, we need our own. TODO: IPv6.

class ActivityMeteredSession a where

Sessions follow this class, so that they can be rescinded on inactivity

class CleanlyPrunableSession a where

Clean-cut of sessions

Methods

cleanlyCloseSession :: a -> IO ()