Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring. Split interface/implementation for Shard/Workflow Context #7443

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ychebotarev
Copy link
Contributor

@ychebotarev ychebotarev commented Mar 7, 2025

What changed?

Main changes:

  • move shard.Context to interfaces (and rename it to ShardContest).
  • move workflow.Context to interfaces (and rename it to WorkflowContext).
  • Many small improvements, fixing linter, etc.
    This effectively splits interface/implementation for both of those contexts.
    Also again remove LOTS of dependencies. More to come.

Why?

Previous PR

Part of bigger refactoring efforts.
Goal is to reduce code entanglement, by separating interfaces and implementation, for some major components.
Currently, in lots of cases, interface and implementation are in a single file. This bloats the dependency graph, and introduce bad practices when dealing with "module cyclic dependency" error.

Nearest goal will be to split/move the following interfaces:

  • Engine - done
  • MutalbleState - done
  • Shard Context - done
  • Workflow Context

Once moving interfaces is complete:

add "GetOrCreateContext" to shard context. It will receive cache as a parameter
change s.workflowCache.GetOrCreateWorkflowExecution(s.hardContext, ...) to s.hardContext.GetOrCreateContext(...)
add "cache" to shard context ->IMPLEMENTATION<- (this is important - there is (I hope) no need to actually expose workflow cache from shard context)
remove cache as a parameter from GetOrCreateContext
remove workflwCacha wcache from all those structures/calles/etc, where it is "bundled" with

This will open the way to other improvements - introducing ServiceLocator and easier tests/code structure.

How did you test it?

Existing tests.

Potential risks

Can require changes in saas-temporal and CDS.

Is hotfix candidate?

No

@ychebotarev ychebotarev requested a review from a team as a code owner March 7, 2025 20:26
@ychebotarev ychebotarev changed the title Refactoring. Split interface/implementation for Shard Context Refactoring. Split interface/implementation for Shard/Workflow Context Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants