24 Commits

Author SHA1 Message Date
tomer doron
0bd5d23606 remove unnecessary preconcurrency imports (#28)
* remove unnecessary preconcurrency imports

motivation: eliminate warnings

changes: require swift 5.7 and remove unnecessary preconcurrency imports for foundation

* fixup
2023-01-10 16:23:39 -08:00
Yim Lee
6a9065203e DocC setup (#22) 2022-08-11 17:01:48 -07:00
Fabian Fett
f1936ce147 Drop Swift 5.2 and 5.3 (#14)
As outlined in a [Swift forums post in November ’21](https://forums.swift.org/t/swiftnio-swift-version-support/53232), SwiftNIO will only support the latest non-patch Swift release and the 2 immediately prior non-patch versions.

In this commit we drop support for Swift 5.2 and 5.3.
2022-04-20 21:25:36 +02:00
tom doron
91cdbbebc7 split events into spearate package
motivation: the runtime library has a stabel API while the events are still moving target, so in order to provide a 1.0 stable version we should separate them out

changes:
* import events module from the swift-aws-lambda-runtime, including git history
* update docker setup
* remove redundant examples and  scripts
2021-07-29 13:34:58 -07:00
Fabian Fett
4308b1be33 Fix platform requirements (#214)
- Replace the placeholder platform requirements with `@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)` 
- Bump required dependency versions: `swift-nio`, `swift-log` and `swift-backtrace`
2021-07-21 20:47:35 +02:00
Fabian Fett
d82295a790 async/await support (#186)
- Add an `AsyncLambdaHandler`. Will be renamed to `LambdaHandler` as soon as we drop the current callback based `LambdaHandler`.
- The default way to use an `AsyncLambdaHandler` is to use `@main` to execute it. Don't use `Lambda.run` for it. We wan't to remove `Lambda.run` for 1.0.

Co-authored-by: tomer doron <tomerd@apple.com>
2021-04-27 22:47:11 +02:00
Fabian Fett
578253f98e Performance Improvements (#199)
Modifications:
- Replace `HTTPHandler` with `NIOHTTPClientResponseAggregator`, to fix a CoW issue. This increases performance.
- Ensure that we only use one `EventLoop` in tests.
- Use `syncOperations` to setup the `HTTPClient`.
2021-04-14 00:21:38 +02:00
tomer doron
e56a5754ed remove requirment on macOS 10.13 (#156)
motivation: simplify downstream libraries

changes: precondition out debugging uses cases on macOS < 10.13
2020-08-10 10:02:12 -07:00
Ro-M
98a295c2bf Added header when reporting failing invocations or initializations #116 (#128)
* allow the users of client to provide headers
* add initialization error header
* add error header to failed invocations
* fix external setting of ip and port via config
* add tests
2020-06-17 06:55:05 -07:00
Fabian Fett
e0384bb7fa add debug functionality to test with mock server (#73)
motivation: allow end to end testing locally

changes:
* add a Lambda+LocalServer which exposes Lambda.withLocalServer available only in DEBUG mode
* local server can receive POST requests with payloads on a configurable endpoint and and send them to the Lambda
* move Lifecycle completely into EventLoop
* remove all locks since running in one EventLoop
* Use UUID for requestId

Co-authored-by: tom doron <tomer@apple.com>
2020-05-15 16:56:17 -07:00
Fabian Fett
8ac63c129e Use NIO in Single Threaded Mode (#68)
motivation: better performance 

changes:  employ SwiftNIO's new Single Threaded Mode

Co-authored-by: tomer doron <tomerd@apple.com>
2020-05-12 13:41:10 -07:00
Fabian Fett
31feb8a84d Moved Foundation to AWSLambdaRuntime; AWSLambdaRuntime renamed to AWSLambdaRuntimeCore (#41)
motivation: enable non-foundation module for performance sensitive use cases

changes: 
* rename AWSLambdaRuntime to AWSLambdaRuntimeCore 
* create AWSLambdaRuntime for Foundation dependent functionality 
* have (new) AWSLambdaRuntime export AWSLambdaRuntimeCore
* adjust tests
2020-05-07 09:37:28 -07:00
Fabian Fett
b19c77173a Improve testing utils (#60)
motivation: make testing lambda easy

changes:
* add a AWSLambdaTesting module
* add helper methods for testing different types of Lambda handlers / closures
2020-04-23 00:11:05 -07:00
Fabian Fett
f4d1a0544f Added S3 Event (#45)
motivation: support S3 Events

changes:
- Created `AWSLambdaEvents` target
- Added S3 Event as first event
- Use propertyWrapper for customers Encoding/Decoding
2020-03-24 16:01:40 -07:00
tomer doron
88b0073cae rename project to SwiftAWSLambdaRuntime (#38)
motivation: unique, accurate name

changes:
* rename project to SwiftAWSLambdaRuntime
* rename main module to AWSLambdaRuntime
* rename / simplify sample module names
* adjust readme and scripts
2020-03-13 14:48:25 -07:00
tomer doron
687bddcf99 swift 5.2 (#37)
motivation: amazon linux support will land in 5.2

changes:
* remove inline as its default in 5.2
* remove linux test and lean on --enable-test-discovery
* adjust package syntax
* format code to match 5.2
2020-03-13 12:54:12 -07:00
tomer doron
9192deb177 refactor api 1 (#33)
motivation: nicer apis, happier users

changes:
* use ByteBuffer + EventLoopFuture for core APIs instead of byte array and callbacks
* create three base protocols: ByteBufferLambdaHandler, EventLoopLambdaHandler and LambdaHandler
* abstract common encoding/decoding functionality into a EventLoopLambdaHandler, reducing most code from string/codable handlers
* only the highest level LambdaHandler is offloaded to a DispatchQueue, lower level is run on the same EventLoop as the core library
* refine encoding/decoding logic
* inline all the things
* adjust tests
* adjust api docs
* adjust readme
2020-03-13 11:44:22 -07:00
Tom Doron
114281067f performance improvments (#17)
motivation: better performance

changes:
* simply url configuration to ip and port so we can reoslve the socket add ress faster
* skip happy eyeballs
* limit eventloop group to 1 thread
* remove use of UUID and URL
* fix backtrace url
2020-03-04 13:54:55 -08:00
Tom Doron
b4591e99b9 performance tests (#16)
motivation: benchmark for comparison of warm/cold runs

changes:
* refactor configuration
* add mock server that can be used by perf tests
* add simple perf test script
* change redundant classes to structs, make remaining classes final
* make offloading opt-in
* safer locking
* fix format
2020-03-04 11:01:15 -08:00
Tom Doron
c31ee33105 refactor (#12)
motivation: make code simpler to reason about, better use of swift-nio

changes:
* remove main loop on global queue + wait, replace with recursion
* make better use of EvenLoopFuture, instead of result types to signal errors
* inject lifecycleId so we can share offloading queue
* improve logging
* adjust and improve tests
* update sanity and generate linux tests script to work better with dates and swiftformat
2019-09-16 10:05:02 +01:00
Tom Doron
4b9cd8350c update code to swift5 and nio2 (#10)
* update code to swift5 and nio2

motivation: support newer version of swift and underlying dependencies

changes:
* adjust code to swift 5
* use swift 5 result type and better error handling for json encoding/decoding
* adjust code to nio 2
* add dependency on swift-log for logging instead of print statements
* make logger as part of context
* improve error handling
* add dependecy on swift-backtrace to capture crashes
* improve lifecycle 
* adjust tests
* add default formatting rules and fix formatting
* improve readme
2019-08-05 14:05:48 -07:00
tomer doron
30a79d8602 pin to swift-nio v1 2019-08-01 16:49:46 -07:00
Tom Doron
6d618f2c33 shutdown handler, lambda api adjustment, latest swift-nio (#5)
* shutdown handler, lambda api adjustment, latest swift-nio

motivation:
* shutdown: while not required, demonstrate better example for shutdown
* latest nio and api adjustments: fixes runtime issues observed when running for realz

changes:
* add signal based shutdown hook that terminates and cleans up resources
* pull latest swift-nio to get fix to thread renaming
* adjust aws lambda api prefix and headers
* reformat linux tests code
2018-11-21 12:57:10 -05:00
tomer doron
93c9cfdf63 initial commit 2018-11-13 17:48:44 -08:00