public override async Task Process(Controller controller)
        {
            var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);
            var transaction      = await sessionContainer.Session.BeginTransactionAsync(TransactionConfig);

            TransactionId = controller.TransactionManagager.AddTransaction(transaction);
        }
        public override async Task Process()
        {
            IAsyncSession session = ((NewSession)ObjManager.GetObject(data.sessionId)).Session;

            Bookmarks = session.LastBookmark.Values;
            await Task.CompletedTask;
        }
예제 #3
0
        public override async Task Process(Controller controller)
        {
            Success = true;

            var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);
            await sessionContainer.Session.ReadTransactionAsync(async tx =>
            {
                TransactionId = controller.TransactionManagager.AddTransaction(new TransactionWrapper(tx, async cursor =>
                {
                    var result = ProtocolObjectFactory.CreateObject <TransactionResult>();
                    await result.PopulateRecords(cursor).ConfigureAwait(false);
                    return(result.uniqueId);
                }));

                sessionContainer.SessionTransactions.Add(TransactionId);

                await controller.SendResponse(new ProtocolResponse("RetryableTry", TransactionId).Encode()).ConfigureAwait(false);

                try
                {
                    //Start another message processing loop to handle the retry mechanism.
                    await controller.ProcessStreamObjects().ConfigureAwait(false);
                }
                catch
                {
                    Success = false;
                }

                controller.TransactionManagager.RemoveTransaction(TransactionId);
            }, TransactionConfig);
        }
		public override async Task Process(Controller controller)
		{
			var protocolDriver = (NewDriver)ObjManager.GetObject(data.driverId);
			var driver = (Neo4j.Driver.Internal.Driver)protocolDriver.Driver;
			RoutingTable = driver.GetRoutingTable(data.database);

			await Task.CompletedTask;
		}
예제 #5
0
        public override async Task Process()
        {
            IDriver driver = ((NewDriver)ObjManager.GetObject(data.driverId)).Driver;

            Session = driver.AsyncSession(SessionConfig);

            await Task.CompletedTask;
        }
예제 #6
0
        public override async Task Process(Controller controller)
        {
            //Client failed in some way.
            //Get the session
            var sessionContainer = ((NewSession)ObjManager.GetObject(data.sessionId));
            var tasks            = sessionContainer.SessionTransactions.Select(t => TransactionRollBackDelegate(t, controller));
            await Task.WhenAll(tasks);

            TriggerException();
        }
예제 #7
0
        public override async Task Process(Controller controller)
        {
            var sessionContainer = ((NewSession)ObjManager.GetObject(data.sessionId));

            sessionContainer.SetupRetryAbleState(NewSession.SessionState.RetryAbleNegative, data.errorId);

            TriggerEvent();

            await Task.CompletedTask;
        }
예제 #8
0
        public override async Task Process()
        {
            var           newSession = (NewSession)ObjManager.GetObject(data.sessionId);
            IResultCursor cursor     = await newSession.Session.RunAsync(data.cypher, ConvertParameters(data.parameters), TransactionConfig).ConfigureAwait(false);

            var result = (Result)ProtocolObjectFactory.CreateObject(Protocol.Types.Result);

            result.Results = cursor;

            ResultId = result.uniqueId;
        }
 public override async Task Process()
 {
     try
     {
         IDriver driver = ((NewDriver)ObjManager.GetObject(data.driverId)).Driver;
         await driver.CloseAsync();
     }
     catch (Exception ex)
     {
         throw new Exception($"Failed to Process NewDriver protocol object, failed with - {ex.Message}");
     }
 }
 public override async Task Process()
 {
     try
     {
         IAsyncSession session = ((NewSession)ObjManager.GetObject(data.sessionId)).Session;
         await session.CloseAsync();
     }
     catch (Exception ex)
     {
         throw new Exception($"Failed to Process NewDriver protocol object, failed with - {ex.Message}");
     }
 }
 public override async Task Process()
 {
     try
     {
         IDriver driver = ((NewDriver)ObjManager.GetObject(data.driverId)).Driver;
         Session = driver.AsyncSession();    //TODO: Use config builder to take into account bookmarks and accessmode.
         await AysncVoidReturn();
     }
     catch (Exception ex)
     {
         throw new Exception($"Failed to Process NewSession protocol object, failed with - {ex.Message}");
     }
 }
