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

feat(core): add branch service #18379

Merged
merged 6 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

* [#18379](https://github.com/cosmos/cosmos-sdk/pull/18379) Add branch service.

## [v0.12.0](https://github.com/cosmos/cosmos-sdk/releases/tag/core%2Fv0.11.0)

:::note
Expand Down
19 changes: 19 additions & 0 deletions core/branch/branch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Package branch contains the core branch service interface.
package branch

import "context"

// Service is the branch service interface. It can be used to execute
// code paths in an isolated execution context that can be reverted.
testinginprod marked this conversation as resolved.
Show resolved Hide resolved
// A revert typically means a rollback on events and state changes.
type Service interface {
// Execute executes the given function in an isolated context. If the
// `f` function returns an error, the execution is considered failed,
// and every change made affecting the execution context 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
}
Loading