ovirt_metrics 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/column.rb +15 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/database_statements.rb +170 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/explain_pretty_printer.rb +42 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/array.rb +70 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/bit.rb +52 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/bit_varying.rb +13 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/bytea.rb +15 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/cidr.rb +48 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/date_time.rb +21 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/decimal.rb +13 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/enum.rb +19 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/hstore.rb +59 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/inet.rb +13 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/json.rb +10 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/jsonb.rb +23 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/money.rb +39 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/point.rb +43 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/rails_5_1_point.rb +50 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/range.rb +93 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/specialized_string.rb +15 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/type_map_initializer.rb +109 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/uuid.rb +21 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/vector.rb +26 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/xml.rb +28 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid.rb +31 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/quoting.rb +116 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/referential_integrity.rb +49 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/schema_definitions.rb +180 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/schema_dumper.rb +47 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/schema_statements.rb +682 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/type_metadata.rb +35 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/utils.rb +77 -0
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql_adapter.rb +856 -0
- data/lib/{models → ovirt_metrics/models}/calendar.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/cluster_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/datacenter_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/datacenter_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/datacenter_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/datacenter_samples_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/datacenter_storage_domain_map.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/disks_vm_map.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/enum_translator.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/history_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_interface_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_interface_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_interface_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_interface_samples_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/host_samples_history.rb +0 -0
- data/lib/ovirt_metrics/models/ovirt_history.rb +12 -0
- data/lib/{models → ovirt_metrics/models}/period.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/storage_domain_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/storage_domain_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/storage_domain_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/storage_domain_samples_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/tag_details.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/tag_relations_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disk_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disk_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disk_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disk_samples_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disks_usage_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disks_usage_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_disks_usage_samples_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_interface_configuration.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_interface_daily_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_interface_hourly_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_interface_samples_history.rb +0 -0
- data/lib/{models → ovirt_metrics/models}/vm_samples_history.rb +0 -0
- data/lib/ovirt_metrics/version.rb +1 -1
- data/lib/ovirt_metrics.rb +11 -3
- metadata +114 -47
- data/lib/models/ovirt_history.rb +0 -24
@@ -0,0 +1,35 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
class OvirtLegacyPostgreSQLTypeMetadata < DelegateClass(SqlTypeMetadata)
|
4
|
+
attr_reader :oid, :fmod, :array
|
5
|
+
|
6
|
+
def initialize(type_metadata, oid: nil, fmod: nil)
|
7
|
+
super(type_metadata)
|
8
|
+
@type_metadata = type_metadata
|
9
|
+
@oid = oid
|
10
|
+
@fmod = fmod
|
11
|
+
@array = /\[\]$/ === type_metadata.sql_type
|
12
|
+
end
|
13
|
+
|
14
|
+
def sql_type
|
15
|
+
super.gsub(/\[\]$/, "".freeze)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ==(other)
|
19
|
+
other.is_a?(OvirtLegacyPostgreSQLTypeMetadata) &&
|
20
|
+
attributes_for_hash == other.attributes_for_hash
|
21
|
+
end
|
22
|
+
alias eql? ==
|
23
|
+
|
24
|
+
def hash
|
25
|
+
attributes_for_hash.hash
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def attributes_for_hash
|
31
|
+
[self.class, @type_metadata, oid, fmod]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
module OvirtLegacyPostgreSQL
|
4
|
+
# Value Object to hold a schema qualified name.
|
5
|
+
# This is usually the name of a PostgreSQL relation but it can also represent
|
6
|
+
# schema qualified type names. +schema+ and +identifier+ are unquoted to prevent
|
7
|
+
# double quoting.
|
8
|
+
class Name # :nodoc:
|
9
|
+
SEPARATOR = "."
|
10
|
+
attr_reader :schema, :identifier
|
11
|
+
|
12
|
+
def initialize(schema, identifier)
|
13
|
+
@schema, @identifier = unquote(schema), unquote(identifier)
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
parts.join SEPARATOR
|
18
|
+
end
|
19
|
+
|
20
|
+
def quoted
|
21
|
+
if schema
|
22
|
+
PGconn.quote_ident(schema) << SEPARATOR << PGconn.quote_ident(identifier)
|
23
|
+
else
|
24
|
+
PGconn.quote_ident(identifier)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def ==(o)
|
29
|
+
o.class == self.class && o.parts == parts
|
30
|
+
end
|
31
|
+
alias_method :eql?, :==
|
32
|
+
|
33
|
+
def hash
|
34
|
+
parts.hash
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
def unquote(part)
|
39
|
+
if part && part.start_with?('"')
|
40
|
+
part[1..-2]
|
41
|
+
else
|
42
|
+
part
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def parts
|
47
|
+
@parts ||= [@schema, @identifier].compact
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
module Utils # :nodoc:
|
52
|
+
extend self
|
53
|
+
|
54
|
+
# Returns an instance of <tt>ActiveRecord::ConnectionAdapters::PostgreSQL::Name</tt>
|
55
|
+
# extracted from +string+.
|
56
|
+
# +schema+ is nil if not specified in +string+.
|
57
|
+
# +schema+ and +identifier+ exclude surrounding quotes (regardless of whether provided in +string+)
|
58
|
+
# +string+ supports the range of schema/table references understood by PostgreSQL, for example:
|
59
|
+
#
|
60
|
+
# * <tt>table_name</tt>
|
61
|
+
# * <tt>"table.name"</tt>
|
62
|
+
# * <tt>schema_name.table_name</tt>
|
63
|
+
# * <tt>schema_name."table.name"</tt>
|
64
|
+
# * <tt>"schema_name".table_name</tt>
|
65
|
+
# * <tt>"schema.name"."table name"</tt>
|
66
|
+
def extract_schema_qualified_name(string)
|
67
|
+
schema, table = string.scan(/[^".\s]+|"[^"]*"/)
|
68
|
+
if table.nil?
|
69
|
+
table = schema
|
70
|
+
schema = nil
|
71
|
+
end
|
72
|
+
OvirtLegacyPostgreSQL::Name.new(schema, table)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|