예제 #1
0
            public int Update(Peer peer, BindingKey subscription, UpdateAction action)
            {
                if (IsLeaf(subscription))
                {
                    var update = UpdateList(peer, action);
                    _peerCountIncludingChildren += update;

                    return(update);
                }

                var nextPart = subscription.GetPart(_nextPartIndex);

                if (subscription.IsSharp(_nextPartIndex) || nextPart == null)
                {
                    return(UpdateChildNode(GetOrCreateSharpNode(), peer, subscription, action, null, _removeSharpNode));
                }

                if (subscription.IsStar(_nextPartIndex))
                {
                    return(UpdateChildNode(GetOrCreateStarNode(), peer, subscription, action, null, _removeStarNode));
                }

                var childNode = GetOrAddChildNode(nextPart);

                return(UpdateChildNode(childNode, peer, subscription, action, nextPart, _removeNode));
            }