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

refactor: move dal errors into backend/dal #1902

Merged
merged 1 commit into from
Jun 28, 2024
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ buildengine/.gitignore
go.work*
junit*.xml
/readme-tests
**/_ftl
/docs/public
.ftl.lock
2 changes: 1 addition & 1 deletion backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ import (
"github.com/TBD54566975/ftl/backend/controller/scaling"
"github.com/TBD54566975/ftl/backend/controller/scaling/localscaling"
"github.com/TBD54566975/ftl/backend/controller/scheduledtask"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/console/pbconsoleconnect"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"
schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
"github.com/TBD54566975/ftl/backend/schema"
cf "github.com/TBD54566975/ftl/common/configuration"
"github.com/TBD54566975/ftl/db/dalerrs"
frontend "github.com/TBD54566975/ftl/frontend"
"github.com/TBD54566975/ftl/internal/cors"
ftlhttp "github.com/TBD54566975/ftl/internal/http"
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/async_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/alecthomas/types/either"

"github.com/TBD54566975/ftl/backend/controller/sql"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
)

type asyncOriginParseRoot struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"google.golang.org/protobuf/proto"

"github.com/TBD54566975/ftl/backend/controller/sql"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/maps"
"github.com/TBD54566975/ftl/internal/model"
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/dal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"golang.org/x/sync/errgroup"

"github.com/TBD54566975/ftl/backend/controller/sql/sqltest"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
"github.com/TBD54566975/ftl/internal/sha256"
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/jackc/pgx/v5"

"github.com/TBD54566975/ftl/backend/controller/sql"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/backend/controller/sql"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
)

// StartFSMTransition sends an event to an executing instance of an FSM.
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/alecthomas/types/either"

"github.com/TBD54566975/ftl/backend/controller/sql/sqltest"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/log"
)

Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/backend/controller/sql"
"github.com/TBD54566975/ftl/db/dalerrs"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/internal/log"
)

Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/backend/controller/sql"
"github.com/TBD54566975/ftl/backend/controller/sql/sqltest"
"github.com/TBD54566975/ftl/db/dalerrs"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/internal/log"
)

Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jpillora/backoff"

"github.com/TBD54566975/ftl/db/dalerrs"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"

"github.com/TBD54566975/ftl/backend/controller/sql"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
"github.com/TBD54566975/ftl/internal/slices"
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/ingress/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/dal"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"github.com/TBD54566975/ftl/backend/controller/dal"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/TBD54566975/ftl/internal/slices"
)

Expand Down
5 changes: 3 additions & 2 deletions backend/controller/leader/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import (
"sync"
"time"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/db/dalerrs"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/internal/log"
"github.com/alecthomas/types/optional"
)

// LeaderFactory is a function that is called whenever a new leader is acquired.
Expand Down
10 changes: 6 additions & 4 deletions db/dalerrs/dalerrs.go → backend/dal/errors.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Package dalerrs provides common error handling utilities for all domain-specific DALs,
// e.g. controller DAL and configuration DAL, which all connect to the same underlying DB
// and maintain the same interface guarantees
package dalerrs
// Package dal provides common types and functions for domain-specific DALs.
//
// In particular, common error types and error handling function for all
// domain-specific DALs, e.g. controller DAL and configuration DAL, which all
// connect to the same underlying DB and maintain the same interface guarantees
package dal

import (
stdsql "database/sql"
Expand Down
2 changes: 1 addition & 1 deletion common/configuration/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/alecthomas/types/optional"
"github.com/jackc/pgx/v5/pgxpool"

dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/common/configuration/sql"
"github.com/TBD54566975/ftl/db/dalerrs"
)

type DAL struct {
Expand Down
3 changes: 2 additions & 1 deletion common/configuration/db_config_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"net/url"

"github.com/TBD54566975/ftl/db/dalerrs"
"github.com/alecthomas/types/optional"

dalerrs "github.com/TBD54566975/ftl/backend/dal"
)

// DBConfigProvider is a configuration provider that stores configuration in its key.
Expand Down
Loading