Skip to content

Commit

Permalink
feat: ability to pause and resume relayer
Browse files Browse the repository at this point in the history
  • Loading branch information
debendraoli committed Aug 11, 2023
1 parent 5fdb1e8 commit eda4060
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ibc/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ type Relayer interface {
// StopRelayer stops a relayer that started work through StartRelayer.
StopRelayer(ctx context.Context, rep RelayerExecReporter) error

// PauseRelayer halts a relayer that started work through StartRelayer.
PauseRelayer(ctx context.Context) error

// ResumeRelayer resumes a relayer that was paused through PauseRelayer.
ResumeRelayer(ctx context.Context) error

// Flush flushes any outstanding packets and then returns.
Flush(ctx context.Context, rep RelayerExecReporter, pathName string, channelID string) error

Expand Down
17 changes: 16 additions & 1 deletion relayer/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
volumetypes "github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy"
"go.uber.org/zap"

"github.com/strangelove-ventures/interchaintest/v7/ibc"
"github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v7/testutil"
"go.uber.org/zap"
)

const (
Expand Down Expand Up @@ -445,6 +446,20 @@ func (r *DockerRelayer) StopRelayer(ctx context.Context, rep ibc.RelayerExecRepo
return nil
}

func (r *DockerRelayer) PauseRelayer(ctx context.Context) error {
if r.containerLifecycle == nil {
return nil
}
return r.client.ContainerPause(ctx, r.containerLifecycle.ContainerID())
}

func (r *DockerRelayer) ResumeRelayer(ctx context.Context) error {
if r.containerLifecycle == nil {
return nil
}
return r.client.ContainerUnpause(ctx, r.containerLifecycle.ContainerID())
}

func (r *DockerRelayer) containerImage() ibc.DockerImage {
if r.customImage != nil {
return *r.customImage
Expand Down

0 comments on commit eda4060

Please sign in to comment.