def create(opts={})
step = (opts[:step] || 300).to_s
start = (opts[:start] || Time.now.to_i - 10).to_s
options = ["--step", step, "--start", start]
sources = opts[:sources].map { |source|
name = source[:name]
type = source[:type].to_s.upcase
heartbeat = source[:heartbeat]
min = source[:min]
max = source[:max]
ds = ["DS", name, type]
ds += [heartbeat, min, max] if heartbeat && min && max
ds.join(':')
}
archives = opts[:archives].map { |archive|
function = archive[:function].to_s.upcase
xff = archive[:xff]
steps = archive[:steps]
rows = archive[:rows]
rra = ["RRA", function]
rra += [xff, steps, rows] if xff && steps && rows
rra.join(':')
}
args = options + sources + archives
@backend.create(@filename, *args)
true
end