Skip to content

Conversation

@ktoso
Copy link
Member

@ktoso ktoso commented Jul 6, 2022

Resolves #479
Resolves #983
Provides a good usability basis for #979

This allows for the following:

    distributed actor Example: CustomStringConvertible {
        typealias ActorSystem = ClusterSystem
        
        @ActorID.Metadata(\.exampleUserID)
        var userID: String

        init(userID: String, actorSystem: ActorSystem) async {
            self.actorSystem = actorSystem
            self.userID = userID
        }
    }
        let userID = "user-1234"
        let example = await Example(userID: userID, actorSystem: system)
        
        example.id.metadata.exampleUserID.shouldEqual(userID)

and replaces our _Props.$forSpawn.withValue(...) { ... } dance.

I've not replaced all the uses of the forSpawn yet, but we should be able to for all DA declarations we have 👍

@ktoso ktoso requested a review from yim-lee July 6, 2022 10:53
@ktoso ktoso force-pushed the wip-metadata-id branch from e73386f to c9daef0 Compare July 6, 2022 23:06
//
//===----------------------------------------------------------------------===//

import Dispatch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here yes sadly, just in case™ we use a semaphore here

@ktoso ktoso force-pushed the wip-metadata-id branch from c9daef0 to 94384b4 Compare July 7, 2022 13:14
@ktoso ktoso force-pushed the wip-metadata-id branch from a633e80 to df9b1c1 Compare July 7, 2022 13:33
@ktoso
Copy link
Member Author

ktoso commented Jul 7, 2022

@swift-server-bot test this please

@ktoso
Copy link
Member Author

ktoso commented Jul 7, 2022

Sigh was happy all day and now a bit flaky...

@ktoso ktoso merged commit 028e87b into apple:main Jul 7, 2022
@ktoso
Copy link
Member Author

ktoso commented Jul 7, 2022

Failure is the recently flaky after nio update: #945

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.

Attaching region metadata to a distributed actor ActorID rather than "Unique ActorPath" for resolve and identity

2 participants