refact(controller): Move Target Repository Factory to the target package

This commit is contained in:
Hugo Vieira authored and Timothy Messier committed 2022-09-07 17:53:40 +00:00
1 parent 1e1e5a5ff5
commit 224f8d2d4e
4 files changed
+7 -5

No files matched your search

@@ -11,7 +11,6 @@ import (
hostplugin "github.com/hashicorp/boundary/internal/plugin/host"
"github.com/hashicorp/boundary/internal/server"
"github.com/hashicorp/boundary/internal/session"
"github.com/hashicorp/boundary/internal/target"
)
type (
@@ -26,6 +25,5 @@ type (
PluginHostRepoFactory func() (*pluginhost.Repository, error)
HostPluginRepoFactory func() (*hostplugin.Repository, error)
ConnectionRepoFactory func() (*session.ConnectionRepository, error)
TargetRepoFactory func() (*target.Repository, error)
WorkerAuthRepoStorageFactory func() (*server.WorkerAuthRepositoryStorage, error)
)
+1 -1
View File
@@ -115,7 +115,7 @@ type Controller struct {
StaticHostRepoFn common.StaticRepoFactory
PluginHostRepoFn common.PluginHostRepoFactory
HostPluginRepoFn common.HostPluginRepoFactory
TargetRepoFn common.TargetRepoFactory
TargetRepoFn target.RepositoryFactory
WorkerAuthRepoStorageFn common.WorkerAuthRepoStorageFactory
scheduler *scheduler.Scheduler
@@ -98,7 +98,7 @@ var (
type Service struct {
pbs.UnsafeTargetServiceServer
repoFn common.TargetRepoFactory
repoFn target.RepositoryFactory
iamRepoFn common.IamRepoFactory
serversRepoFn common.ServersRepoFactory
sessionRepoFn session.RepositoryFactory
@@ -115,7 +115,7 @@ var _ pbs.TargetServiceServer = (*Service)(nil)
func NewService(
ctx context.Context,
kmsCache *kms.Kms,
repoFn common.TargetRepoFactory,
repoFn target.RepositoryFactory,
iamRepoFn common.IamRepoFactory,
serversRepoFn common.ServersRepoFactory,
sessionRepoFn session.RepositoryFactory,
+4
View File
@@ -15,6 +15,10 @@ import (
"github.com/hashicorp/go-dbw"
)
// RepositoryFactory enables `target.Repository` object instantiation,
// and is used by the various service packages/controller object to do so.
type RepositoryFactory func() (*Repository, error)
// Cloneable provides a cloning interface
type Cloneable interface {
Clone() Target