Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit cf3a0e9

Browse files
authored
Removed all usages and support for Authority.AuthorityLossImminent (#1451)
* Removed all usages and support for Authority.AuthorityLossImminent
1 parent 515adce commit cf3a0e9

File tree

13 files changed

+18
-93
lines changed

13 files changed

+18
-93
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- ComponentUpdateSystem no longer has the API `GetAuthority`, `GetComponent`, and `HasComponent`. [#1364](https://github.com/spatialos/gdk-for-unity/pull/1364)
1010
- Use the Unity Entities `EntityManager` instead.
1111
- The GDK now depends on .NET Core v3.1.3xx instead of v2.2.2xx. [#1443](https://github.com/spatialos/gdk-for-unity/pull/1443)
12+
- Removed APIs for AuthorityLossImminent. [#1451](https://github.com/spatialos/gdk-for-unity/pull/1451)
13+
- All authority changes to `AuthorityLossImminent` will now be dropped, and callbacks will no longer trigger.
1214

1315
### Added
1416

UPGRADE_GUIDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## From `0.3.9` to `0.3.10`
44

5+
### AuthorityLossImminent support removed
6+
7+
The GDK for Unity no longer supports the `AuthorityLossImminent` authority state. If this feature is currently enabled, it will not trigger the authority state for any reader or writer. The methods to `Ack` the authority state have also been removed.
8+
9+
To disable the feature for your worker types, please follow the [documentation](https://documentation.improbable.io/spatialos-overview/docs/component-settings).
10+
511
### ComponentUpdateSystem API changes
612

713
The methods `GetAuthority`, `GetComponent`, and `HasComponent` have been removed from the `ComponentUpdateSystem`.

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/CallbackManagers/AuthorityConstraintCallbackManager.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Improbable.Gdk.Subscriptions
77
{
8-
internal class AuthorityConstraintCallbackManager : IAuthorityCallbackManager
8+
internal class AuthorityConstraintCallbackManager : ICallbackManager
99
{
1010
private readonly CallbackCollection<AuthorityChangeReceived> callbackCollection = new CallbackCollection<AuthorityChangeReceived>();
1111
private readonly uint componentId;
@@ -35,18 +35,6 @@ public void InvokeCallbacks()
3535
}
3636
}
3737

38-
public void InvokeLossImminentCallbacks()
39-
{
40-
var changes = componentUpdateSystem.GetAuthorityChangesReceived(componentId);
41-
for (var i = 0; i < changes.Count; ++i)
42-
{
43-
if (changes[i].Authority == Authority.AuthorityLossImminent)
44-
{
45-
callbackCollection.InvokeAllReverse(changes[i]);
46-
}
47-
}
48-
}
49-
5038
public ulong RegisterCallback(Action<AuthorityChangeReceived> callback)
5139
{
5240
callbackCollection.Add(nextCallbackId, callback);

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/CallbackManagers/ComponentAuthorityCallbackManager.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Improbable.Gdk.Subscriptions
77
{
8-
internal class ComponentAuthorityCallbackManager : IAuthorityCallbackManager
8+
internal class ComponentAuthorityCallbackManager : ICallbackManager
99
{
1010
private readonly EntityCallbacks<Authority> callbacks = new EntityCallbacks<Authority>();
1111
private readonly uint componentId;
@@ -34,18 +34,6 @@ public void InvokeCallbacks()
3434
}
3535
}
3636

37-
public void InvokeLossImminentCallbacks()
38-
{
39-
var changes = componentUpdateSystem.GetAuthorityChangesReceived(componentId);
40-
for (var i = 0; i < changes.Count; ++i)
41-
{
42-
if (changes[i].Authority == Authority.AuthorityLossImminent)
43-
{
44-
callbacks.InvokeAllReverse(changes[i].EntityId, changes[i].Authority);
45-
}
46-
}
47-
}
48-
4937
public ulong RegisterCallback(EntityId entityId, Action<Authority> callback)
5038
{
5139
return callbacks.Add(entityId, callback);

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/CallbackManagers/IAuthorityCallbackManager.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/CallbackManagers/IAuthorityCallbackManager.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/Systems/ComponentCallbackSystem.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,12 @@ public bool UnregisterCallback(ulong callbackKey)
7474
return keyAndManager.Item2.UnregisterCallback(keyAndManager.Item1);
7575
}
7676

77-
internal void InvokeNoLossImminent()
77+
internal void InvokeCallbacks()
7878
{
7979
componentCallbackManagers.InvokeEach(manager => manager.InvokeCallbacks());
8080
authorityCallbackManagers.InvokeEach(manager => manager.InvokeCallbacks());
8181
}
8282

83-
internal void InvokeLossImminent()
84-
{
85-
authorityCallbackManagers.InvokeEach(manager => manager.InvokeLossImminentCallbacks());
86-
}
87-
8883
protected override void OnCreate()
8984
{
9085
base.OnCreate();

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/Systems/RequireLifecycleSystem.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected override void OnUpdate()
4242
{
4343
componentConstraintsCallbackSystem.Invoke();
4444

45-
componentCallbackSystem.InvokeNoLossImminent();
45+
componentCallbackSystem.InvokeCallbacks();
4646

4747
if (behavioursToEnable.Count > 0)
4848
{
@@ -59,8 +59,6 @@ protected override void OnUpdate()
5959
behavioursToEnable.Clear();
6060
}
6161

62-
componentCallbackSystem.InvokeLossImminent();
63-
6462
commandCallbackSystem.InvokeCallbacks();
6563
workerFlagCallbackSystem.InvokeCallbacks();
6664
}

workers/unity/Packages/io.improbable.gdk.core/Systems/ComponentUpdateSystem.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ public List<EntityId> GetComponentsRemoved(uint componentId)
7070
return manager.GetComponentsRemoved();
7171
}
7272

73-
public void AcknowledgeAuthorityLoss(EntityId entityId, uint componentId)
74-
{
75-
worker.MessagesToSend.AcknowledgeAuthorityLoss(entityId.Id, componentId);
76-
}
77-
7873
protected override void OnCreate()
7974
{
8075
base.OnCreate();

workers/unity/Packages/io.improbable.gdk.core/Worker/MessagesToSend.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ private static class MessagesToSendMetadata
3535

3636
private readonly WorldCommandsToSendStorage worldCommandStorage = new WorldCommandsToSendStorage();
3737

38-
private readonly MessageList<EntityComponent> authorityLossAcks =
39-
new MessageList<EntityComponent>();
40-
4138
private readonly MessageList<LogMessageToSend> logsToSend = new MessageList<LogMessageToSend>();
4239

4340
private readonly List<Metrics> metricsToSend = new List<Metrics>();
@@ -90,16 +87,10 @@ public void Clear()
9087
storage.Clear();
9188
}
9289

93-
authorityLossAcks.Clear();
9490
logsToSend.Clear();
9591
metricsToSend.Clear();
9692
}
9793

98-
public void AcknowledgeAuthorityLoss(long entityId, uint componentId)
99-
{
100-
authorityLossAcks.Add(new EntityComponent(entityId, componentId));
101-
}
102-
10394
public void AddComponentUpdate<T>(in T update, long entityId)
10495
where T : ISpatialComponentUpdate
10596
{
@@ -152,11 +143,6 @@ internal List<Metrics> GetMetrics()
152143
return metricsToSend;
153144
}
154145

155-
internal MessageList<EntityComponent> GetAuthorityLossAcknowledgements()
156-
{
157-
return authorityLossAcks;
158-
}
159-
160146
internal IComponentDiffStorage GetComponentDiffStorage(uint componentId)
161147
{
162148
if (!componentIdToComponentStorage.TryGetValue(componentId, out var storage))

0 commit comments

Comments
 (0)