コード例 #1
0
        public Node(Databases database, Server.Node node)
        {
            this.Version  = node.Version;
            this.Password = node.NodePassword;

            this.GroupId                = node.NodeGroup.NodeGroupId;
            this.EngineName             = this.GroupId + "-" + node.ExternalId;
            this.DbDriver               = this.GetDbDriver(database);
            this.DbUrl                  = this.GetDbUrl(database, node.DatabaseHost, node.DatabaseName);
            this.DbUser                 = node.DatabaseUser;
            this.DbPassword             = node.DatabasePassword;
            this.syncUrlPort            = node.SyncUrlPort;
            this.SyncUrl                = string.Format("http://{0}:{1}/sync/{2}", node.DatabaseHost, node.SyncUrlPort, this.EngineName);
            this.ExternalId             = node.ExternalId;
            this.JobPurgePeriodTimeMs   = node.JobPurgePeriodTimeMs ?? 7200000;
            this.JobRoutingPeriodTimeMs = node.JobRoutingPeriodTimeMs ?? 5000;
            this.JobPushPeriodTimeMs    = node.JobPushPeriodTimeMs ?? 10000;
            this.JobPullPeriodTimeMs    = node.JobPullPeriodTimeMs ?? 10000;
            this.InitialLoadCreateFirst = node.InitialLoadCreateFirst;

            // Router 的 Source 是 NodeGroup 集合陣列,Target 是單一個 Node
            this.ProjectId = node.NodeGroup.ProjectId;
            var router = node.NodeGroup.Router.SingleOrDefault(x => x.ProjectId == this.ProjectId);

            if (router != null)
            {
                var targetEngineName = router.TargetNode.NodeGroup.NodeGroupId + "-" + router.TargetNode.ExternalId;
                this.RegistrationUrl = string.Format("http://{0}:{1}/sync/{2}", router.TargetNode.DatabaseHost, router.TargetNode.SyncUrlPort, targetEngineName);
            }
        }
コード例 #2
0
 public MasterNode(Databases database, Server.Node node) : base(database, node)
 {
     this.node       = node;
     this.MasterNode = this;
 }