class PrivacyEncoder
Defined at line 27 of file ../../third_party/cobalt/src/logger/privacy_encoder.h
The PrivacyEncoder is used by the ObservationGenerator to add privacy to
Observations (of any non-private observation type) generated by local
aggregation procedures. The PrivateIndexObservations produced by the
PrivacyEncoder are then written to the ObservationStore by the
ObservationGenerator's ObservationWriter.
|secure_gen| is used to perform the privacy encoding and therefore needs to be cryptographically
secure.
|gen| is used to perform non-deterministic encodings prior to the privacy encoding and therefore
does not need to be cryptographically secure.
Public Methods
void PrivacyEncoder (std::unique_ptr<SecureBitGeneratorInterface<uint32_t>> secure_gen, std::unique_ptr<BitGeneratorInterface<uint32_t>> gen)
std::unique_ptr<PrivacyEncoder> MakeSecurePrivacyEncoder ()
Returns a PrivacyEncoder with a private random number generator.
lib::statusor::StatusOr<std::vector<std::unique_ptr<Observation>>> MaybeMakePrivateObservations (std::unique_ptr<Observation> observation, const MetricDefinition & metric_def, const ReportDefinition & report_def)
If the report definition does not specify a privacy level, MaybeMakeObservations returns
|observation|. Else, MaybeMakeObservations transforms a user contribution for a local
aggregation period into a list of private observations. If the local aggregation produced an
Observation for the period, then this should be passed as
|observation|. If not (i.e. if no events were logged during the
aggregation period), then |observation| should be nullptr.
lib::statusor::StatusOr<uint64_t> MaxIndexForReport (const MetricDefinition & metric_def, const ReportDefinition & report_def)
Returns the maximum index of a PrivateIndexObservation for the metric and report specified by
|metric_def| and |report_def|.
lib::statusor::StatusOr<uint32_t> GetNumHistogramBuckets (const IntegerBuckets & int_buckets)
Returns the number of histogram buckets associated to an IntegerBuckets, including the
underflow and overflow buckets.
lib::statusor::StatusOr<size_t> GetNumCountMinCellsPerHash (const ReportDefinition & report_def)
The number of sketch cells per hash function in CountMin sketch for a StringCounts or a
UniqueDeviceStringCounts report |report_def|. Currently hard-coded to 10. Returns an error
status if |report_def| is not of type StringCounts or UniqueDeviceStringCounts.
lib::statusor::StatusOr<size_t> GetNumCountMinHashes (const ReportDefinition & report_def)
The number of hash functions in a CountMin sketch for a StringCounts or a
UniqueDeviceStringCounts report |report_def|. Currently hard-coded to 5. Returns an error
status if |report_def| is not of type StringCounts or UniqueDeviceStringCounts.
void ~PrivacyEncoder ()
Defined at line 35 of file ../../third_party/cobalt/src/logger/privacy_encoder.h
Friends
class PrivacyEncoderTest