mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
122 lines
4.1 KiB
Go
122 lines
4.1 KiB
Go
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination workflow_context_mock.go
|
|
|
|
package interfaces
|
|
|
|
import (
|
|
"context"
|
|
|
|
persistencespb "go.temporal.io/server/api/persistence/v1"
|
|
"go.temporal.io/server/common/definition"
|
|
"go.temporal.io/server/common/locks"
|
|
"go.temporal.io/server/common/persistence"
|
|
"go.temporal.io/server/service/history/workflow/update"
|
|
)
|
|
|
|
type (
|
|
// ReleaseWorkflowContextFunc must be called to release the workflow context.
|
|
// Make sure not to access the mutable state or workflow context after releasing back to the cache.
|
|
// If there is any error when using the mutable state (e.g. mutable state is mutated and dirty), call release with
|
|
// the error so the in-memory copy will be thrown away.
|
|
ReleaseWorkflowContextFunc func(err error)
|
|
|
|
WorkflowContext interface {
|
|
GetWorkflowKey() definition.WorkflowKey
|
|
|
|
LoadMutableState(ctx context.Context, shardContext ShardContext) (MutableState, error)
|
|
LoadExecutionStats(ctx context.Context, shardContext ShardContext) (*persistencespb.ExecutionStats, error)
|
|
Clear()
|
|
|
|
Lock(ctx context.Context, lockPriority locks.Priority) error
|
|
Unlock()
|
|
|
|
IsDirty() bool
|
|
|
|
RefreshTasks(ctx context.Context, shardContext ShardContext) error
|
|
|
|
ReapplyEvents(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
eventBatches []*persistence.WorkflowEvents,
|
|
) error
|
|
|
|
PersistWorkflowEvents(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
workflowEventsSlice ...*persistence.WorkflowEvents,
|
|
) (int64, error)
|
|
|
|
CreateWorkflowExecution(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
createMode persistence.CreateWorkflowMode,
|
|
prevRunID string,
|
|
prevLastWriteVersion int64,
|
|
newMutableState MutableState,
|
|
newWorkflow *persistence.WorkflowSnapshot,
|
|
newWorkflowEvents []*persistence.WorkflowEvents,
|
|
) error
|
|
ConflictResolveWorkflowExecution(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
conflictResolveMode persistence.ConflictResolveWorkflowMode,
|
|
resetMutableState MutableState,
|
|
newContext WorkflowContext,
|
|
newMutableState MutableState,
|
|
currentContext WorkflowContext,
|
|
currentMutableState MutableState,
|
|
resetWorkflowTransactionPolicy TransactionPolicy,
|
|
newWorkflowTransactionPolicy *TransactionPolicy,
|
|
currentTransactionPolicy *TransactionPolicy,
|
|
) error
|
|
UpdateWorkflowExecutionAsActive(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
) error
|
|
UpdateWorkflowExecutionWithNewAsActive(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
newContext WorkflowContext,
|
|
newMutableState MutableState,
|
|
) error
|
|
UpdateWorkflowExecutionAsPassive(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
) error
|
|
UpdateWorkflowExecutionWithNewAsPassive(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
newContext WorkflowContext,
|
|
newMutableState MutableState,
|
|
) error
|
|
UpdateWorkflowExecutionWithNew(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
updateMode persistence.UpdateWorkflowMode,
|
|
newContext WorkflowContext,
|
|
newMutableState MutableState,
|
|
updateWorkflowTransactionPolicy TransactionPolicy,
|
|
newWorkflowTransactionPolicy *TransactionPolicy,
|
|
) error
|
|
// SetWorkflowExecution is an alias to SubmitClosedWorkflowSnapshot with TransactionPolicyPassive.
|
|
SetWorkflowExecution(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
) error
|
|
// SubmitClosedWorkflowSnapshot closes the current mutable state transaction with the given
|
|
// transactionPolicy and updates the workflow execution record in the DB. Does not check the "current"
|
|
// run status for the execution.
|
|
// Closes the transaction as snapshot, which errors out if there are any buffered events that need
|
|
// flushing and generally does not expect new history events to be generated (expected for closed
|
|
// workflows).
|
|
// NOTE: in the future, we'd like to have the ability to close the transaction as mutation to avoid the
|
|
// overhead of overwriting the entire DB record.
|
|
SubmitClosedWorkflowSnapshot(
|
|
ctx context.Context,
|
|
shardContext ShardContext,
|
|
transactionPolicy TransactionPolicy,
|
|
) error
|
|
// TODO (alex-update): move this from workflow context.
|
|
UpdateRegistry(ctx context.Context) update.Registry
|
|
}
|
|
)
|