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); }
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); }