예제 #12
0
        public override async Task Process()
        {
            var sessionContainer = ((NewSession)ObjManager.GetObject(data.sessionId));

            sessionContainer.SetupRetryAbleState(NewSession.SessionState.RetryAblePositive);

            //Client succeded and wants to commit.
            //Notify any subscribers.

            TriggerEvent();

            await Task.CompletedTask;
        }
예제 #13
0
        public override async Task Process()
        {
            var results = ((Result)ObjManager.GetObject(data.resultId)).Results;

            if (await results.FetchAsync().ConfigureAwait(false))
            {
                Records = results.Current;
            }
            else
            {
                Records = null;
            }
        }
예제 #14
0
        public override async Task Process(Controller controller)
        {
            var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);
            var transaction      = await sessionContainer.Session.BeginTransactionAsync(TransactionConfig);

            TransactionId = controller.TransactionManager.AddTransaction(new TransactionWrapper(transaction, async cursor =>
            {
                var result          = ProtocolObjectFactory.CreateObject <Result>();
                result.ResultCursor = cursor;

                return(await Task.FromResult <string>(result.uniqueId));
            }));
        }
        private void TriggerException()
        {
            Exception ex = null;

            if (string.IsNullOrEmpty(data.errorId))
            {
                ex = new ClientException("Error from client in retryable tx");
            }
            else
            {
                ex = ((ProtocolException)ObjManager.GetObject(data.errorId)).ExceptionObj;
            }

            throw ex;
        }
        public override async Task Process()
        {
            try
            {
                var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);
                await sessionContainer.Session.ReadTransactionAsync(async t =>
                {
                    Transaction = t;
                    await AysncVoidReturn();
                });

                //TODO.... it looks like the go backend  processes further messages to handle a retryable state
                //then returns a RetryableDone in amoungst the other returns....talk to peter.
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed to Process TransactionRun protocol object, failed with - {ex.Message}");
            }
        }
        public override async Task Process()
        {
            try
            {
                var newSession = (NewSession)ObjManager.GetObject(data.sessionId);

                IResultCursor cursor = await newSession.Session.RunAsync(data.cypher, data.parameters).ConfigureAwait(false);

                var result = new Result()
                {
                    Results = cursor
                };
                ObjManager.AddProtocolObject(result);
                ResultId = result.uniqueId;
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed to Process SessionRun protocol object, failed with - {ex.Message}");
            }
        }
