-
Notifications
You must be signed in to change notification settings - Fork 118
improve API docs #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve API docs #64
Conversation
motivation: better documentation, happier users changes: add more inforamtion on public APIs
|
||
/// A processing closure for a Lambda that takes a `In` and returns a `Result<Out, Error>` via a `CompletionHandler` asynchronously. | ||
/// An asynchronous Lambda Closure that takes a `In: Decodable` and returns a `Result<Out: Encodable, Error>` via a completion handler. | ||
public typealias CodableLambdaClosure<In: Decodable, Out: Encodable> = (Lambda.Context, In, @escaping (Result<Out, Error>) -> Void) -> Void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to move the typealias up right before the matching Lambda.run
function? For readability I prefer if typealiase
s to be defined as close to the usage as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! Some small nits.
/// | ||
/// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine. | ||
public static func run(_ factory: @escaping LambdaHandlerFactory) { | ||
public static func run(_ factory: @escaping ByteBufferLambdaHandlerFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I like this renaming. Sure, the Handler that we want to see returned is a ByteBufferLambdaHandler
and all other protocols inherit from it. But the new naming gives it IMHO an exclusive feel, especially since we don't have an EventLoopLambdaHandlerFactory
or a LambdaHandlerFactory
.
This is not a strong con, just wanted to point it the implication it gave me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// `ByteBufferLambdaHandler` factory. | ||
/// | ||
/// A function that takes a `EventLoop` and returns an `EventLoopFuture` of a `ByteBufferLambdaHandler` | ||
public typealias ByteBufferLambdaHandlerFactory = (EventLoop) -> EventLoopFuture<ByteBufferLambdaHandler> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated above: Do we maybe want to move this typealias up? Maybe even rename:
Lambda.HandlerFactory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typos Co-Authored-By: Fabian Fett <[email protected]> Co-Authored-By: Yim Lee <[email protected]>
@fabianfett @yim-lee feedback addressed |
Co-Authored-By: Yim Lee <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
motivation: better documentation, happier users
changes: add more inforamtion on public APIs