class ObservationWriter
Defined at line 23 of file ../../third_party/cobalt/src/logger/observation_writer.h
The ObservationWriter encrypts Observations and writes them to the
ObservationStore.
A system has a single instance of ObservationWriter, which is used by the
EventAggregator and multiple Loggers.
Public Methods
void ObservationWriter (observation_store::ObservationStoreWriterInterface & observation_store, observation_store::ObservationStoreUpdateRecipient * update_recipient, util::EncryptedMessageMaker * observation_encrypter)
Constructor:
|observation_store| A writer interface to the system's singleton instance of Observation Store.
This must remain valid as long as the ObservationWriter is being used.
|update_recipient| The ObservationWriter uses this to notify the update recipient when an
Observation has been added to the Observation Store. This must remain valid as long as the
ObservationWriter is being used.
|observation_encrypter| This is used to encrypt Observations to the public key of Cobalt's
Analyzer prior to writing them into the Observation Store. If this value is equal to nullptr,
then Observations will not be encrypted before being added to the Observation Store. Otherwise,
this must remain valid as long as the ObservationWriter is being used.
Defined at line 38 of file ../../third_party/cobalt/src/logger/observation_writer.h
void ObservationWriter (const ObservationWriter & )
Make ObservationWriter move-only
Defined at line 46 of file ../../third_party/cobalt/src/logger/observation_writer.h
Status WriteObservation (const std::unique_ptr<Observation> & observation, std::unique_ptr<ObservationMetadata> metadata, bool is_contribution)
Given an Observation |observation| and an ObservationMetadata |metadata|, adds a random ID to
|observation| for server-side deduplication, writes an encryption of the Observation together
with the unencrypted metadata to the Observation Store, and notifies the UpdateRecipient that
an Observation has been added to the store. If |is_contribution| is true, a random contribution
ID is added to the encrypted observation.