예제 #18
0
        public override async Task Process()
        {
            try
            {
                var results = ((Result)ObjManager.GetObject(data.resultId)).Results;

                if (await results.FetchAsync().ConfigureAwait(false))
                {
                    Records = results.Current;
                }
                else
                {
                    Records = null;
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed to Process NewDriver protocol object, failed with - {ex.Message}");
            }
        }
        public override async Task Process()
        {
            try
            {
                var transaction = ((SessionReadTransaction)ObjManager.GetObject(data.txId)).Transaction;

                IResultCursor cursor = await transaction.RunAsync(data.cypher, data.parameters);

                var result = new Result()
                {
                    Results = cursor
                };
                ObjManager.AddProtocolObject(result);
                ResultId = result.uniqueId;
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed to Process TransactionRun protocol object, failed with - {ex.Message}");
            }
        }
예제 #20
0
        public override async Task Process(Controller controller)
        {
            var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);

            await sessionContainer.Session.ReadTransactionAsync(async tx =>
            {
                sessionContainer.SetupRetryAbleState(NewSession.SessionState.RetryAbleNothing);

                TransactionId = controller.TransactionManager.AddTransaction(new TransactionWrapper(tx, async cursor =>
                {
                    var result = ProtocolObjectFactory.CreateObject <Result>();
                    await result.PopulateRecords(cursor).ConfigureAwait(false);
                    return(result.uniqueId);
                }));

                sessionContainer.SessionTransactions.Add(TransactionId);

                await controller.SendResponse(new ProtocolResponse("RetryableTry", TransactionId).Encode()).ConfigureAwait(false);

                Exception storedException = new TestKitClientException("Error from client");

                await controller.Process(false, e =>
                {
                    switch (sessionContainer.RetryState)
                    {
                    case NewSession.SessionState.RetryAbleNothing:
                        return(true);

                    case NewSession.SessionState.RetryAblePositive:
                        return(false);

                    case NewSession.SessionState.RetryAbleNegative:
                        throw e;

                    default:
                        return(true);
                    }
                });
            }, TransactionConfig);
        }
        public override async Task Process(Controller controller)
        {
            Success = true;

            var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);
            await sessionContainer.Session.WriteTransactionAsync(async tx =>
            {
                TransactionId = controller.TransactionManagager.AddTransaction(tx);
                await controller.SendResponse(new ProtocolResponse("RetryableTry", TransactionId).Encode()).ConfigureAwait(false);

                try
                {
                    //Start another message processing loop to handle the retry mechanism.
                    await controller.ProcessStreamObjects().ConfigureAwait(false);
                }
                catch
                {
                    Success = false;
                }

                controller.TransactionManagager.RemoveTransaction(TransactionId);
            });
        }
예제 #22
0
        public override string Respond()
        {
            var sessionContainer = (NewSession)ObjManager.GetObject(data.sessionId);

            if (sessionContainer.RetryState == NewSession.SessionState.RetryAbleNothing)
            {
                throw new ArgumentException("Should never hit this code with a RetryAbleNothing");
            }

            else if (sessionContainer.RetryState == NewSession.SessionState.RetryAbleNegative)
            {
                if (string.IsNullOrEmpty(sessionContainer.RetryableErrorId))
                {
                    return(ExceptionManager.GenerateExceptionResponse(new ClientException("Error from client in retryable tx")).Encode());
                }
                else
                {
                    var exception = ((ProtocolException)(ObjManager.GetObject(sessionContainer.RetryableErrorId))).ExceptionObj;
                    return(ExceptionManager.GenerateExceptionResponse(exception).Encode());
                }
            }

            return(new ProtocolResponse("RetryableDone", new { }).Encode());
        }
예제 #23
0
 public override string Respond()
 {
     return(((Result)ObjManager.GetObject(ResultId)).Respond());
 }
예제 #24
0
        public override async Task Process()
        {
            var driver = ((NewDriver)ObjManager.GetObject(data.driverId)).Driver;

            MutlitDBSupportAvailable = await driver.SupportsMultiDbAsync();
        }
 public override async Task Process()
 {
     IDriver driver = ((NewDriver)ObjManager.GetObject(data.driverId)).Driver;
     await driver.CloseAsync();
 }
예제 #26
0
 public override async Task Process()
 {
     Summary = await((Result)ObjManager.GetObject(data.resultId)).ConsumeResults().ConfigureAwait(false);
 }
예제 #27
0
        public override async Task Process()
        {
            var result = (Result)ObjManager.GetObject(data.resultId);

            Records = await result.GetNextRecord();
        }
 public override async Task Process()
 {
     IAsyncSession session = ((NewSession)ObjManager.GetObject(data.sessionId)).Session;
     await session.CloseAsync();
 }
예제 #29
0
 public override async Task Process()
 {
     IDriver driver = ((NewDriver)ObjManager.GetObject(data.driverId)).Driver;
     await driver.VerifyConnectivityAsync();
 }