diff options
author | Karthik Nayak <knayak@gitlab.com> | 2023-05-09 10:49:16 +0300 |
---|---|---|
committer | Karthik Nayak <knayak@gitlab.com> | 2023-05-30 11:00:45 +0300 |
commit | 3ee7c6661f34477c3fce660e6580c80ffb1204fe (patch) | |
tree | 58f7d0a793681eb8c0efabf5cf4ef2710f512e8a /internal/gitaly/transaction_manager.go | |
parent | 1a557c8c7a2dd3bab5d76f8a1587313e902becd1 (diff) |
gitaly: Add `RepositoryManager` to `TransactionManager`
In the `TransactionManager` we want to cleanup stale lock files if we
run into them (but not when housekeeping is running). To do this we need
the `housekeeping.RepositoryManager`, let's add this field to the
TransactionManager.
The following commit[s] will utilize the field.
Diffstat (limited to 'internal/gitaly/transaction_manager.go')
-rw-r--r-- | internal/gitaly/transaction_manager.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/gitaly/transaction_manager.go b/internal/gitaly/transaction_manager.go index 8b3919136..939cd4ca7 100644 --- a/internal/gitaly/transaction_manager.go +++ b/internal/gitaly/transaction_manager.go @@ -18,6 +18,7 @@ import ( "github.com/dgraph-io/badger/v3" "gitlab.com/gitlab-org/gitaly/v16/internal/git" + "gitlab.com/gitlab-org/gitaly/v16/internal/git/housekeeping" "gitlab.com/gitlab-org/gitaly/v16/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/v16/internal/git/updateref" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/repoutil" @@ -455,6 +456,8 @@ type TransactionManager struct { appliedLogIndex LogIndex // customHookIndex stores the log index of the latest committed custom custom hooks in the repository. customHookIndex LogIndex + // housekeepingManager access to the housekeeping.Manager. + housekeepingManager housekeeping.Manager // transactionFinalizer executes when a transaction is completed. transactionFinalizer func() @@ -466,7 +469,16 @@ type TransactionManager struct { } // NewTransactionManager returns a new TransactionManager for the given repository. -func NewTransactionManager(db *badger.DB, storagePath, relativePath, stagingDir string, repositoryFactory localrepo.StorageScopedFactory, cmdFactory git.CommandFactory, transactionFinalizer func()) *TransactionManager { +func NewTransactionManager( + db *badger.DB, + storagePath, + relativePath, + stagingDir string, + cmdFactory git.CommandFactory, + housekeepingManager housekeeping.Manager, + repositoryFactory localrepo.StorageScopedFactory, + transactionFinalizer func(), +) *TransactionManager { ctx, cancel := context.WithCancel(context.Background()) return &TransactionManager{ ctx: ctx, @@ -483,6 +495,7 @@ func NewTransactionManager(db *badger.DB, storagePath, relativePath, stagingDir initialized: make(chan struct{}), applyNotifications: make(map[LogIndex]chan struct{}), stagingDirectory: stagingDir, + housekeepingManager: housekeepingManager, transactionFinalizer: transactionFinalizer, awaitingTransactions: make(map[LogIndex]resultChannel), } |