Closed tachyonics closed 10 months ago
thanks for putting together @tachyonics, I finally had time to review and came up with a slightly more minimal change in https://github.com/swift-server/swift-aws-lambda-runtime/pull/310. If the minimalistic approach is good enough for your use case we can update #308 to that end and close #310 or vice versa.
Closing as this has been replaced by #310
Allow custom initialisation of the HandlerType of the LambdaRuntime.
Motivation:
Provide the flexibility for custom initialisation of the HandlerType as this will often be required by higher level frameworks.
Modifications:
Modify the
LambdaRuntime
type to accept a closure to provide the handler rather than requiring that it is provided by a static method on the Handler type. This is achieved by a new base protocolNonFactoryByteBufferLambdaHandler
that does not have themakeHandler
function requirement.Also provide a new base protocol
NonFactoryLambdaHandler
that doesn't have the initialisation requirements of eitherLambdaHandler
orSimpleLambdaHandler
. This will allow higher level frameworks to initialise their own handlers that however can take advantage of theCodable
conveniences of this package.Result:
Existing high level use cases (
LambdaHandler
andSimpleLambdaHandler
) will continue to be provided but a lower level integration will be possible aimed at higher level frameworks.