예제 #1
0
 internal AutoCSer.Net.TcpServer.AwaiterBox <ReturnParameter> QueryAsynchronousAwaiter(DataStructure.Abstract.Node node)
 {
     if (isMasterClient)
     {
         return(MasterClient.QueryAsynchronousAwaiter(new OperationParameter.QueryNode {
             Node = node
         }));
     }
     return(slaveClient.QueryAsynchronousAwaiter(new OperationParameter.QueryNode {
         Node = node
     }));
 }
예제 #2
0
        /// <summary>
        /// 异步查询数据
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        internal async Task <AutoCSer.Net.TcpServer.ReturnValue <ReturnParameter> > MasterQueryAsynchronousAwaiter(ShortPath.Parameter.Node node)
        {
            ShortPath.Node shortPath  = node.ShortPath;
            ReturnType     returnType = shortPath.Check(MasterClient);

            if (returnType == ReturnType.Success)
            {
                AutoCSer.Net.TcpServer.ReturnValue <ReturnParameter> value = await MasterClient.QueryAsynchronousAwaiter(new OperationParameter.ShortPathQueryNode {
                    Node = node
                });

                if (value.Type == Net.TcpServer.ReturnType.Success && shortPath.ReCreate(MasterClient, ref value.Value.Parameter.ReturnType))
                {
                    return(await MasterClient.QueryAsynchronousAwaiter(new OperationParameter.ShortPathQueryNode {
                        Node = node
                    }));
                }
                return(value);
            }
            return(new ReturnParameter(returnType));
        }
예제 #3
0
        /// <summary>
        /// 删除数据结构信息
        /// </summary>
        /// <param name="cacheName">缓存名称标识</param>
        /// <returns></returns>
        public async Task <ReturnValue <bool> > RemoveDataStructureTask(string cacheName)
        {
            if (string.IsNullOrEmpty(cacheName))
            {
                return new ReturnValue <bool> {
                           Type = ReturnType.NullArgument
                }
            }
            ;
            IndexIdentity identity = default(IndexIdentity);

            identity.Set(await MasterClient.RemoveAwaiter(new OperationParameter.RemoveDataStructure {
                CacheName = cacheName
            }));
            if (identity.ReturnType == ReturnType.Success)
            {
                removeDataStructure(cacheName, ref identity);
            }
            return(new ReturnValue <bool> {
                TcpReturnType = identity.TcpReturnType, Type = identity.ReturnType, Value = identity.ReturnType == ReturnType.Success
            });
        }
예제 #4
0
 public AutoCSer.Net.TcpServer.Awaiter WriteFileAwaiter()
 {
     return(MasterClient.WriteFileAwaiter());
 }
예제 #5
0
 internal AutoCSer.Net.TcpServer.AwaiterBox <ReturnParameter> OperationAsynchronousAwaiter(DataStructure.Abstract.Node node)
 {
     return(MasterClient.OperationAsynchronousAwaiter(new OperationParameter.OperationNode {
         Node = node
     }));
 }