public void Cluster(Cluster cluster) { if (cluster == null) throw new NotSupportedException("undefined cluster"); _cluster = cluster; }
public bool ClusterBadge(Clusterable badge, Cluster cluster) { if (badge.IsInCluster()) { //two or more clients sent clustering requests in the same time. first wins Log.Warn("cluster failed: badge=" + badge.GetId() + " cluster=" + cluster.GetId() + " current cluster of badge=" + badge.GetCluster().GetId()); return false; } badge.Cluster(cluster); cluster.Add(badge); return true; }
public void Uncluster() { if (_cluster == null) throw new NotSupportedException("already unclustered"); _cluster = null; }
public void DeleteCluster(Cluster cluster, int usrId) { //1 unlink from all UnlinkFromAll(cluster, -1); //2 remove all clusterables from cluster foreach (var badge in cluster.GetClusterables().ToArray()) UnclusterBadge(badge, -1); //3 remove cluster _clusters.Remove(cluster.GetId()); if (onLinkableDeleted != null) onLinkableDeleted(cluster, usrId); }
private void __unclusterBadge(Clusterable badge, Cluster cluster, int userId) { _room.BroadcastReliableToRoom((byte) DiscussionEventCode.UnclusterBadgeEvent, UnclusterBadgeMessage.Write( badge.GetId(), cluster.GetId(), true, _topicId, userId, -1)); EventLogger.LogAndBroadcast(new DiscCtx(Discussions.ConfigManager.ConnStr), _room, StEvent.ClusterOut, userId, _topicId); _pendingChanges = true; }