public sealed class SyncList<T>A list the server changes and every client that can see the object ends up with.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
This one does not go through the delta packer, and stretching it to would be wrong. That machinery rests on a fixed lane layout — the server checks that a component's declared lanes add up to what it wrote, and falls back to whole records when they do not. A list is variable-length, so it would fail that check on every send: correct, and useless. Worse, lane-by-lane differencing is actively wrong for a list, because inserting at the front shifts every element and a one-item insert would difference as "all of it changed".
So a list replicates as what happened to it rather than as what it now is: append, insert, remove, replace, clear. One op is a byte, an index and an element, against a whole list every time somebody picked something up.
Corrected when it was wired up: the ops do not travel, the list does. This said that ops go on the wire and that the reliable channel's ordering makes per-connection bookkeeping unnecessary — everyone receives every op exactly once. That is true of a broadcast and false of a snapshot, which is why it was never wired up: a snapshot goes to the connections an interest resolver returns, so somebody who was not observing has received nothing at all, and an object crossing into their interest has to be told the list rather than the last op. SyncListReplicator`1 sends WriteWhole, which makes a late joiner, a reconnect, a lost snapshot and an interest change the same case.
The op log is still what this type is for locally. It drives Changed — which is what a UI binds to, and where "one item was inserted at index three" is exactly the notification a caller wants rather than "here is a list again". What it is not is the wire format.
Fields and properties (4)
public string NameWhat it is called, for diagnostics.
public int CountHow many are in it.
public bool HasPendingWhether there is anything to send.
public T this[int index]Reads one.
Events (1)
public Action<SyncListChange, int, T>? ChangedRaised on whichever end receives a change, after it has been applied.
Methods (12)
public void Rename(string name)Gives it the name its declaration chose.
public SyncList()Creates one.
public void Add(T item)Appends.
public void Insert(int index, T item)Puts something in the middle.
public void RemoveAt(int index)Takes something out.
public void Replace(int index, T item)Replaces something.
public void Clear()Empties it.
public bool WritePending(ref BitWriter writer)Writes the ops that have not gone yet.
public bool WriteWhole(ref BitWriter writer)Writes the whole list, for somebody who has never seen it.
public bool Apply(ref BitReader reader)Applies ops as they arrived.
public void ClearPending()Marks the pending ops as sent.
public IEnumerator<T> GetEnumerator()Returns an enumerator that iterates through the collection.
Used by (5)
- InventoryBehaviourVixen.Net.Engine.Tests
- OperationVixen.Net.Engine
- SyncListReplicationTestsVixen.Net.Engine.Tests
- SyncListTargetVixen.Net.Fuzz
- SyncListTestsVixen.Net.Engine.Tests