Commit a24a69ac authored by Markus Koller's avatar Markus Koller

Merge branch 'repository-storage-vs-shard' into 'master'

Access Repository#shard directly

See merge request gitlab-org/gitlab!35127
parents 2c122398 97d44c2c
...@@ -8,20 +8,19 @@ class Repositories::BaseService < BaseService ...@@ -8,20 +8,19 @@ class Repositories::BaseService < BaseService
attr_reader :repository attr_reader :repository
delegate :container, :disk_path, :full_path, to: :repository delegate :container, :disk_path, :full_path, to: :repository
delegate :repository_storage, to: :container
def initialize(repository) def initialize(repository)
@repository = repository @repository = repository
end end
def repo_exists?(path) def repo_exists?(path)
gitlab_shell.repository_exists?(repository_storage, path + '.git') gitlab_shell.repository_exists?(repository.shard, path + '.git')
end end
def mv_repository(from_path, to_path) def mv_repository(from_path, to_path)
return true unless repo_exists?(from_path) return true unless repo_exists?(from_path)
gitlab_shell.mv_repository(repository_storage, from_path, to_path) gitlab_shell.mv_repository(repository.shard, from_path, to_path)
end end
# Build a path for removing repositories # Build a path for removing repositories
......
...@@ -9,7 +9,7 @@ class Repositories::ShellDestroyService < Repositories::BaseService ...@@ -9,7 +9,7 @@ class Repositories::ShellDestroyService < Repositories::BaseService
GitlabShellWorker.perform_in(delay, GitlabShellWorker.perform_in(delay,
:remove_repository, :remove_repository,
repository_storage, repository.shard,
removal_path) removal_path)
end end
end end
...@@ -118,8 +118,8 @@ module API ...@@ -118,8 +118,8 @@ module API
{ {
repository: repository.gitaly_repository, repository: repository.gitaly_repository,
address: Gitlab::GitalyClient.address(container.repository_storage), address: Gitlab::GitalyClient.address(repository.shard),
token: Gitlab::GitalyClient.token(container.repository_storage), token: Gitlab::GitalyClient.token(repository.shard),
features: Feature::Gitaly.server_feature_flags features: Feature::Gitaly.server_feature_flags
} }
end end
......
...@@ -216,8 +216,8 @@ module Gitlab ...@@ -216,8 +216,8 @@ module Gitlab
def gitaly_server_hash(repository) def gitaly_server_hash(repository)
{ {
address: Gitlab::GitalyClient.address(repository.container.repository_storage), address: Gitlab::GitalyClient.address(repository.shard),
token: Gitlab::GitalyClient.token(repository.container.repository_storage), token: Gitlab::GitalyClient.token(repository.shard),
features: Feature::Gitaly.server_feature_flags features: Feature::Gitaly.server_feature_flags
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment