fix(backend): отдавать контрольную сумму оригинала в ответе на загрузку
Ответ на загрузку и публикуемое событие теперь несут хеш сохранённого объекта, чтобы клиент синхронизации мог сверить принятые байты со своим файлом и только после этого удалять прежнюю версию элемента.
This commit is contained in:
@@ -216,6 +216,9 @@ func (s *Service) Upload(ctx context.Context, in UploadInput) (*models.Photo, er
|
||||
Height: height,
|
||||
Checksum: hex.EncodeToString(hasher.Sum(nil)),
|
||||
}
|
||||
// The response and the published event carry the checksum the object ledger
|
||||
// holds, so a client can match its local file against the stored bytes.
|
||||
p.OriginalChecksum = obj.Checksum
|
||||
|
||||
// The metadata layer is the ledger of record: the row is written first,
|
||||
// then the bytes are stored, then the object is activated.
|
||||
|
||||
Reference in New Issue
Block a user