/// <summary> /// Acquires a <see cref="MeshGossip"/> instance. /// </summary> /// <param name="update">The update to send to the neigbour.</param> /// <param name="since">The version for the update to write.</param> public static MeshGossip Acquire(ReplicatedHybridDictionary update, ReplicatedVersion since) { // Acquires a new gossip packet var packet = Pool.Acquire(); packet.Since = since; packet.Type = MeshEventType.GossipUpdate; packet.State = update; return(packet); }
public void AddRemove() { // Create a registry to replicate var max = 5; var registry = new ReplicatedHybridDictionary(1); for (int i = 0; i < max; ++i) { var data = i.ToHex(); registry.Add(data, new ReplicatedState(data)); } Assert.True(registry.Count == max); for (int i = 0; i < max; ++i) { registry.Remove(i.ToHex()); } Assert.True(registry.Count == 0); }
/// <summary> /// Constructs a new replicated registry provider. /// </summary> /// <param name="nodeIdentifier">The node identifier to use for the replication.</param> public ReplicatedRegistryProvider(int nodeIdentifier) { // Create a new registry this.Registry = new ReplicatedHybridDictionary(nodeIdentifier); }