-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown unknown
committed
Nov 6, 2023
1 parent
fb9dadc
commit db8b7be
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Package branch contains the core branch service interface and implementation. | ||
package branch | ||
|
||
import "context" | ||
|
||
// Service is the branch service interface. | ||
type Service interface { | ||
// Execute executes the given function in an isolated context. | ||
// If the function returns an error, the execution is considered failed, | ||
// and every ste change made during the execution is rolled back. | ||
// If the function returns nil, the execution is considered successful, and | ||
// committed. | ||
// The context.Context passed to the `f` function is a child of the context | ||
// passed to the Execute function, and is what should be used with other | ||
// core services in order to ensure the execution remains isolated. | ||
Execute(ctx context.Context, f func(ctx context.Context) error) error | ||
} |