예제 #1
0
 public IEnumerator <ITask> GetByKeyHandler(GetByKey get)
 {
     try
     {
         GetElementResponseType response = new GetElementResponseType()
         {
             Value     = _state.Get(get.Body.Key),
             Timestamp = _state.Timestamp
         };
         GetCallback(new GetElementRequestInfo()
         {
             RequestType = RequestType.ByKey,
             Index       = _state.indexCache[get.Body.Key],
             Key         = get.Body.Key
         });
         get.ResponsePort.Post(response);
     }
     catch (Exception e)
     {
         get.ResponsePort.Post(RSUtils.FaultOfException(e));
     }
     yield break;
 }
예제 #2
0
 public IEnumerator <ITask> GetByIndexHandler(GetByIndex get)
 {
     try
     {
         GetElementResponseType response = new GetElementResponseType()
         {
             Value     = _state.Get(get.Body.Index),
             Timestamp = _state.Timestamp
         };
         GetCallback(new GetElementRequestInfo()
         {
             RequestType = RequestType.ByIndex,
             Index       = get.Body.Index,
             Key         = ((_state.Keys.Count >= (get.Body.Index + 1)) ? _state.Keys[get.Body.Index] : "")
         });
         get.ResponsePort.Post(response);
     }
     catch (Exception e)
     {
         get.ResponsePort.Post(RSUtils.FaultOfException(e));
     }
     yield break;
 }