Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: reorg enterprise code (#16496)

Danny Xu9d36453ec318
diff --git a/backend/api/auth/auth.go b/backend/api/auth/auth.go
index 0c228fe1ec..a8f6c569c6 100644
--- a/backend/api/auth/auth.go
+++ b/backend/api/auth/auth.go
@@ -25,7 +25,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
@@ -56,7 +56,7 @@ const (
type APIAuthInterceptor struct {
store *store.Store
secret string
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
stateCfg *state.State
profile *config.Profile
}
@@ -65,7 +65,7 @@ type APIAuthInterceptor struct {
func New(
store *store.Store,
secret string,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
stateCfg *state.State,
profile *config.Profile,
) *APIAuthInterceptor {
diff --git a/backend/api/directory-sync/directory_sync.go b/backend/api/directory-sync/directory_sync.go
index 9afe55d2d5..a8b8c0a1ca 100644
--- a/backend/api/directory-sync/directory_sync.go
+++ b/backend/api/directory-sync/directory_sync.go
@@ -2,21 +2,21 @@ package directorysync
import (
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
)
// Service is the API endpoint for handling SCIM requests.
type Service struct {
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
iamManager *iam.Manager
}
// NewService creates a SCIM service.
func NewService(
store *store.Store,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
iamManager *iam.Manager,
) *Service {
return &Service{
diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.go
index 92d01a9010..d085e0d7d8 100644
--- a/backend/api/v1/actuator_service.go
+++ b/backend/api/v1/actuator_service.go
@@ -17,7 +17,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/config"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/resources/postgres"
"github.com/bytebase/bytebase/backend/runner/schemasync"
"github.com/bytebase/bytebase/backend/store"
@@ -30,7 +30,7 @@ type ActuatorService struct {
v1pb.UnimplementedActuatorServiceServer
store *store.Store
profile *config.Profile
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
schemaSyncer *schemasync.Syncer
}
@@ -39,7 +39,7 @@ func NewActuatorService(
store *store.Store,
profile *config.Profile,
schemaSyncer *schemasync.Syncer,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
) *ActuatorService {
return &ActuatorService{
store: store,
diff --git a/backend/api/v1/audit_log_service.go b/backend/api/v1/audit_log_service.go
index 2bacadd7a9..9a7bc083a0 100644
--- a/backend/api/v1/audit_log_service.go
+++ b/backend/api/v1/audit_log_service.go
@@ -17,7 +17,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -27,10 +27,10 @@ type AuditLogService struct {
v1pb.UnimplementedAuditLogServiceServer
store *store.Store
iamManager *iam.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
-func NewAuditLogService(store *store.Store, iamManager *iam.Manager, licenseService enterprise.LicenseService) *AuditLogService {
+func NewAuditLogService(store *store.Store, iamManager *iam.Manager, licenseService *enterprise.LicenseService) *AuditLogService {
return &AuditLogService{
store: store,
iamManager: iamManager,
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index e65ab0ffd5..51581a17c6 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -23,7 +23,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
metricapi "github.com/bytebase/bytebase/backend/metric"
"github.com/bytebase/bytebase/backend/plugin/idp/ldap"
"github.com/bytebase/bytebase/backend/plugin/idp/oauth2"
@@ -44,7 +44,7 @@ type AuthService struct {
v1pb.UnimplementedAuthServiceServer
store *store.Store
secret string
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
metricReporter *metricreport.Reporter
profile *config.Profile
stateCfg *state.State
@@ -52,7 +52,7 @@ type AuthService struct {
}
// NewAuthService creates a new AuthService.
-func NewAuthService(store *store.Store, secret string, licenseService enterprise.LicenseService, metricReporter *metricreport.Reporter, profile *config.Profile, stateCfg *state.State, iamManager *iam.Manager) *AuthService {
+func NewAuthService(store *store.Store, secret string, licenseService *enterprise.LicenseService, metricReporter *metricreport.Reporter, profile *config.Profile, stateCfg *state.State, iamManager *iam.Manager) *AuthService {
return &AuthService{
store: store,
secret: secret,
diff --git a/backend/api/v1/database_catalog_service.go b/backend/api/v1/database_catalog_service.go
index 8b66852a93..11cca10472 100644
--- a/backend/api/v1/database_catalog_service.go
+++ b/backend/api/v1/database_catalog_service.go
@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc/status"
"github.com/bytebase/bytebase/backend/common"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -18,11 +18,11 @@ import (
type DatabaseCatalogService struct {
v1pb.UnimplementedDatabaseCatalogServiceServer
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewDatabaseCatalogService creates a new DatabaseCatalogService.
-func NewDatabaseCatalogService(store *store.Store, licenseService enterprise.LicenseService) *DatabaseCatalogService {
+func NewDatabaseCatalogService(store *store.Store, licenseService *enterprise.LicenseService) *DatabaseCatalogService {
return &DatabaseCatalogService{
store: store,
licenseService: licenseService,
diff --git a/backend/api/v1/database_group_service.go b/backend/api/v1/database_group_service.go
index fce3dbb9a1..725962fbd1 100644
--- a/backend/api/v1/database_group_service.go
+++ b/backend/api/v1/database_group_service.go
@@ -11,7 +11,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/utils"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -23,11 +23,11 @@ type DatabaseGroupService struct {
store *store.Store
profile *config.Profile
iamManager *iam.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewDatabaseGroupService creates a new ChangelistService.
-func NewDatabaseGroupService(store *store.Store, profile *config.Profile, iamManager *iam.Manager, licenseService enterprise.LicenseService) *DatabaseGroupService {
+func NewDatabaseGroupService(store *store.Store, profile *config.Profile, iamManager *iam.Manager, licenseService *enterprise.LicenseService) *DatabaseGroupService {
return &DatabaseGroupService{
store: store,
profile: profile,
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index 26f4d6b1a7..24973e1878 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -22,7 +22,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
parserbase "github.com/bytebase/bytebase/backend/plugin/parser/base"
"github.com/bytebase/bytebase/backend/plugin/parser/sql/transform"
"github.com/bytebase/bytebase/backend/plugin/schema"
@@ -37,13 +37,13 @@ type DatabaseService struct {
v1pb.UnimplementedDatabaseServiceServer
store *store.Store
schemaSyncer *schemasync.Syncer
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
profile *config.Profile
iamManager *iam.Manager
}
// NewDatabaseService creates a new DatabaseService.
-func NewDatabaseService(store *store.Store, schemaSyncer *schemasync.Syncer, licenseService enterprise.LicenseService, profile *config.Profile, iamManager *iam.Manager) *DatabaseService {
+func NewDatabaseService(store *store.Store, schemaSyncer *schemasync.Syncer, licenseService *enterprise.LicenseService, profile *config.Profile, iamManager *iam.Manager) *DatabaseService {
return &DatabaseService{
store: store,
schemaSyncer: schemaSyncer,
diff --git a/backend/api/v1/group_service.go b/backend/api/v1/group_service.go
index 6059122e0e..2a82f0a618 100644
--- a/backend/api/v1/group_service.go
+++ b/backend/api/v1/group_service.go
@@ -9,7 +9,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -20,11 +20,11 @@ type GroupService struct {
v1pb.UnimplementedGroupServiceServer
store *store.Store
iamManager *iam.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewGroupService creates a new GroupService.
-func NewGroupService(store *store.Store, iamManager *iam.Manager, licenseService enterprise.LicenseService) *GroupService {
+func NewGroupService(store *store.Store, iamManager *iam.Manager, licenseService *enterprise.LicenseService) *GroupService {
return &GroupService{
store: store,
iamManager: iamManager,
diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.go
index 56d52f1ba7..8356c73ec4 100644
--- a/backend/api/v1/idp_service.go
+++ b/backend/api/v1/idp_service.go
@@ -13,7 +13,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/idp/ldap"
"github.com/bytebase/bytebase/backend/plugin/idp/oauth2"
"github.com/bytebase/bytebase/backend/plugin/idp/oidc"
@@ -26,11 +26,11 @@ import (
type IdentityProviderService struct {
v1pb.UnimplementedIdentityProviderServiceServer
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewIdentityProviderService creates a new IdentityProviderService.
-func NewIdentityProviderService(store *store.Store, licenseService enterprise.LicenseService) *IdentityProviderService {
+func NewIdentityProviderService(store *store.Store, licenseService *enterprise.LicenseService) *IdentityProviderService {
return &IdentityProviderService{
store: store,
licenseService: licenseService,
diff --git a/backend/api/v1/instance_service.go b/backend/api/v1/instance_service.go
index 6d917ceee0..0129ce10d6 100644
--- a/backend/api/v1/instance_service.go
+++ b/backend/api/v1/instance_service.go
@@ -22,7 +22,7 @@ import (
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/secret"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
metricapi "github.com/bytebase/bytebase/backend/metric"
"github.com/bytebase/bytebase/backend/plugin/db"
"github.com/bytebase/bytebase/backend/plugin/metric"
@@ -37,7 +37,7 @@ import (
type InstanceService struct {
v1pb.UnimplementedInstanceServiceServer
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
metricReporter *metricreport.Reporter
stateCfg *state.State
dbFactory *dbfactory.DBFactory
@@ -46,7 +46,7 @@ type InstanceService struct {
}
// NewInstanceService creates a new InstanceService.
-func NewInstanceService(store *store.Store, licenseService enterprise.LicenseService, metricReporter *metricreport.Reporter, stateCfg *state.State, dbFactory *dbfactory.DBFactory, schemaSyncer *schemasync.Syncer, iamManager *iam.Manager) *InstanceService {
+func NewInstanceService(store *store.Store, licenseService *enterprise.LicenseService, metricReporter *metricreport.Reporter, stateCfg *state.State, dbFactory *dbfactory.DBFactory, schemaSyncer *schemasync.Syncer, iamManager *iam.Manager) *InstanceService {
return &InstanceService{
store: store,
licenseService: licenseService,
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index 0ac9e97d38..6d772bb368 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -20,7 +20,7 @@ import (
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/component/webhook"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
metricapi "github.com/bytebase/bytebase/backend/metric"
"github.com/bytebase/bytebase/backend/plugin/metric"
"github.com/bytebase/bytebase/backend/runner/metricreport"
@@ -36,7 +36,7 @@ type IssueService struct {
store *store.Store
webhookManager *webhook.Manager
stateCfg *state.State
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
profile *config.Profile
iamManager *iam.Manager
metricReporter *metricreport.Reporter
@@ -47,7 +47,7 @@ func NewIssueService(
store *store.Store,
webhookManager *webhook.Manager,
stateCfg *state.State,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
profile *config.Profile,
iamManager *iam.Manager,
metricReporter *metricreport.Reporter,
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.go
index 60023b5e05..c5cc770513 100644
--- a/backend/api/v1/org_policy_service.go
+++ b/backend/api/v1/org_policy_service.go
@@ -13,7 +13,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
"github.com/bytebase/bytebase/backend/common"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -39,11 +39,11 @@ var (
type OrgPolicyService struct {
v1pb.UnimplementedOrgPolicyServiceServer
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewOrgPolicyService creates a new OrgPolicyService.
-func NewOrgPolicyService(store *store.Store, licenseService enterprise.LicenseService) *OrgPolicyService {
+func NewOrgPolicyService(store *store.Store, licenseService *enterprise.LicenseService) *OrgPolicyService {
return &OrgPolicyService{
store: store,
licenseService: licenseService,
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.go
index 78fcd64086..e184060ccd 100644
--- a/backend/api/v1/plan_service.go
+++ b/backend/api/v1/plan_service.go
@@ -24,7 +24,7 @@ import (
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/sheet"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/utils"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
@@ -36,7 +36,7 @@ type PlanService struct {
v1pb.UnimplementedPlanServiceServer
store *store.Store
sheetManager *sheet.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
dbFactory *dbfactory.DBFactory
stateCfg *state.State
profile *config.Profile
@@ -44,7 +44,7 @@ type PlanService struct {
}
// NewPlanService returns a plan service instance.
-func NewPlanService(store *store.Store, sheetManager *sheet.Manager, licenseService enterprise.LicenseService, dbFactory *dbfactory.DBFactory, stateCfg *state.State, profile *config.Profile, iamManager *iam.Manager) *PlanService {
+func NewPlanService(store *store.Store, sheetManager *sheet.Manager, licenseService *enterprise.LicenseService, dbFactory *dbfactory.DBFactory, stateCfg *state.State, profile *config.Profile, iamManager *iam.Manager) *PlanService {
return &PlanService{
store: store,
sheetManager: sheetManager,
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index 84d0649bbe..a860ffa9ac 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -26,7 +26,7 @@ import (
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
webhookplugin "github.com/bytebase/bytebase/backend/plugin/webhook"
"github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/utils"
@@ -40,7 +40,7 @@ type ProjectService struct {
store *store.Store
profile *config.Profile
iamManager *iam.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewProjectService creates a new ProjectService.
@@ -48,7 +48,7 @@ func NewProjectService(
store *store.Store,
profile *config.Profile,
iamManager *iam.Manager,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
) *ProjectService {
return &ProjectService{
store: store,
diff --git a/backend/api/v1/review_config_service.go b/backend/api/v1/review_config_service.go
index 0373a71e9a..ee4f686d60 100644
--- a/backend/api/v1/review_config_service.go
+++ b/backend/api/v1/review_config_service.go
@@ -10,7 +10,7 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/common"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
@@ -21,11 +21,11 @@ import (
type ReviewConfigService struct {
v1pb.UnimplementedReviewConfigServiceServer
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewReviewConfigService creates a new ReviewConfigService.
-func NewReviewConfigService(store *store.Store, licenseService enterprise.LicenseService) *ReviewConfigService {
+func NewReviewConfigService(store *store.Store, licenseService *enterprise.LicenseService) *ReviewConfigService {
return &ReviewConfigService{
store: store,
licenseService: licenseService,
diff --git a/backend/api/v1/risk_service.go b/backend/api/v1/risk_service.go
index 6d3c9b1077..6345e110c1 100644
--- a/backend/api/v1/risk_service.go
+++ b/backend/api/v1/risk_service.go
@@ -9,7 +9,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
"github.com/bytebase/bytebase/backend/common"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
@@ -18,11 +18,11 @@ import (
type RiskService struct {
v1pb.UnimplementedRiskServiceServer
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewRiskService creates a new RiskService.
-func NewRiskService(store *store.Store, licenseService enterprise.LicenseService) *RiskService {
+func NewRiskService(store *store.Store, licenseService *enterprise.LicenseService) *RiskService {
return &RiskService{
store: store,
licenseService: licenseService,
diff --git a/backend/api/v1/role_service.go b/backend/api/v1/role_service.go
index 9f629ae602..9fbd4049ef 100644
--- a/backend/api/v1/role_service.go
+++ b/backend/api/v1/role_service.go
@@ -11,7 +11,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -22,11 +22,11 @@ type RoleService struct {
v1pb.UnimplementedRoleServiceServer
store *store.Store
iamManager *iam.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewRoleService returns a new instance of the role service.
-func NewRoleService(store *store.Store, iamManager *iam.Manager, licenseService enterprise.LicenseService) *RoleService {
+func NewRoleService(store *store.Store, iamManager *iam.Manager, licenseService *enterprise.LicenseService) *RoleService {
return &RoleService{
store: store,
iamManager: iamManager,
diff --git a/backend/api/v1/rollout_service.go b/backend/api/v1/rollout_service.go
index ce342b685c..db474ce2e0 100644
--- a/backend/api/v1/rollout_service.go
+++ b/backend/api/v1/rollout_service.go
@@ -22,7 +22,7 @@ import (
"github.com/bytebase/bytebase/backend/component/sheet"
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/component/webhook"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/db"
parserbase "github.com/bytebase/bytebase/backend/plugin/parser/base"
"github.com/bytebase/bytebase/backend/store"
@@ -36,7 +36,7 @@ type RolloutService struct {
v1pb.UnimplementedRolloutServiceServer
store *store.Store
sheetManager *sheet.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
dbFactory *dbfactory.DBFactory
stateCfg *state.State
webhookManager *webhook.Manager
@@ -45,7 +45,7 @@ type RolloutService struct {
}
// NewRolloutService returns a rollout service instance.
-func NewRolloutService(store *store.Store, sheetManager *sheet.Manager, licenseService enterprise.LicenseService, dbFactory *dbfactory.DBFactory, stateCfg *state.State, webhookManager *webhook.Manager, profile *config.Profile, iamManager *iam.Manager) *RolloutService {
+func NewRolloutService(store *store.Store, sheetManager *sheet.Manager, licenseService *enterprise.LicenseService, dbFactory *dbfactory.DBFactory, stateCfg *state.State, webhookManager *webhook.Manager, profile *config.Profile, iamManager *iam.Manager) *RolloutService {
return &RolloutService{
store: store,
sheetManager: sheetManager,
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 490540f855..c3427da481 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -23,7 +23,7 @@ import (
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/mail"
"github.com/bytebase/bytebase/backend/plugin/schema"
"github.com/bytebase/bytebase/backend/plugin/webhook/dingtalk"
@@ -41,7 +41,7 @@ type SettingService struct {
v1pb.UnimplementedSettingServiceServer
store *store.Store
profile *config.Profile
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
stateCfg *state.State
}
@@ -49,7 +49,7 @@ type SettingService struct {
func NewSettingService(
store *store.Store,
profile *config.Profile,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
stateCfg *state.State,
) *SettingService {
return &SettingService{
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.go
index 40b21b6750..5039aa5556 100644
--- a/backend/api/v1/sheet_service.go
+++ b/backend/api/v1/sheet_service.go
@@ -12,7 +12,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/sheet"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -23,13 +23,13 @@ type SheetService struct {
v1pb.UnimplementedSheetServiceServer
store *store.Store
sheetManager *sheet.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
iamManager *iam.Manager
profile *config.Profile
}
// NewSheetService creates a new SheetService.
-func NewSheetService(store *store.Store, sheetManager *sheet.Manager, licenseService enterprise.LicenseService, iamManager *iam.Manager, profile *config.Profile) *SheetService {
+func NewSheetService(store *store.Store, sheetManager *sheet.Manager, licenseService *enterprise.LicenseService, iamManager *iam.Manager, profile *config.Profile) *SheetService {
return &SheetService{
store: store,
sheetManager: sheetManager,
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index f4fe748ccf..06557d009f 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -31,7 +31,7 @@ import (
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/masker"
"github.com/bytebase/bytebase/backend/component/sheet"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
"github.com/bytebase/bytebase/backend/plugin/db"
@@ -55,7 +55,7 @@ type SQLService struct {
sheetManager *sheet.Manager
schemaSyncer *schemasync.Syncer
dbFactory *dbfactory.DBFactory
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
profile *config.Profile
iamManager *iam.Manager
}
@@ -66,7 +66,7 @@ func NewSQLService(
sheetManager *sheet.Manager,
schemaSyncer *schemasync.Syncer,
dbFactory *dbfactory.DBFactory,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
profile *config.Profile,
iamManager *iam.Manager,
) *SQLService {
@@ -402,7 +402,7 @@ func queryRetry(
conn *sql.Conn,
statement string,
queryContext db.QueryContext,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
optionalAccessCheck accessCheckFunc,
schemaSyncer *schemasync.Syncer,
action storepb.MaskingExceptionPolicy_MaskingException_Action,
@@ -662,7 +662,7 @@ func getSensitivePredicateColumnErrorMessages(sensitiveColumns []parserbase.Colu
return buf.String()
}
-func executeWithTimeout(ctx context.Context, stores *store.Store, licenseService enterprise.LicenseService, driver db.Driver, conn *sql.Conn, statement string, queryContext db.QueryContext) ([]*v1pb.QueryResult, time.Duration, error) {
+func executeWithTimeout(ctx context.Context, stores *store.Store, licenseService *enterprise.LicenseService, driver db.Driver, conn *sql.Conn, statement string, queryContext db.QueryContext) ([]*v1pb.QueryResult, time.Duration, error) {
queryCtx := ctx
var timeout time.Duration
// For access control feature, we will use the timeout from request and query data policy.
@@ -824,7 +824,7 @@ func DoExport(
ctx context.Context,
stores *store.Store,
dbFactory *dbfactory.DBFactory,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
request *v1pb.ExportRequest,
user *store.UserMessage,
instance *store.InstanceMessage,
diff --git a/backend/api/v1/subscription_service.go b/backend/api/v1/subscription_service.go
index 0fd10dd7ef..0ba6ec2892 100644
--- a/backend/api/v1/subscription_service.go
+++ b/backend/api/v1/subscription_service.go
@@ -8,7 +8,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/component/config"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/runner/metricreport"
"github.com/bytebase/bytebase/backend/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -20,7 +20,7 @@ type SubscriptionService struct {
store *store.Store
profile *config.Profile
metricReporter *metricreport.Reporter
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewSubscriptionService creates a new SubscriptionService.
@@ -28,7 +28,7 @@ func NewSubscriptionService(
store *store.Store,
profile *config.Profile,
metricReporter *metricreport.Reporter,
- licenseService enterprise.LicenseService) *SubscriptionService {
+ licenseService *enterprise.LicenseService) *SubscriptionService {
return &SubscriptionService{
store: store,
profile: profile,
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index acb0181cc7..36a91530ff 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -23,7 +23,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
metricapi "github.com/bytebase/bytebase/backend/metric"
"github.com/bytebase/bytebase/backend/plugin/metric"
"github.com/bytebase/bytebase/backend/runner/metricreport"
@@ -38,7 +38,7 @@ type UserService struct {
v1pb.UnimplementedUserServiceServer
store *store.Store
secret string
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
metricReporter *metricreport.Reporter
profile *config.Profile
stateCfg *state.State
@@ -46,7 +46,7 @@ type UserService struct {
}
// NewUserService creates a new UserService.
-func NewUserService(store *store.Store, secret string, licenseService enterprise.LicenseService, metricReporter *metricreport.Reporter, profile *config.Profile, stateCfg *state.State, iamManager *iam.Manager) *UserService {
+func NewUserService(store *store.Store, secret string, licenseService *enterprise.LicenseService, metricReporter *metricreport.Reporter, profile *config.Profile, stateCfg *state.State, iamManager *iam.Manager) *UserService {
return &UserService{
store: store,
secret: secret,
@@ -820,7 +820,7 @@ func convertToPrincipalType(userType v1pb.UserType) (storepb.PrincipalType, erro
return t, nil
}
-func validateEmailWithDomains(ctx context.Context, licenseService enterprise.LicenseService, stores *store.Store, email string, isServiceAccount bool, checkDomainSetting bool) error {
+func validateEmailWithDomains(ctx context.Context, licenseService *enterprise.LicenseService, stores *store.Store, email string, isServiceAccount bool, checkDomainSetting bool) error {
if licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_USER_EMAIL_DOMAIN_RESTRICTION) != nil {
// nolint:nilerr
// feature not enabled, only validate email and skip domain restriction.
diff --git a/backend/component/iam/manager.go b/backend/component/iam/manager.go
index 1429ce56ec..5efb22c58b 100644
--- a/backend/component/iam/manager.go
+++ b/backend/component/iam/manager.go
@@ -9,7 +9,7 @@ import (
"gopkg.in/yaml.v3"
"github.com/bytebase/bytebase/backend/common"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
@@ -31,10 +31,10 @@ type Manager struct {
groupMembers map[string]map[string]bool
PredefinedRoles []*store.RoleMessage
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
-func NewManager(store *store.Store, licenseService enterprise.LicenseService) (*Manager, error) {
+func NewManager(store *store.Store, licenseService *enterprise.LicenseService) (*Manager, error) {
predefinedRoles, err := loadPredefinedRoles()
if err != nil {
return nil, err
diff --git a/backend/enterprise/api/license.go b/backend/enterprise/api/license.go
deleted file mode 100644
index bb70150c23..0000000000
--- a/backend/enterprise/api/license.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Package api provides the API definition for enterprise service.
-package api
-
-import (
- "context"
-
- "github.com/bytebase/bytebase/backend/store"
- v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
-)
-
-// LicenseService is the service for enterprise license.
-type LicenseService interface {
- // StoreLicense will store license into file.
- StoreLicense(ctx context.Context, license string) error
- // LoadSubscription will load subscription.
- LoadSubscription(ctx context.Context) *v1pb.Subscription
- // IsFeatureEnabled returns whether a feature is enabled.
- IsFeatureEnabled(feature v1pb.PlanFeature) error
- // IsFeatureEnabledForInstance returns whether a feature is enabled for the instance.
- IsFeatureEnabledForInstance(feature v1pb.PlanFeature, instance *store.InstanceMessage) error
- // GetEffectivePlan gets the effective plan.
- GetEffectivePlan() v1pb.PlanType
- // GetPlanLimitValue gets the limit value for the plan.
- GetPlanLimitValue(ctx context.Context, name PlanLimit) int
- // GetInstanceLicenseCount returns the instance count limit for current subscription.
- GetInstanceLicenseCount(ctx context.Context) int
- // RefreshCache will invalidate and refresh the subscription cache.
- RefreshCache(ctx context.Context)
-}
diff --git a/backend/enterprise/service/license.go b/backend/enterprise/license.go
similarity index 91%
rename from backend/enterprise/service/license.go
rename to backend/enterprise/license.go
index 5b754e52a5..247a8426d9 100644
--- a/backend/enterprise/service/license.go
+++ b/backend/enterprise/license.go
@@ -1,5 +1,5 @@
-// Package service implements the enterprise license service.
-package service
+// Package enterprise implements the enterprise license service.
+package enterprise
import (
"context"
@@ -11,14 +11,11 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/common"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
"github.com/bytebase/bytebase/backend/enterprise/plugin"
"github.com/bytebase/bytebase/backend/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
-var _ enterprise.LicenseService = (*LicenseService)(nil)
-
// LicenseService is the service for enterprise license.
type LicenseService struct {
store *store.Store
@@ -95,7 +92,7 @@ func isSubscriptionExpired(s *v1pb.Subscription) bool {
// IsFeatureEnabled returns whether a feature is enabled.
func (s *LicenseService) IsFeatureEnabled(f v1pb.PlanFeature) error {
plan := s.GetEffectivePlan()
- features, ok := enterprise.PlanFeatureMatrix[plan]
+ features, ok := PlanFeatureMatrix[plan]
if !ok || !features[f] {
return errors.New(accessErrorMessage(f))
}
@@ -142,8 +139,8 @@ func (s *LicenseService) GetEffectivePlan() v1pb.PlanType {
}
// GetPlanLimitValue gets the limit value for the plan.
-func (s *LicenseService) GetPlanLimitValue(ctx context.Context, name enterprise.PlanLimit) int {
- v, ok := enterprise.PlanLimitValues[name]
+func (s *LicenseService) GetPlanLimitValue(ctx context.Context, name PlanLimit) int {
+ v, ok := PlanLimitValues[name]
if !ok {
return 0
}
@@ -158,9 +155,9 @@ func (s *LicenseService) GetPlanLimitValue(ctx context.Context, name enterprise.
return limit
case v1pb.PlanType_TEAM, v1pb.PlanType_ENTERPRISE:
switch name {
- case enterprise.PlanLimitMaximumInstance:
+ case PlanLimitMaximumInstance:
return limit
- case enterprise.PlanLimitMaximumUser:
+ case PlanLimitMaximumUser:
if subscription.SeatCount == 0 {
// to compatible with old license.
return limit
@@ -194,10 +191,10 @@ func accessErrorMessage(f v1pb.PlanFeature) string {
// minimumSupportedPlan will find the minimum plan which supports the target feature.
func minimumSupportedPlan(f v1pb.PlanFeature) v1pb.PlanType {
// Check from lowest to highest plan
- if enterprise.PlanFeatureMatrix[v1pb.PlanType_FREE][f] {
+ if PlanFeatureMatrix[v1pb.PlanType_FREE][f] {
return v1pb.PlanType_FREE
}
- if enterprise.PlanFeatureMatrix[v1pb.PlanType_TEAM][f] {
+ if PlanFeatureMatrix[v1pb.PlanType_TEAM][f] {
return v1pb.PlanType_TEAM
}
return v1pb.PlanType_ENTERPRISE
diff --git a/backend/enterprise/api/limit.go b/backend/enterprise/limit.go
similarity index 98%
rename from backend/enterprise/api/limit.go
rename to backend/enterprise/limit.go
index a54eca4075..0343bf14a1 100644
--- a/backend/enterprise/api/limit.go
+++ b/backend/enterprise/limit.go
@@ -1,4 +1,4 @@
-package api
+package enterprise
import (
_ "embed"
diff --git a/backend/enterprise/api/plan.yaml b/backend/enterprise/plan.yaml
similarity index 100%
rename from backend/enterprise/api/plan.yaml
rename to backend/enterprise/plan.yaml
diff --git a/backend/enterprise/service/provider_aws.go b/backend/enterprise/provider_aws.go
similarity index 93%
rename from backend/enterprise/service/provider_aws.go
rename to backend/enterprise/provider_aws.go
index f08db03fe4..40840349b7 100644
--- a/backend/enterprise/service/provider_aws.go
+++ b/backend/enterprise/provider_aws.go
@@ -1,6 +1,6 @@
//go:build aws
-package service
+package enterprise
import (
"github.com/bytebase/bytebase/backend/enterprise/plugin"
@@ -10,3 +10,4 @@ import (
func getLicenseProvider(providerConfig *plugin.ProviderConfig) (plugin.LicenseProvider, error) {
return aws.NewProvider(providerConfig)
}
+
diff --git a/backend/enterprise/service/provider_hub.go b/backend/enterprise/provider_hub.go
similarity index 93%
rename from backend/enterprise/service/provider_hub.go
rename to backend/enterprise/provider_hub.go
index 518eeb4724..585a6990c9 100644
--- a/backend/enterprise/service/provider_hub.go
+++ b/backend/enterprise/provider_hub.go
@@ -1,6 +1,6 @@
//go:build !aws
-package service
+package enterprise
import (
"github.com/bytebase/bytebase/backend/enterprise/plugin"
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index 3f3e535b1e..64ef22f3e1 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -23,7 +23,7 @@ import (
"github.com/bytebase/bytebase/backend/component/sheet"
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/component/webhook"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/utils"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
@@ -37,11 +37,11 @@ type Runner struct {
dbFactory *dbfactory.DBFactory
stateCfg *state.State
webhookManager *webhook.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewRunner creates a new runner.
-func NewRunner(store *store.Store, sheetManager *sheet.Manager, dbFactory *dbfactory.DBFactory, stateCfg *state.State, webhookManager *webhook.Manager, licenseService enterprise.LicenseService) *Runner {
+func NewRunner(store *store.Store, sheetManager *sheet.Manager, dbFactory *dbfactory.DBFactory, stateCfg *state.State, webhookManager *webhook.Manager, licenseService *enterprise.LicenseService) *Runner {
return &Runner{
store: store,
sheetManager: sheetManager,
diff --git a/backend/runner/metricreport/reporter.go b/backend/runner/metricreport/reporter.go
index 8de5d48f61..e8717b2724 100644
--- a/backend/runner/metricreport/reporter.go
+++ b/backend/runner/metricreport/reporter.go
@@ -13,7 +13,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/config"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/metric"
"github.com/bytebase/bytebase/backend/plugin/metric/segment"
"github.com/bytebase/bytebase/backend/store"
@@ -48,7 +48,7 @@ const (
// Reporter is the metric reporter.
type Reporter struct {
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
profile *config.Profile
reporter metric.Reporter
collectors map[string]metric.Collector
@@ -56,7 +56,7 @@ type Reporter struct {
}
// NewReporter creates a new metric scheduler.
-func NewReporter(store *store.Store, licenseService enterprise.LicenseService, profile *config.Profile) *Reporter {
+func NewReporter(store *store.Store, licenseService *enterprise.LicenseService, profile *config.Profile) *Reporter {
var r metric.Reporter
if profile.MetricConnectionKey != "" {
r = segment.NewReporter(profile.MetricConnectionKey)
diff --git a/backend/runner/plancheck/scheduler.go b/backend/runner/plancheck/scheduler.go
index bc24ff8198..8f20456b6b 100644
--- a/backend/runner/plancheck/scheduler.go
+++ b/backend/runner/plancheck/scheduler.go
@@ -13,7 +13,7 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/store"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
@@ -23,7 +23,7 @@ const (
)
// NewScheduler creates a new plan check scheduler.
-func NewScheduler(s *store.Store, licenseService enterprise.LicenseService, stateCfg *state.State) *Scheduler {
+func NewScheduler(s *store.Store, licenseService *enterprise.LicenseService, stateCfg *state.State) *Scheduler {
return &Scheduler{
store: s,
licenseService: licenseService,
@@ -35,7 +35,7 @@ func NewScheduler(s *store.Store, licenseService enterprise.LicenseService, stat
// Scheduler is the plan check run scheduler.
type Scheduler struct {
store *store.Store
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
stateCfg *state.State
executors map[store.PlanCheckRunType]Executor
}
diff --git a/backend/runner/plancheck/statement_advise_executor.go b/backend/runner/plancheck/statement_advise_executor.go
index 6415e06f2e..c355464015 100644
--- a/backend/runner/plancheck/statement_advise_executor.go
+++ b/backend/runner/plancheck/statement_advise_executor.go
@@ -12,7 +12,7 @@ import (
"github.com/bytebase/bytebase/backend/component/dbfactory"
"github.com/bytebase/bytebase/backend/component/sheet"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
"github.com/bytebase/bytebase/backend/plugin/db"
@@ -27,7 +27,7 @@ func NewStatementAdviseExecutor(
store *store.Store,
sheetManager *sheet.Manager,
dbFactory *dbfactory.DBFactory,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
) Executor {
return &StatementAdviseExecutor{
store: store,
@@ -42,7 +42,7 @@ type StatementAdviseExecutor struct {
store *store.Store
sheetManager *sheet.Manager
dbFactory *dbfactory.DBFactory
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// Run will run the plan check statement advise executor once, and run its sub-advisors one-by-one.
diff --git a/backend/runner/taskrun/data_export_executor.go b/backend/runner/taskrun/data_export_executor.go
index a0261ad568..f00fc7b620 100644
--- a/backend/runner/taskrun/data_export_executor.go
+++ b/backend/runner/taskrun/data_export_executor.go
@@ -10,7 +10,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/dbfactory"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/runner/schemasync"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -19,7 +19,7 @@ import (
)
// NewDataExportExecutor creates a data export task executor.
-func NewDataExportExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
+func NewDataExportExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
return &DataExportExecutor{
store: store,
dbFactory: dbFactory,
@@ -34,7 +34,7 @@ func NewDataExportExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, l
type DataExportExecutor struct {
store *store.Store
dbFactory *dbfactory.DBFactory
- license enterprise.LicenseService
+ license *enterprise.LicenseService
stateCfg *state.State
schemaSyncer *schemasync.Syncer
profile *config.Profile
diff --git a/backend/runner/taskrun/data_update_executor.go b/backend/runner/taskrun/data_update_executor.go
index 7c65225ab0..e02f060813 100644
--- a/backend/runner/taskrun/data_update_executor.go
+++ b/backend/runner/taskrun/data_update_executor.go
@@ -15,7 +15,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/dbfactory"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/runner/schemasync"
"github.com/bytebase/bytebase/backend/plugin/db"
@@ -28,7 +28,7 @@ import (
)
// NewDataUpdateExecutor creates a data update (DML) task executor.
-func NewDataUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
+func NewDataUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
return &DataUpdateExecutor{
store: store,
dbFactory: dbFactory,
@@ -43,7 +43,7 @@ func NewDataUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, l
type DataUpdateExecutor struct {
store *store.Store
dbFactory *dbfactory.DBFactory
- license enterprise.LicenseService
+ license *enterprise.LicenseService
stateCfg *state.State
schemaSyncer *schemasync.Syncer
profile *config.Profile
diff --git a/backend/runner/taskrun/schedulerv2.go b/backend/runner/taskrun/schedulerv2.go
index 8454cc2070..380e5fdab0 100644
--- a/backend/runner/taskrun/schedulerv2.go
+++ b/backend/runner/taskrun/schedulerv2.go
@@ -17,7 +17,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/component/webhook"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/db"
"github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/utils"
@@ -39,7 +39,7 @@ type SchedulerV2 struct {
webhookManager *webhook.Manager
executorMap map[storepb.Task_Type]Executor
profile *config.Profile
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
}
// NewSchedulerV2 will create a new scheduler.
@@ -48,7 +48,7 @@ func NewSchedulerV2(
stateCfg *state.State,
webhookManager *webhook.Manager,
profile *config.Profile,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
) *SchedulerV2 {
return &SchedulerV2{
store: store,
diff --git a/backend/runner/taskrun/schema_update_executor.go b/backend/runner/taskrun/schema_update_executor.go
index 04141d103f..5175850244 100644
--- a/backend/runner/taskrun/schema_update_executor.go
+++ b/backend/runner/taskrun/schema_update_executor.go
@@ -9,7 +9,7 @@ import (
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/dbfactory"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/db"
"github.com/bytebase/bytebase/backend/runner/schemasync"
"github.com/bytebase/bytebase/backend/store"
@@ -17,7 +17,7 @@ import (
)
// NewSchemaUpdateExecutor creates a schema update (DDL) task executor.
-func NewSchemaUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
+func NewSchemaUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
return &SchemaUpdateExecutor{
store: store,
dbFactory: dbFactory,
@@ -32,7 +32,7 @@ func NewSchemaUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory,
type SchemaUpdateExecutor struct {
store *store.Store
dbFactory *dbfactory.DBFactory
- license enterprise.LicenseService
+ license *enterprise.LicenseService
stateCfg *state.State
schemaSyncer *schemasync.Syncer
profile *config.Profile
diff --git a/backend/runner/taskrun/schema_update_ghost_executor.go b/backend/runner/taskrun/schema_update_ghost_executor.go
index 9cae02063e..28350d3414 100644
--- a/backend/runner/taskrun/schema_update_ghost_executor.go
+++ b/backend/runner/taskrun/schema_update_ghost_executor.go
@@ -17,7 +17,7 @@ import (
"github.com/bytebase/bytebase/backend/component/dbfactory"
"github.com/bytebase/bytebase/backend/component/ghost"
"github.com/bytebase/bytebase/backend/component/state"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/plugin/db"
"github.com/bytebase/bytebase/backend/runner/schemasync"
"github.com/bytebase/bytebase/backend/store"
@@ -26,7 +26,7 @@ import (
)
// NewSchemaUpdateGhostExecutor creates a schema update (gh-ost) task executor.
-func NewSchemaUpdateGhostExecutor(s *store.Store, dbFactory *dbfactory.DBFactory, license enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
+func NewSchemaUpdateGhostExecutor(s *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
return &SchemaUpdateGhostExecutor{
s: s,
dbFactory: dbFactory,
@@ -41,7 +41,7 @@ func NewSchemaUpdateGhostExecutor(s *store.Store, dbFactory *dbfactory.DBFactory
type SchemaUpdateGhostExecutor struct {
s *store.Store
dbFactory *dbfactory.DBFactory
- license enterprise.LicenseService
+ license *enterprise.LicenseService
stateCfg *state.State
schemaSyncer *schemasync.Syncer
profile *config.Profile
diff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.go
index 3527261c72..a7544233d9 100644
--- a/backend/server/grpc_routes.go
+++ b/backend/server/grpc_routes.go
@@ -19,7 +19,7 @@ import (
"github.com/bytebase/bytebase/backend/component/sheet"
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/component/webhook"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/runner/metricreport"
"github.com/bytebase/bytebase/backend/runner/schemasync"
"github.com/bytebase/bytebase/backend/store"
@@ -48,7 +48,7 @@ func configureGrpcRouters(
stores *store.Store,
sheetManager *sheet.Manager,
dbFactory *dbfactory.DBFactory,
- licenseService enterprise.LicenseService,
+ licenseService *enterprise.LicenseService,
profile *config.Profile,
metricReporter *metricreport.Reporter,
stateCfg *state.State,
diff --git a/backend/server/server.go b/backend/server/server.go
index 7fd643ee52..a667ae66c8 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -39,8 +39,7 @@ import (
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/component/webhook"
"github.com/bytebase/bytebase/backend/demo"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
- enterprisesvc "github.com/bytebase/bytebase/backend/enterprise/service"
+ "github.com/bytebase/bytebase/backend/enterprise"
"github.com/bytebase/bytebase/backend/migrator"
"github.com/bytebase/bytebase/backend/resources/postgres"
"github.com/bytebase/bytebase/backend/runner/approval"
@@ -76,7 +75,7 @@ type Server struct {
webhookManager *webhook.Manager
iamManager *iam.Manager
- licenseService enterprise.LicenseService
+ licenseService *enterprise.LicenseService
profile *config.Profile
echoServer *echo.Echo
@@ -171,7 +170,7 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {
slog.Warn("failed to backfill issue ts vector", log.BBError(err))
}
- s.licenseService, err = enterprisesvc.NewLicenseService(profile.Mode, stores)
+ s.licenseService, err = enterprise.NewLicenseService(profile.Mode, stores)
if err != nil {
return nil, errors.Wrap(err, "failed to create license service")
}