swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.13k stars 102 forks source link

Change Lambda.Context from class to struct #217

Closed jareyesda closed 3 years ago

jareyesda commented 3 years ago

Lambda.Context changed from a class to a struct.

Motivation:

As described in issue #215. Lambda.Context is currently a class that is a wrapper around values. Because it should be a value type, it was changed from a class to a struct.

Modifications:

The modifications are nearly identical to the changes from #167 - minus the addition of Baggage. The change from a class to a struct also follows CoW semantics to keep performance high. Line 104 of Sources/AWSLambdaRuntimeCore/LambdaRunner.swift had "convenience" and "file private" removed as well.

There are two differences between #167 and this modification: 1) At the time of forking, Tests/AWSLambdaRuntimeTests/Lambda+CodeableTest.swift was not present. 2) There is no Baggage

Result:

Lambda.Context is now a CoW-boxed struct instead of a class.

Note:

This is my first contribution. Please advise on how I can improve future contributions and the proper methodology on testing this change. Thank you all in advance :)

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

fabianfett commented 3 years ago

@swift-server-bot test this please

fabianfett commented 3 years ago

Cool CI is green except for code-formatting. You will need to install swiftformat in version 0.47.3 on your mac. And run swiftformat in your lambda folder. If you need help achieving this, reach out :)

ktoso commented 3 years ago

This seems based on my previous work — I’m out today, can you give me a day tomorrow to double check this? Thanks

jareyesda commented 3 years ago

Cool CI is green except for code-formatting. You will need to install swiftformat in version 0.47.3 on your mac. And run swiftformat in your lambda folder. If you need help achieving this, reach out :)

Awesome. I'll go ahead and implement it. I'll follow up if I have any questions!

jareyesda commented 3 years ago

This seems based on my previous work — I’m out today, can you give me a day tomorrow to double check this? Thanks

Please do! I would love some feedback

ktoso commented 3 years ago

Still the formatting issue pending though it seems?

jareyesda commented 3 years ago

Still the formatting issue pending though it seems?

Yes. Once I get home I will fix the formatting issue

fabianfett commented 3 years ago

@swift-server-bot test this please