Exemplo n.º 1
0
        public void Add(TabletInfo tablet)
        {
            if (Tablets.Contains(tablet))
            {
                throw new Hubble.Core.Data.DataException("Can insert same table name into bigtable");
            }

            Tablets.Add(tablet);
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            TabletInfo dest = obj as TabletInfo;

            if (dest == null)
            {
                return(false);
            }

            return(this.TableName.Equals(dest.TableName, StringComparison.CurrentCultureIgnoreCase));
        }
Exemplo n.º 3
0
        public void Add(string tableName, ServerType serverType, ServerInfo serverInfo)
        {
            TabletInfo tablet = new TabletInfo(tableName);

            int index = Tablets.IndexOf(tablet);

            if (index >= 0)
            {
                tablet = Tablets[index];

                switch (serverType)
                {
                case ServerType.Balance:
                    if (tablet.BalanceServers.Contains(serverInfo))
                    {
                        throw new Hubble.Core.Data.DataException("Can insert same table name with same server name into bigtable");
                    }
                    else
                    {
                        tablet.BalanceServers.Add(serverInfo);
                    }
                    break;

                case ServerType.Failover:
                    if (tablet.FailoverServers.Contains(serverInfo))
                    {
                        throw new Hubble.Core.Data.DataException("Can insert same table name with same server name into bigtable");
                    }
                    else
                    {
                        tablet.FailoverServers.Add(serverInfo);
                    }
                    break;
                }
            }
            else
            {
                switch (serverType)
                {
                case ServerType.Balance:
                    tablet.BalanceServers.Add(serverInfo);
                    break;

                case ServerType.Failover:
                    tablet.FailoverServers.Add(serverInfo);
                    break;
                }

                Tablets.Add(tablet);
            }
        }
Exemplo n.º 4
0
        public TabletInfo Clone()
        {
            TabletInfo tableInfo = new TabletInfo();

            tableInfo.TableName = this.TableName;

            foreach (ServerInfo serverInfo in this.BalanceServers)
            {
                tableInfo.BalanceServers.Add(serverInfo.Clone());
            }

            foreach (ServerInfo serverInfo in this.FailoverServers)
            {
                tableInfo.FailoverServers.Add(serverInfo.Clone());
            }

            return(tableInfo);
        }