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(db): handle group locks #1880

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions services/manifest-repo-export-service/pkg/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ func getTransformer(ctx context.Context, eslEventType db.EventType) (repository.
case db.EvtCreateUndeployApplicationVersion:
//exhaustruct:ignore
return &repository.CreateUndeployApplicationVersion{}, nil
case db.EvtCreateEnvironmentGroupLock:
//exhaustruct:ignore
return &repository.EvtCreateEnvironmentGroupLock{}, nil
case db.EvtDeleteEnvironmentGroupLock:
//exhaustruct:ignore
return &repository.EvtDeleteEnvironmentGroupLock{}, nil
case db.EvtUndeployApplication:
//exhaustruct:ignore
return &repository.UndeployApplication{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1837,3 +1837,59 @@ func (u *UndeployApplication) Transform(
}
return fmt.Sprintf("application '%v' was deleted successfully", u.Application), nil
}

type EvtCreateEnvironmentGroupLock struct {
sven-urbanski-freiheit-com marked this conversation as resolved.
Show resolved Hide resolved
Authentication `json:"-"`
TransformerMetadata `json:"metadata"`
TransformerEslVersion db.TransformerID `json:"-"` // Tags the transformer with EventSourcingLight eslVersion
}

func (c *EvtCreateEnvironmentGroupLock) GetEslVersion() db.TransformerID {
return c.TransformerEslVersion
}

func (c *EvtCreateEnvironmentGroupLock) SetEslVersion(eslVersion db.TransformerID) {
c.TransformerEslVersion = eslVersion
}

func (c *EvtCreateEnvironmentGroupLock) GetDBEventType() db.EventType {
return db.EvtCreateUndeployApplicationVersion
sven-urbanski-freiheit-com marked this conversation as resolved.
Show resolved Hide resolved
}

func (c *EvtCreateEnvironmentGroupLock) Transform(
_ context.Context,
_ *State,
_ TransformerContext,
_ *sql.Tx,
) (string, error) {
// group locks are handled on the cd-service, and split into environment locks
return fmt.Sprintf("empty commit for group lock creation"), nil
}

type EvtDeleteEnvironmentGroupLock struct {
sven-urbanski-freiheit-com marked this conversation as resolved.
Show resolved Hide resolved
Authentication `json:"-"`
TransformerMetadata `json:"metadata"`
TransformerEslVersion db.TransformerID `json:"-"` // Tags the transformer with EventSourcingLight eslVersion
}

func (c *EvtDeleteEnvironmentGroupLock) GetEslVersion() db.TransformerID {
return c.TransformerEslVersion
}

func (c *EvtDeleteEnvironmentGroupLock) SetEslVersion(eslVersion db.TransformerID) {
c.TransformerEslVersion = eslVersion
}

func (c *EvtDeleteEnvironmentGroupLock) GetDBEventType() db.EventType {
return db.EvtCreateUndeployApplicationVersion
sven-urbanski-freiheit-com marked this conversation as resolved.
Show resolved Hide resolved
}

func (c *EvtDeleteEnvironmentGroupLock) Transform(
_ context.Context,
_ *State,
_ TransformerContext,
_ *sql.Tx,
) (string, error) {
// group locks are handled on the cd-service, and split into environment locks
return fmt.Sprintf("empty commit for group lock deletion"), nil
}
Loading