@config = YAML.load(File.read(config))
@state = YAML.load(File.read(@config["state_file"]))
@conn = PGconn.connect(@config["db"])
@config = YAML.load(File.read(config))
@state = YAML.load(File.read(@config["state_file"]))
@conn = PGconn.connect(@config["db"])
# pretty much all operations on a changeset will modify its closed_at
# time (see rails_port's changeset model). so it is probably enough
# for us to look at anything that was closed recently, and filter from
# pretty much all operations on a changeset will modify its closed_at
# time (see rails_port's changeset model). so it is probably enough
# for us to look at anything that was closed recently, and filter from
@config["data_dir"] + format("/%03d/%03d/%03d", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000))
end
@config["data_dir"] + format("/%03d/%03d/%03d", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000))
end
data_file = data_stem + ".osm.gz"
tmp_state = @config["state_file"] + ".tmp"
tmp_data = data_file + ".tmp"
FileUtils.mkdir_p(File.dirname(data_file))
Zlib::GzipWriter.open(tmp_data) do |fh|
data_file = data_stem + ".osm.gz"
tmp_state = @config["state_file"] + ".tmp"
tmp_data = data_file + ".tmp"
FileUtils.mkdir_p(File.dirname(data_file))
Zlib::GzipWriter.open(tmp_data) do |fh|
end
File.open(tmp_state, "w") do |fh|
fh.write(YAML.dump(@state))
end
File.open(tmp_state, "w") do |fh|
fh.write(YAML.dump(@state))
# move them into place later, to avoid in-progress
# clashes, or people seeing incomplete files.
begin
# move them into place later, to avoid in-progress
# clashes, or people seeing incomplete files.
begin