示例#1
0
        private IActorRef GetShard(ShardId id)
        {
            //TODO: change on ConcurrentDictionary.GetOrAdd?
            IActorRef region = null;

            if (!Shards.TryGetValue(id, out region))
            {
                if (EntityProps == null || EntityProps.Equals(Actor.Props.Empty))
                {
                    throw new IllegalStateException("Shard must not be allocated to a proxy only ShardRegion");
                }
                else if (ShardsByRef.Values.All(shardId => shardId != id))
                {
                    Log.Debug("Starting shard [{0}] in region", id);

                    //val name = URLEncoder.encode(id, "utf-8")
                    var name     = Uri.EscapeDataString(id);
                    var shardRef = Context.Watch(Context.ActorOf(PersistentShard.Props(
                                                                     TypeName,
                                                                     id,
                                                                     EntityProps,
                                                                     Settings,
                                                                     IdExtractor,
                                                                     ShardResolver,
                                                                     HandOffStopMessage).WithDispatcher(Context.Props.Dispatcher), name));

                    ShardsByRef = ShardsByRef.SetItem(shardRef, id);
                    return(shardRef);
                }
            }

            return(region ?? ActorRefs.Nobody);
        }
示例#2
0
 private static void ModifyNode(Godot.Node node, Props oldProps, Props props)
 {
     if (!oldProps.Equals(props) && node is Godot.VBoxContainer control)
     {
         CopyToNode(control, oldProps, props);
     }
 }
示例#3
0
 public static void ModifyNode(Godot.Node node, Props oldProps, Props props)
 {
     if (!oldProps.Equals(props) && node is Godot.Label control)
     {
         CopyToNode(control, oldProps, props);
     }
 }
示例#4
0
 private static void ModifyNode(Godot.Node node, Props oldProps, Props props)
 {
     if (!oldProps.Equals(props) && node is Godot.CenterContainer control)
     {
         CopyToNode(control, oldProps, props);
         Component.RegisterCenterContainerSignals(control, props);
     }
 }
示例#5
0
 public static void ModifyNode(Godot.Node node, Props oldProps, Props props)
 {
     if (!oldProps.Equals(props) && node is Godot.Label control)
     {
         CopyToNode(control, oldProps, props);
         Component.RegisterLabelSignals(control, props);
     }
 }
示例#6
0
        public Installer.Action CompareAndSelectAction(ProductInfo installedProduct, params string [] prefixes)
        {
            if (null == installedProduct)
            {
                return(Installer.Action.Install);
            }
            var versionIsNewer = Uri.CompareSemanticVersion(installedProduct.Uri, prefixes);

            // if new is greater, install
            if (0 < versionIsNewer)
            {
                return(Installer.Action.Install);
            }
            // else (if less or props changed) reinstall
            if (versionIsNewer < 0 || !Props.Equals(installedProduct.Props))
            {
                return(Installer.Action.Reinstall);
            }
            // else (if same and no props changed) run anyway - won't do any harm
            return(Installer.Action.Install);
        }
示例#7
0
        private IActorRef GetShard(ShardId id)
        {
            if (StartingShards.Contains(id))
            {
                return(ActorRefs.Nobody);
            }

            //TODO: change on ConcurrentDictionary.GetOrAdd?
            if (!Shards.TryGetValue(id, out var region))
            {
                if (EntityProps == null || EntityProps.Equals(Actor.Props.Empty))
                {
                    throw new IllegalStateException("Shard must not be allocated to a proxy only ShardRegion");
                }

                if (ShardsByRef.Values.All(shardId => shardId != id))
                {
                    Log.Debug("Starting shard [{0}] in region", id);

                    var name     = Uri.EscapeDataString(id);
                    var shardRef = Context.Watch(Context.ActorOf(Sharding.Shards.Props(
                                                                     TypeName,
                                                                     id,
                                                                     EntityProps,
                                                                     Settings,
                                                                     ExtractEntityId,
                                                                     ExtractShardId,
                                                                     HandOffStopMessage,
                                                                     _replicator,
                                                                     _majorityMinCap).WithDispatcher(Context.Props.Dispatcher), name));

                    ShardsByRef    = ShardsByRef.SetItem(shardRef, id);
                    Shards         = Shards.SetItem(id, shardRef);
                    StartingShards = StartingShards.Add(id);
                    return(shardRef);
                }
            }

            return(region ?? ActorRefs.Nobody);
        }
示例#8
0
 public bool Equals(PbInteropObject other)
 {
     if (ReferenceEquals(other, null))
     {
         return(false);
     }
     if (ReferenceEquals(other, this))
     {
         return(true);
     }
     if (!Props.Equals(other.Props))
     {
         return(false);
     }
     if (ContentType != other.ContentType)
     {
         return(false);
     }
     if (Data != other.Data)
     {
         return(false);
     }
     return(Equals(_unknownFields, other._unknownFields));
 }