Skip to content

Conversation

@stevapple
Copy link
Contributor

@stevapple stevapple commented Dec 7, 2021

Current state:

Sources/AWSLambdaRuntimeCore/LambdaContext.swift:28:20: error: stored property 'logger' of 'Sendable'-conforming struct 'InitializationContext' has non-sendable type 'Logger'
        public let logger: Logger
                   ^
Sources/AWSLambdaRuntimeCore/LambdaContext.swift:34:20: error: stored property 'eventLoop' of 'Sendable'-conforming struct 'InitializationContext' has non-sendable type 'EventLoop'
        public let eventLoop: EventLoop
                   ^
Sources/AWSLambdaRuntimeCore/LambdaContext.swift:37:20: error: stored property 'allocator' of 'Sendable'-conforming struct 'InitializationContext' has non-sendable type 'ByteBufferAllocator'
        public let allocator: ByteBufferAllocator
                   ^
Sources/AWSLambdaRuntimeCore/LambdaContext.swift:98:17: error: stored property 'storage' of 'Sendable'-conforming struct 'LambdaContext' has non-sendable type 'LambdaContext._Storage'
    private var storage: _Storage
                ^

We’re waiting for SwiftNIO and SwiftLog to fully support Sendable, meanwhile the design of LambdaContext should be adapted for Sendable.


WIP: Fix Sendable checking to pass nightly CI.

Motivation:

Add necessary Sendable conformance according to Swift Concurrency adoption guidelines for Swift Server Libraries (swift-server/guides#70).

Modifications:

  • Introduce LambdaSendable as a drop-in Sendable replacement that's compatible with prior Swift versions;
  • Conform LambdaHandler to Sendable;
  • Conform LambdaContext and Lambda.InitializationContext to LambdaSendable;
  • Require EventLoopLambdaHandler.Event and EventLoopLambdaHandler.Output to conform to LambdaSendable.

@swift-server-bot
Copy link

Can one of the admins verify this patch?

11 similar comments
@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@stevapple
Copy link
Contributor Author

I have only added necessary Sandable conformances for passing the compiler’s check. If there’s other type/protocol that should also conform to Sendable please let me know.

@stevapple stevapple marked this pull request as draft December 7, 2021 03:53
@fabianfett
Copy link
Contributor

@swift-server-bot test this please

@stevapple stevapple closed this Apr 14, 2022
@stevapple stevapple deleted the sendable-checking branch April 14, 2022 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants