2018-11-09 13:39:43 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-30 05:11:47 -05:00
|
|
|
module Gitlab
|
|
|
|
module GitalyClient
|
|
|
|
# Meant for extraction of server data, and later maybe to perform misc task
|
|
|
|
#
|
|
|
|
# Not meant for connection logic, look in Gitlab::GitalyClient
|
|
|
|
class ServerService
|
|
|
|
def initialize(storage)
|
|
|
|
@storage = storage
|
|
|
|
end
|
|
|
|
|
|
|
|
def info
|
2018-07-11 06:52:48 -04:00
|
|
|
GitalyClient.call(@storage, :server_service, :server_info, Gitaly::ServerInfoRequest.new, timeout: GitalyClient.fast_timeout)
|
2018-01-30 05:11:47 -05:00
|
|
|
end
|
2020-01-24 13:09:00 -05:00
|
|
|
|
|
|
|
def disk_statistics
|
|
|
|
GitalyClient.call(@storage, :server_service, :disk_statistics, Gitaly::DiskStatisticsRequest.new, timeout: GitalyClient.fast_timeout)
|
|
|
|
end
|
|
|
|
|
|
|
|
def storage_info
|
|
|
|
storage_specific(info)
|
|
|
|
end
|
|
|
|
|
|
|
|
def storage_disk_statistics
|
|
|
|
storage_specific(disk_statistics)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def storage_specific(response)
|
|
|
|
response.storage_statuses.find { |status| status.storage_name == @storage }
|
|
|
|
end
|
2018-01-30 05:11:47 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|