sapling/eden/fs/model/BlobMetadata.h
Barys Skarabahaty 0a29c16672 Remove default ctor from BlobMetadata
Summary: Removing the previous default ctor to ensure that we always compute and pass blake3.

Reviewed By: chadaustin

Differential Revision: D46268716

fbshipit-source-id: d9bfbc7bfd07b61dbb2e915c3fe72d7526d919e1
2023-06-05 23:41:35 -07:00

37 lines
908 B
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <cstdint>
#include <optional>
#include "eden/fs/model/BlobMetadataFwd.h"
#include "eden/fs/model/Hash.h"
namespace facebook::eden {
/**
* A small struct containing both the size, the SHA-1 hash and Blake3 hash of
* a Blob's contents.
*/
class BlobMetadata {
public:
BlobMetadata(Hash20 sha1, Hash32 blake3, uint64_t fileLength)
: sha1(std::move(sha1)), blake3(std::move(blake3)), size(fileLength) {}
BlobMetadata(Hash20 sha1, std::optional<Hash32> blake3, uint64_t fileLength)
: sha1(std::move(sha1)), blake3(std::move(blake3)), size(fileLength) {}
Hash20 sha1;
// TODO: make it non optional
std::optional<Hash32> blake3;
uint64_t size;
};
} // namespace facebook::eden