9 #include "absl/strings/string_view.h" 10 #include "absl/types/variant.h" 14 template <
typename T>
class DoContext;
16 template <
typename FromType,
typename Class,
typename O>
17 using EmitMemberFn = void (Class::*)(FromType, DoContext<O>*);
19 using RawRecord = ::std::string;
21 typedef std::function<void(RawRecord&& record)> RawSinkCb;
23 template <
typename Handler,
typename ToType>
24 using RawSinkMethodFactory = std::function<RawSinkCb(Handler* handler, DoContext<ToType>* context)>;
26 struct ShardId :
public absl::variant<absl::monostate, uint32_t, std::string> {
27 using Parent = absl::variant<absl::monostate, uint32_t, std::string>;
33 std::string ToString(absl::string_view basename)
const;
35 bool is_defined()
const {
return !absl::holds_alternative<absl::monostate>(*
this); }
38 using MetricMap = std::map<std::string, long>;
42 std::ostream& operator<<(std::ostream& os,
const mr3::ShardId& sid);
46 template <>
struct hash<mr3::ShardId> {
47 size_t operator()(
const mr3::ShardId& sid)
const {
return hash<mr3::ShardId::Parent>{}(sid); }