public void update()

in accord-core/src/main/java/accord/impl/progresslog/DefaultProgressLog.java [190:261]


    public void update(SafeCommandStore safeStore, TxnId txnId, Command before, Command after)
    {
        if (!txnId.isVisible())
            return;

        TxnState state = null;
        Route<?> beforeRoute = before.route();
        Route<?> afterRoute = after.route();
        if (beforeRoute == null && afterRoute != null)
        {
            RoutingKey homeKey = afterRoute.homeKey();
            Ranges coordinateRanges = safeStore.coordinateRanges(txnId);
            boolean isHome = coordinateRanges.contains(homeKey);
            state = get(txnId);
            if (isHome)
            {
                if (state == null)
                    state = insert(txnId);

                if (after.durability().isDurableOrInvalidated())
                {
                    state.setHomeDoneAndMaybeRemove(this);
                    state = maybeFetch(safeStore, txnId, after, state);
                }
                else
                {
                    state.set(safeStore, this, Undecided, Queued);
                }
            }
            else if (state != null)
            {
                // not home shard
                state.setHomeDone(this);
            }
        }
        else if (after.durability().isDurableOrInvalidated() && !before.durability().isDurableOrInvalidated())
        {
            state = get(txnId);
            if (state != null)
                state.setHomeDoneAndMaybeRemove(this);

            state = maybeFetch(safeStore, txnId, after, state);
        }

        SaveStatus beforeSaveStatus = before.saveStatus();
        SaveStatus afterSaveStatus = after.saveStatus();
        if (beforeSaveStatus == afterSaveStatus)
            return;

        if (state == null)
            state = get(txnId);

        if (state == null)
            return;

        state.waiting().record(this, afterSaveStatus);
        if (state.isHomeInitialised())
        {
            switch (afterSaveStatus)
            {
                case Stable:
                    state.home().atLeast(safeStore, this, Undecided, NoneExpected);
                    break;
                case ReadyToExecute:
                    state.home().atLeast(safeStore, this, AwaitReadyToExecute, Queued);
                    break;
                case PreApplied:
                    state.home().atLeast(safeStore, this, ReadyToExecute, Queued);
                    break;
            }
        }
    }