Skip to content

Commit

Permalink
feat: add capability to create transaction at controller level
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Nov 22, 2024
1 parent 382c5e9 commit 7af5777
Show file tree
Hide file tree
Showing 20 changed files with 717 additions and 408 deletions.
1 change: 1 addition & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ generate:
RUN go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
COPY (+tidy/*) /src/
COPY --dir (+sources/src/*) /src/

WORKDIR /src
RUN go generate ./...
SAVE ARTIFACT internal AS LOCAL internal
Expand Down
43 changes: 43 additions & 0 deletions internal/api/common/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions internal/api/v1/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions internal/api/v2/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions internal/controller/ledger/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ledger

import (
"context"
"database/sql"
"github.com/formancehq/go-libs/v2/metadata"
"github.com/formancehq/ledger/internal/machine/vm"

Expand All @@ -13,6 +14,10 @@ import (
//go:generate mockgen -write_source_comment=false -write_package_comment=false -source controller.go -destination controller_generated_test.go -package ledger . Controller

type Controller interface {
BeginTX(ctx context.Context, options *sql.TxOptions) error
Commit(ctx context.Context) error
Rollback(ctx context.Context) error

// IsDatabaseUpToDate check if the ledger store is up to date, including the bucket and the ledger specifics
// It returns true if up to date
IsDatabaseUpToDate(ctx context.Context) (bool, error)
Expand Down
Loading

0 comments on commit 7af5777

Please sign in to comment.