executeTransactionPlan runs the selected internal execution mode and fails open from queued batching back to the single-transaction path when batching does not handle the work.
(ctx context.Context, plan transactionExecutionPlan)
| 672 | // executeTransactionPlan runs the selected internal execution mode and fails open from queued |
| 673 | // batching back to the single-transaction path when batching does not handle the work. |
| 674 | func (l *LedgerForge) executeTransactionPlan(ctx context.Context, plan transactionExecutionPlan) (transactionExecutionResult, error) { |
| 675 | switch plan.mode { |
| 676 | case transactionExecutionModeQueuedBatch: |
| 677 | handled, err := l.TryRecordQueuedTransactionBatch(ctx, plan.transaction) |
| 678 | if err != nil { |
| 679 | logrus.WithError(err).Warnf("coalesced processing attempt failed for transaction %s", plan.transaction.TransactionID) |
| 680 | } |
| 681 | if handled { |
| 682 | return transactionExecutionResult{ |
| 683 | mode: transactionExecutionModeQueuedBatch, |
| 684 | transaction: plan.transaction, |
| 685 | }, nil |
| 686 | } |
| 687 | return l.executeTransactionPlan(ctx, l.planTransactionExecution(plan.transaction, false, false)) |
| 688 | case transactionExecutionModeHotQueuedBatch: |
| 689 | handled, err := l.TryRecordQueuedTransactionBatchForHotLane(ctx, plan.transaction) |
| 690 | if err != nil { |
| 691 | logrus.WithError(err).Warnf("coalesced hot-lane processing attempt failed for transaction %s", plan.transaction.TransactionID) |
| 692 | } |
| 693 | if handled { |
| 694 | return transactionExecutionResult{ |
| 695 | mode: transactionExecutionModeHotQueuedBatch, |
| 696 | transaction: plan.transaction, |
| 697 | }, nil |
| 698 | } |
| 699 | return l.executeTransactionPlan(ctx, l.planTransactionExecution(plan.transaction, false, false)) |
| 700 | case transactionExecutionModeSingle: |
| 701 | transaction, err := l.recordTransactionSingle(ctx, plan.transaction) |
| 702 | if err != nil { |
| 703 | return transactionExecutionResult{}, err |
| 704 | } |
| 705 | return transactionExecutionResult{ |
| 706 | mode: transactionExecutionModeSingle, |
| 707 | transaction: transaction, |
| 708 | }, nil |
| 709 | default: |
| 710 | transaction, err := l.recordTransactionSingle(ctx, plan.transaction) |
| 711 | if err != nil { |
| 712 | return transactionExecutionResult{}, err |
| 713 | } |
| 714 | return transactionExecutionResult{ |
| 715 | mode: transactionExecutionModeSingle, |
| 716 | transaction: transaction, |
| 717 | }, nil |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | // processQueuedTransaction routes queued work through the shared executor so the planner can |
| 722 | // choose between normal queued batching, hot-lane batching, and single-transaction fallback. |
no test coverage detected