2022-03-04 04:17:25 +03:00
|
|
|
/*
|
|
|
|
* 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 "eden/fs/config/FieldConverter.h"
|
|
|
|
|
|
|
|
namespace facebook::eden {
|
|
|
|
|
|
|
|
enum class HgObjectIdFormat {
|
2022-10-05 01:06:11 +03:00
|
|
|
// We used to support a ProxyHash format that indexed through a LocalStore
|
|
|
|
// keyspace in order to map fixed-size IDs onto variable-size HgBackingStore
|
|
|
|
// IDs.
|
|
|
|
// EdenFS will still read IDs of that format, but will not generate them.
|
|
|
|
|
2022-03-04 04:17:25 +03:00
|
|
|
/// '1' followed by 20 bytes of hg manifest hash and then a path
|
2022-03-04 04:17:25 +03:00
|
|
|
WithPath,
|
2022-03-04 04:17:25 +03:00
|
|
|
/// '2' followed by 20 bytes of hg manifest hash
|
|
|
|
HashOnly,
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
class FieldConverter<HgObjectIdFormat> {
|
|
|
|
public:
|
|
|
|
folly::Expected<HgObjectIdFormat, std::string> fromString(
|
|
|
|
folly::StringPiece value,
|
|
|
|
const std::map<std::string, std::string>& convData) const;
|
|
|
|
|
|
|
|
std::string toDebugString(HgObjectIdFormat value) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace facebook::eden
|