diaspora/lib/diaspora/exporter.rb
cmrd Senya c6ed850a85
Memory usage optimization for archive export
- Removed posts and non contacts from other's data
- Collections are exported in batches to lower memory footprint
- In base exporters create User object instead of keeping instance because it caches all associations

closes #7627
2017-09-26 04:07:18 +02:00

27 lines
583 B
Ruby

# frozen_string_literal: true
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module Diaspora
class Exporter
SERIALIZED_VERSION = "2.0"
def initialize(user)
@user = user
end
def execute
JSON.generate full_archive
end
private
def full_archive
{version: SERIALIZED_VERSION}
.merge(Export::UserSerializer.new(@user.id).as_json)
.merge(Export::OthersDataSerializer.new(@user.id).as_json)
end
end
end