Empty non-persisted parts of record on save

Some of the manifest should not be preserved between restarts - so empty
these parts on save
This commit is contained in:
martinsumner 2017-01-17 17:15:04 +00:00
parent c098eca06e
commit 6298886592

View file

@ -123,7 +123,9 @@ close_manifest(Manifest, CloseEntryFun) ->
save_manifest(Manifest, RootPath) -> save_manifest(Manifest, RootPath) ->
FP = filepath(RootPath, Manifest#manifest.manifest_sqn, current_manifest), FP = filepath(RootPath, Manifest#manifest.manifest_sqn, current_manifest),
ManBin = term_to_binary(Manifest), ManBin = term_to_binary(Manifest#manifest{snapshots = [],
pending_deletes = dict:new(),
min_snapshot_sqn = 0}),
CRC = erlang:crc32(ManBin), CRC = erlang:crc32(ManBin),
ok = file:write_file(FP, <<CRC:32/integer, ManBin/binary>>). ok = file:write_file(FP, <<CRC:32/integer, ManBin/binary>>).