[models] Use random GUID when creating Chunk()

This commit is contained in:
derrod 2020-05-09 11:03:14 +02:00
parent 3257b869e2
commit 2c3bfdfd3a

View file

@ -6,6 +6,7 @@ import zlib
from hashlib import sha1 from hashlib import sha1
from io import BytesIO from io import BytesIO
from uuid import uuid4
from legendary.utils.rolling_hash import get_hash from legendary.utils.rolling_hash import get_hash
@ -20,7 +21,7 @@ class Chunk:
self.compressed_size = 0 self.compressed_size = 0
self.hash = 0 self.hash = 0
self.stored_as = 0 self.stored_as = 0
self.guid = [] self.guid = struct.unpack('>IIII', uuid4().bytes)
# 0x1 = rolling hash, 0x2 = sha hash, 0x3 = both # 0x1 = rolling hash, 0x2 = sha hash, 0x3 = both
self.hash_type = 0 self.hash_type = 0