You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fatalError("ActorID Metadata for key \(key.id):\(key.keyType) was not assigned initial value, assign one in the distributed actor's initializer.")
63
+
}
64
+
return value as!Value
65
+
}
66
+
set{
67
+
letmetadata= myself.id.metadata
68
+
letkey=myself[keyPath: storageKeyPath]
69
+
iflet value =metadata[key.id]{
70
+
fatalError("Attempted to override ActorID Metadata for key \(key.id):\(key.keyType) which already had value: \(value); with new value: \(String(describing: newValue))")
71
+
}
72
+
metadata[key.id]= newValue
73
+
}
74
+
}
75
+
}
76
+
}
77
+
23
78
extensionClusterSystem{
24
79
/// Uniquely identifies a DistributedActor within the cluster.
25
80
///
@@ -40,7 +95,7 @@ extension ClusterSystem {
40
95
/// The location of the distributed actor (i.e. it being "remote" or "local") is not taken into account
41
96
/// during comparison of IDs, however does matter that it is on the same actual unique node.
42
97
///
43
-
/// Additional information can be attached to them using ``ActorTags`` however those do not impact
98
+
/// Additional information can be attached to them using ``ActorMetadata`` however those do not impact
44
99
/// the identity or equality of the ID, or distributed actors identified by those IDs.
45
100
///
46
101
/// ## Lifecycle
@@ -64,7 +119,7 @@ extension ClusterSystem {
64
119
/// Some tags may be carried to remote peers, while others are intended only for local use,
65
120
/// e.g. to inform the actor system to resolve the actor identity using some special treatment etc.
66
121
///
67
-
/// Please refer to ``ActorTags`` for an in depth discussion about tagging.
122
+
/// Please refer to ``ActorMetadata`` for an in depth discussion about tagging.
68
123
///
69
124
/// ## Serialization
70
125
///
@@ -96,8 +151,10 @@ extension ClusterSystem {
96
151
/// Tags MAY be transferred to other peers as the identity is replicated, however they are not necessary to uniquely identify the actor.
97
152
/// Tags can carry additional information such as the type of the actor identified by this identity, or any other user defined "roles" or similar tags.
98
153
///
99
-
/// - SeeAlso: `ActorTags` for a detailed discussion of some frequently used tags.
100
-
publicvartags:ActorTags
154
+
/// - SeeAlso: ``ActorMetadata`` for a detailed discussion of some frequently used tags.
155
+
publicvarmetadata:ActorMetadata{
156
+
self.context.metadata
157
+
}
101
158
102
159
/// Internal "actor context" which is used as storage for additional cluster actor features, such as watching.
103
160
internalvarcontext:DistributedActorContext
@@ -106,13 +163,13 @@ extension ClusterSystem {
106
163
// FIXME(distributed): make optional
107
164
publicvarpath:ActorPath{
108
165
get{
109
-
guardlet path =tags[ActorTags.path]else{
110
-
fatalError("FIXME: ActorTags.path was not set on \(self)! NOTE THAT PATHS ARE TO BECOME OPTIONAL!!!") // FIXME(distributed): must be removed
166
+
guardlet path =metadata.path else{
167
+
fatalError("FIXME: ActorTags.path was not set on \(self.incarnation)! NOTE THAT PATHS ARE TO BECOME OPTIONAL!!!") // FIXME(distributed): must be removed
_openExistential(tag.keyType asanyActorTagKey.Type, do: store) // the `as` here is required, because: inferred result type 'any ActorTagKey.Type' requires explicit coercion due to loss of generic requirements
// for (key, value) in try decodeCustomMetadata(metadataContainer) {
967
+
// func store(_: K.Type) {
968
+
// if let value = tag.value as? K.Value {
969
+
// self.metadata[K.self] = value
970
+
// }
971
+
// }
972
+
// _openExistential(key, do: store) // the `as` here is required, because: inferred result type 'any ActorTagKey.Type' requires explicit coercion due to loss of generic requirements
/// What type of tags, known and defined by the cluster system itself, should be automatically propagated.
44
-
/// Other types of tags, such as user-defined tags, must be propagated by declaring apropriate functions for `encodeCustomTags` and `decodeCustomTags`.
45
-
internalvarpropagateTags:Set<AnyActorTagKey>=[
46
-
.init(ActorTags.path),
47
-
.init(ActorTags.type),
46
+
/// Other types of tags, such as user-defined tags, must be propagated by declaring apropriate functions for ``encodeCustomMetadata`` and ``decodeCustomMetadata``.
0 commit comments