Ejemplo n.º 1
0
        public async Task Initialize(long headLo, long headHi, long tailLo, long tailHi, SqlConnection conn)
        {
            if (linkState.Initialized)
            {
                return; //We ignore duplicate initialize messages.
            }

            LinkState initialized;

            using (var initTransaction = conn.BeginTransaction())
            {
                initialized = linkState.Initialize(
                    InboxTable.Left(sourceKey, destinationKey), headLo, headHi,
                    InboxTable.Right(sourceKey, destinationKey), tailLo, tailHi);

                await initialized.HeadSession.CreateConstraint(conn, initTransaction).ConfigureAwait(false);

                await initialized.TailSession.CreateConstraint(conn, initTransaction).ConfigureAwait(false);

                await linkStateTable.Update(sourceKey, initialized, conn, initTransaction).ConfigureAwait(false);

                initTransaction.Commit();
            }

            UpdateCachedLinkState(initialized);
        }
Ejemplo n.º 2
0
        public async Task Uninstall(string sourceKey, SqlConnection conn, SqlTransaction trans)
        {
            var linkStateTable = new LinkStateTable(destinationKey);
            await linkStateTable.Drop(conn, trans).ConfigureAwait(false);

            await new InboxTable(InboxTable.Left(sourceKey, destinationKey)).Drop(conn, trans).ConfigureAwait(false);
            await new InboxTable(InboxTable.Right(sourceKey, destinationKey)).Drop(conn, trans).ConfigureAwait(false);
        }