Skip to content
Snippets Groups Projects
Commit efc643cb authored by Olivier Campeau's avatar Olivier Campeau
Browse files

Rename bundleManager to bundleURIManager

The name of the bundle URI manager is inconsistent
across the program and in some part not very
descriptive.

The bundle URI manager is now renamed to
`bundleURIManager`.

References:

This commit addresses the following comment:
!7542 (comment 2298693589)
parent eb61ad15
No related branches found
No related tags found
Loading
......@@ -541,7 +541,7 @@ func run(appCtx *cli.Context, cfg config.Cfg, logger log.Logger) error {
}
var bundleURISink *bundleuri.Sink
var bundleManager *bundleuri.GenerationManager
var bundleURIManager *bundleuri.GenerationManager
if cfg.BundleURI.GoCloudURL != "" {
bundleURISink, err = bundleuri.NewSink(ctx, cfg.BundleURI.GoCloudURL)
if err != nil {
......@@ -554,7 +554,7 @@ func run(appCtx *cli.Context, cfg config.Cfg, logger log.Logger) error {
// Further tests and analysis would be required to come up with the
// appropriate configuration. This will be done once we are ready to use this manager
// to generate bundles based on this configuration (ie: calling GenerateIfAboveThreshold(...))
bundleManager, err = bundleuri.NewGenerationManager(bundleURISink, logger, 3, 1, bundleuri.NewInProgressTracker())
bundleURIManager, err = bundleuri.NewGenerationManager(bundleURISink, logger, 3, 1, bundleuri.NewInProgressTracker())
if err != nil {
return fmt.Errorf("error creating bundle manager: %w", err)
}
......@@ -584,26 +584,26 @@ func run(appCtx *cli.Context, cfg config.Cfg, logger log.Logger) error {
}
setup.RegisterAll(srv, &service.Dependencies{
Logger: logger,
Cfg: cfg,
GitalyHookManager: hookManager,
TransactionManager: transactionManager,
StorageLocator: locator,
ClientPool: conns,
GitCmdFactory: gitCmdFactory,
CatfileCache: catfileCache,
DiskCache: diskCache,
PackObjectsCache: streamCache,
PackObjectsLimiter: packObjectsLimiter,
RepositoryCounter: repoCounter,
UpdaterWithHooks: updaterWithHooks,
Node: node,
TransactionRegistry: txRegistry,
HousekeepingManager: housekeepingManager,
BackupSink: backupSink,
BackupLocator: backupLocator,
LocalRepositoryFactory: localrepoFactory,
BundleGenerationManager: bundleManager,
Logger: logger,
Cfg: cfg,
GitalyHookManager: hookManager,
TransactionManager: transactionManager,
StorageLocator: locator,
ClientPool: conns,
GitCmdFactory: gitCmdFactory,
CatfileCache: catfileCache,
DiskCache: diskCache,
PackObjectsCache: streamCache,
PackObjectsLimiter: packObjectsLimiter,
RepositoryCounter: repoCounter,
UpdaterWithHooks: updaterWithHooks,
Node: node,
TransactionRegistry: txRegistry,
HousekeepingManager: housekeepingManager,
BackupSink: backupSink,
BackupLocator: backupLocator,
LocalRepositoryFactory: localrepoFactory,
BundleURIManager: bundleURIManager,
})
b.RegisterStarter(starter.New(c, srv, logger))
}
......
......@@ -26,30 +26,30 @@ import (
// Dependencies assembles set of components required by different kinds of services.
type Dependencies struct {
Logger log.Logger
Cfg config.Cfg
GitalyHookManager gitalyhook.Manager
TransactionManager transaction.Manager
StorageLocator storage.Locator
ClientPool *client.Pool
GitCmdFactory gitcmd.CommandFactory
BackchannelRegistry *backchannel.Registry
GitlabClient gitlab.Client
CatfileCache catfile.Cache
DiskCache cache.Cache
PackObjectsCache streamcache.Cache
PackObjectsLimiter limiter.Limiter
LimitHandler *limithandler.LimiterMiddleware
RepositoryCounter *counter.RepositoryCounter
UpdaterWithHooks *updateref.UpdaterWithHooks
HousekeepingManager housekeepingmgr.Manager
TransactionRegistry *storagemgr.TransactionRegistry
Node storage.Node
BackupSink *backup.Sink
BackupLocator backup.Locator
ProcReceiveRegistry *gitalyhook.ProcReceiveRegistry
BundleGenerationManager *bundleuri.GenerationManager
LocalRepositoryFactory localrepo.Factory
Logger log.Logger
Cfg config.Cfg
GitalyHookManager gitalyhook.Manager
TransactionManager transaction.Manager
StorageLocator storage.Locator
ClientPool *client.Pool
GitCmdFactory gitcmd.CommandFactory
BackchannelRegistry *backchannel.Registry
GitlabClient gitlab.Client
CatfileCache catfile.Cache
DiskCache cache.Cache
PackObjectsCache streamcache.Cache
PackObjectsLimiter limiter.Limiter
LimitHandler *limithandler.LimiterMiddleware
RepositoryCounter *counter.RepositoryCounter
UpdaterWithHooks *updateref.UpdaterWithHooks
HousekeepingManager housekeepingmgr.Manager
TransactionRegistry *storagemgr.TransactionRegistry
Node storage.Node
BackupSink *backup.Sink
BackupLocator backup.Locator
ProcReceiveRegistry *gitalyhook.ProcReceiveRegistry
BundleURIManager *bundleuri.GenerationManager
LocalRepositoryFactory localrepo.Factory
}
// GetLogger returns the logger.
......@@ -167,7 +167,7 @@ func (dc *Dependencies) GetRepositoryFactory() localrepo.Factory {
return dc.LocalRepositoryFactory
}
// GetBundleManager returns the RepositoryFactory
func (dc *Dependencies) GetBundleManager() *bundleuri.GenerationManager {
return dc.BundleGenerationManager
// GetBundleURIManager returns the RepositoryFactory
func (dc *Dependencies) GetBundleURIManager() *bundleuri.GenerationManager {
return dc.BundleURIManager
}
......@@ -9,7 +9,7 @@ import (
// GenerateBundleURI generates a bundle on the server for bundle-URI use.
func (s *server) GenerateBundleURI(ctx context.Context, req *gitalypb.GenerateBundleURIRequest) (_ *gitalypb.GenerateBundleURIResponse, returnErr error) {
if s.bundleManager == nil {
if s.bundleURIManager == nil {
return nil, structerr.NewFailedPrecondition("no bundle-generation manager available")
}
......@@ -20,7 +20,7 @@ func (s *server) GenerateBundleURI(ctx context.Context, req *gitalypb.GenerateBu
repo := s.localRepoFactory.Build(repository)
if err := s.bundleManager.Generate(ctx, repo); err != nil {
if err := s.bundleURIManager.Generate(ctx, repo); err != nil {
return nil, structerr.NewInternal("generate bundle: %w", err)
}
......
......@@ -36,7 +36,7 @@ func TestServer_GenerateBundleURI(t *testing.T) {
desc: "no bundle manager",
setup: func(t *testing.T, ctx context.Context, tempDir string) setupData {
cfg, client := setupRepositoryService(t,
testserver.WithBundleGenerationManager(nil),
testserver.WithBundleURIManager(nil),
)
repo, _ := gittest.CreateRepository(t, ctx, cfg)
......@@ -60,7 +60,7 @@ func TestServer_GenerateBundleURI(t *testing.T) {
require.NoError(t, err)
cfg, client := setupRepositoryService(t,
testserver.WithBundleGenerationManager(manager),
testserver.WithBundleURIManager(manager),
)
return setupData{
......@@ -81,7 +81,7 @@ func TestServer_GenerateBundleURI(t *testing.T) {
require.NoError(t, err)
cfg, client := setupRepositoryService(t,
testserver.WithBundleGenerationManager(manager),
testserver.WithBundleURIManager(manager),
)
repo, _ := gittest.CreateRepository(t, ctx, cfg)
......@@ -105,7 +105,7 @@ func TestServer_GenerateBundleURI(t *testing.T) {
require.NoError(t, err)
cfg, client := setupRepositoryService(t,
testserver.WithBundleGenerationManager(manager),
testserver.WithBundleURIManager(manager),
)
repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
......
......@@ -40,7 +40,7 @@ type server struct {
repositoryCounter *counter.RepositoryCounter
localRepoFactory localrepo.Factory
licenseCache *unarycache.Cache[git.ObjectID, *gitalypb.FindLicenseResponse]
bundleManager *bundleuri.GenerationManager
bundleURIManager *bundleuri.GenerationManager
}
// NewServer creates a new instance of a gRPC repo server
......@@ -61,7 +61,7 @@ func NewServer(deps *service.Dependencies) gitalypb.RepositoryServiceServer {
repositoryCounter: deps.GetRepositoryCounter(),
localRepoFactory: deps.GetRepositoryFactory(),
licenseCache: newLicenseCache(),
bundleManager: deps.GetBundleManager(),
bundleURIManager: deps.GetBundleURIManager(),
}
}
......
......@@ -30,7 +30,7 @@ type server struct {
backupLocator backup.Locator
backupSink *backup.Sink
localRepoFactory localrepo.Factory
bundleManager *bundleuri.GenerationManager
bundleURIManager *bundleuri.GenerationManager
}
// NewServer creates a new instance of a grpc SmartHTTPServer
......@@ -51,7 +51,7 @@ func NewServer(deps *service.Dependencies, serverOpts ...ServerOpt) gitalypb.Sma
backupLocator: deps.GetBackupLocator(),
backupSink: deps.GetBackupSink(),
localRepoFactory: deps.GetRepositoryFactory(),
bundleManager: deps.GetBundleManager(),
bundleURIManager: deps.GetBundleURIManager(),
}
for _, serverOpt := range serverOpts {
......
......@@ -116,7 +116,7 @@ func (s *server) runUploadPack(ctx context.Context, req *gitalypb.PostUploadPack
gitConfig = append(gitConfig, bundleuri.CapabilitiesGitConfig(ctx)...)
uploadPackConfig, err := bundleuri.UploadPackGitConfig(ctx, s.bundleManager, req.GetRepository())
uploadPackConfig, err := bundleuri.UploadPackGitConfig(ctx, s.bundleURIManager, req.GetRepository())
if err != nil {
} else {
gitConfig = append(gitConfig, uploadPackConfig...)
......
......@@ -492,7 +492,7 @@ func TestServer_PostUploadPackWithBundleURI(t *testing.T) {
}
server := startSmartHTTPServerWithOptions(t, cfg, nil, []testserver.GitalyServerOpt{
testserver.WithBundleGenerationManager(bundleManager),
testserver.WithBundleURIManager(bundleManager),
testserver.WithLogger(logger),
})
......
......@@ -58,7 +58,7 @@ func NewServer(deps *service.Dependencies, serverOpts ...ServerOpt) gitalypb.SSH
backupLocator: deps.GetBackupLocator(),
backupSink: deps.GetBackupSink(),
localRepoFactory: deps.GetRepositoryFactory(),
bundleURIManager: deps.GetBundleManager(),
bundleURIManager: deps.GetBundleURIManager(),
}
for _, serverOpt := range serverOpts {
......
......@@ -294,7 +294,7 @@ type gitalyServerDeps struct {
signingKey string
transactionRegistry *storagemgr.TransactionRegistry
procReceiveRegistry *hook.ProcReceiveRegistry
bundleGenerationMgr *bundleuri.GenerationManager
bundleURIManager *bundleuri.GenerationManager
localRepoFactory localrepo.Factory
}
......@@ -434,30 +434,30 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, ctx context.Conte
gsd.localRepoFactory = localrepo.NewFactory(gsd.logger, gsd.locator, gsd.gitCmdFactory, gsd.catfileCache)
return &service.Dependencies{
Logger: gsd.logger,
Cfg: cfg,
ClientPool: gsd.conns,
StorageLocator: gsd.locator,
TransactionManager: gsd.txMgr,
GitalyHookManager: gsd.hookMgr,
GitCmdFactory: gsd.gitCmdFactory,
BackchannelRegistry: gsd.backchannelReg,
GitlabClient: gsd.gitlabClient,
CatfileCache: gsd.catfileCache,
DiskCache: gsd.diskCache,
PackObjectsCache: gsd.packObjectsCache,
PackObjectsLimiter: gsd.packObjectsLimiter,
LimitHandler: gsd.limitHandler,
RepositoryCounter: gsd.repositoryCounter,
UpdaterWithHooks: gsd.updaterWithHooks,
HousekeepingManager: gsd.housekeepingManager,
TransactionRegistry: gsd.transactionRegistry,
Node: node,
BackupSink: gsd.backupSink,
BackupLocator: gsd.backupLocator,
ProcReceiveRegistry: gsd.procReceiveRegistry,
BundleGenerationManager: gsd.bundleGenerationMgr,
LocalRepositoryFactory: gsd.localRepoFactory,
Logger: gsd.logger,
Cfg: cfg,
ClientPool: gsd.conns,
StorageLocator: gsd.locator,
TransactionManager: gsd.txMgr,
GitalyHookManager: gsd.hookMgr,
GitCmdFactory: gsd.gitCmdFactory,
BackchannelRegistry: gsd.backchannelReg,
GitlabClient: gsd.gitlabClient,
CatfileCache: gsd.catfileCache,
DiskCache: gsd.diskCache,
PackObjectsCache: gsd.packObjectsCache,
PackObjectsLimiter: gsd.packObjectsLimiter,
LimitHandler: gsd.limitHandler,
RepositoryCounter: gsd.repositoryCounter,
UpdaterWithHooks: gsd.updaterWithHooks,
HousekeepingManager: gsd.housekeepingManager,
TransactionRegistry: gsd.transactionRegistry,
Node: node,
BackupSink: gsd.backupSink,
BackupLocator: gsd.backupLocator,
ProcReceiveRegistry: gsd.procReceiveRegistry,
BundleURIManager: gsd.bundleURIManager,
LocalRepositoryFactory: gsd.localRepoFactory,
}
}
......@@ -588,10 +588,10 @@ func WithBackupLocator(backupLocator backup.Locator) GitalyServerOpt {
}
}
// WithBundleGenerationManager sets the bundleuri.Sink that will be used for Gitaly services
func WithBundleGenerationManager(mgr *bundleuri.GenerationManager) GitalyServerOpt {
// WithBundleURIManager sets the bundleuri.Sink that will be used for Gitaly services
func WithBundleURIManager(mgr *bundleuri.GenerationManager) GitalyServerOpt {
return func(deps gitalyServerDeps) gitalyServerDeps {
deps.bundleGenerationMgr = mgr
deps.bundleURIManager = mgr
return deps
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment