/usr/lib/ruby/vendor_ruby/influxdb/query/retention_policy.rb is in ruby-influxdb 0.2.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | module InfluxDB
module Query
module RetentionPolicy # :nodoc:
def create_retention_policy(name, database, duration, replication, default = false)
execute(
"CREATE RETENTION POLICY \"#{name}\" ON #{database} "\
"DURATION #{duration} REPLICATION #{replication}#{default ? ' DEFAULT' : ''}")
end
def list_retention_policies(database)
resp = execute("SHOW RETENTION POLICIES ON \"#{database}\"", parse: true)
data = fetch_series(resp).fetch(0)
data['values'].map do |policy|
policy.each.with_index.inject({}) do |hash, (value, index)|
hash.tap { |h| h[data['columns'][index]] = value }
end
end
end
def delete_retention_policy(name, database)
execute("DROP RETENTION POLICY \"#{name}\" ON #{database}")
end
def alter_retention_policy(name, database, duration, replication, default = false)
execute(
"ALTER RETENTION POLICY \"#{name}\" ON #{database} "\
"DURATION #{duration} REPLICATION #{replication}#{default ? ' DEFAULT' : ''}")
end
end
end
end
|