示例#1
0
        public ShardedVertexTable(string vertexName, string epochId,
                                  List <string> allInstances,
                                  List <int> allShards, List <int> addedShards, List <int> removedShards,
                                  Expression <Func <int, int> > shardLocator)
        {
            this.PartitionKey = vertexName;
            this.RowKey       = epochId;

            this.AllInstances  = string.Join(";", allInstances);
            this.AllShards     = string.Join(";", allShards);
            this.AddedShards   = string.Join(";", addedShards);
            this.RemovedShards = string.Join(";", removedShards);
            this.ShardLocator  = "";

            if (shardLocator != null)
            {
                var        closureEliminator            = new ClosureEliminator();
                Expression vertexedUserLambdaExpression = closureEliminator.Visit(shardLocator);
                this.ShardLocator = SerializationHelper.Serialize(vertexedUserLambdaExpression);
            }
        }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="instanceName"></param>
        /// <param name="vertexName"></param>
        /// <param name="vertexDefinition"></param>
        /// <param name="address"></param>
        /// <param name="port"></param>
        /// <param name="vertexCreateAction"></param>
        /// <param name="vertexParameter"></param>
        /// <param name="isActive"></param>
        public VertexTable(string instanceName, string vertexName, string vertexDefinition, string address, int port, Expression <Func <IShardedVertex> > vertexCreateAction, object vertexParameter, bool isActive)
        {
            this.PartitionKey = instanceName;
            this.RowKey       = vertexName;

            this.VertexDefinition   = vertexDefinition;
            this.Address            = address;
            this.Port               = port;
            this.VertexCreateAction = "";
            this.IsActive           = isActive;
            this.IsSharded          = true;

            if (vertexCreateAction != null)
            {
                var        closureEliminator            = new ClosureEliminator();
                Expression vertexedUserLambdaExpression = closureEliminator.Visit(
                    vertexCreateAction);

                this.VertexCreateAction = SerializationHelper.Serialize(vertexedUserLambdaExpression);
            }

            this.VertexParameter = SerializationHelper.SerializeObject(vertexParameter);
        }