Class: Gitlab::Database::HealthStatus::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/health_status/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_checker, connection, tables, gitlab_schema) ⇒ Context

status_checker: the caller object which checks for database health status

eg: BackgroundMigration::BatchedMigration or DeferJobs::DatabaseHealthStatusChecker


11
12
13
14
15
16
# File 'lib/gitlab/database/health_status/context.rb', line 11

def initialize(status_checker, connection, tables, gitlab_schema)
  @status_checker = status_checker
  @connection = connection
  @tables = tables
  @gitlab_schema = gitlab_schema
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



7
8
9
# File 'lib/gitlab/database/health_status/context.rb', line 7

def connection
  @connection
end

#gitlab_schemaObject (readonly)

Returns the value of attribute gitlab_schema.



7
8
9
# File 'lib/gitlab/database/health_status/context.rb', line 7

def gitlab_schema
  @gitlab_schema
end

#status_checkerObject (readonly)

Returns the value of attribute status_checker.



7
8
9
# File 'lib/gitlab/database/health_status/context.rb', line 7

def status_checker
  @status_checker
end

#tablesObject (readonly)

Returns the value of attribute tables.



7
8
9
# File 'lib/gitlab/database/health_status/context.rb', line 7

def tables
  @tables
end

Instance Method Details

#status_checker_infoObject



18
19
20
21
22
23
24
# File 'lib/gitlab/database/health_status/context.rb', line 18

def status_checker_info
  {
    status_checker_id: status_checker.id,
    status_checker_type: status_checker.class.name,
    job_class_name: status_checker.job_class_name
  }
end