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
guardlet value = myself.id.metadata[Key.self]else{
48
+
fatalError("ActorID Metadata for key \(Key.self) was not assigned initial value, assign one in the distributed actor's initializer.")
49
+
}
50
+
return value
53
51
}
54
52
set{
55
-
lettags= myself.id.tags
56
-
tags[Key.self]= newValue
53
+
letmetadata= myself.id.metadata
54
+
iflet value =metadata[Key.self]{
55
+
fatalError("Attempted to override ActorID Metadata for key \(Key.self) which already had value: \(value); with new value: \(String(describing: newValue))")
56
+
}
57
+
metadata[Key.self]= newValue
57
58
}
58
59
}
59
60
}
@@ -79,7 +80,7 @@ extension ClusterSystem {
79
80
/// The location of the distributed actor (i.e. it being "remote" or "local") is not taken into account
80
81
/// during comparison of IDs, however does matter that it is on the same actual unique node.
81
82
///
82
-
/// Additional information can be attached to them using ``ActorTags`` however those do not impact
83
+
/// Additional information can be attached to them using ``ActorMetadata`` however those do not impact
83
84
/// the identity or equality of the ID, or distributed actors identified by those IDs.
84
85
///
85
86
/// ## Lifecycle
@@ -103,7 +104,7 @@ extension ClusterSystem {
103
104
/// Some tags may be carried to remote peers, while others are intended only for local use,
104
105
/// e.g. to inform the actor system to resolve the actor identity using some special treatment etc.
105
106
///
106
-
/// Please refer to ``ActorTags`` for an in depth discussion about tagging.
107
+
/// Please refer to ``ActorMetadata`` for an in depth discussion about tagging.
107
108
///
108
109
/// ## Serialization
109
110
///
@@ -135,9 +136,9 @@ extension ClusterSystem {
135
136
/// Tags MAY be transferred to other peers as the identity is replicated, however they are not necessary to uniquely identify the actor.
136
137
/// 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.
137
138
///
138
-
/// - SeeAlso: `ActorTags` for a detailed discussion of some frequently used tags.
139
-
publicvartags:ActorTags{
140
-
self.context.tags
139
+
/// - SeeAlso: ``ActorMetadata`` for a detailed discussion of some frequently used tags.
140
+
publicvarmetadata:ActorMetadata{
141
+
self.context.metadata
141
142
}
142
143
143
144
/// Internal "actor context" which is used as storage for additional cluster actor features, such as watching.
@@ -147,13 +148,13 @@ extension ClusterSystem {
147
148
// FIXME(distributed): make optional
148
149
publicvarpath:ActorPath{
149
150
get{
150
-
guardlet path =tags[ActorTags.path]else{
151
+
guardlet path =metadata[ActorMetadata.path]else{
151
152
fatalError("FIXME: ActorTags.path was not set on \(self.incarnation)! NOTE THAT PATHS ARE TO BECOME OPTIONAL!!!") // FIXME(distributed): must be removed
152
153
}
153
154
return path
154
155
}
155
156
set{
156
-
self.tags[ActorTags.path]= newValue
157
+
self.metadata[ActorMetadata.path]= newValue
157
158
}
158
159
}
159
160
@@ -178,7 +179,7 @@ extension ClusterSystem {
178
179
self._location =.local(node)
179
180
self.incarnation = incarnation
180
181
iflet path {
181
-
self.tags[ActorTags.path]= path
182
+
self.context.metadata[ActorMetadata.path]= path
182
183
}
183
184
traceLog_DeathWatch("Made ID: \(self)")
184
185
}
@@ -194,7 +195,7 @@ extension ClusterSystem {
194
195
self._location =.remote(node)
195
196
self.incarnation = incarnation
196
197
iflet path {
197
-
self.context.tags[ActorTags.path]= path
198
+
self.context.metadata[ActorMetadata.path]= path
198
199
}
199
200
traceLog_DeathWatch("Made ID: \(self)")
200
201
}
@@ -206,7 +207,7 @@ extension ClusterSystem {
206
207
self._location =.remote(node)
207
208
self.incarnation = incarnation
208
209
iflet mangledName =_mangledTypeName(type){ // TODO: avoid mangling names on every spawn?
_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
Copy file name to clipboardExpand all lines: Sources/DistributedActors/ActorTagSettings.swift
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,8 @@ public struct ActorTagSettings {
43
43
/// What type of tags, known and defined by the cluster system itself, should be automatically propagated.
44
44
/// Other types of tags, such as user-defined tags, must be propagated by declaring apropriate functions for `encodeCustomTags` and `decodeCustomTags`.
// but we can only do this when we remove the dependence on paths and behaviors entirely from DA actors https://github.com/apple/swift-distributed-actors/issues/957
923
923
id.context =DistributedActorContext(
924
924
lifecycle: lifecycleContainer,
925
-
tags: id.context.tags
925
+
metadata: id.context.metadata
926
926
)
927
927
928
928
self.log.warning("Assign identity", metadata:[
@@ -947,13 +947,6 @@ extension ClusterSystem {
947
947
defer{self.namingLock.unlock()}
948
948
precondition(self._reservedNames.remove(actor.id)!=nil,"Attempted to ready an identity that was not reserved: \(actor.id)")
949
949
950
-
// if let watcher = actor as? any LifecycleWatch {
0 commit comments