class EnvelopeHolder

Defined at line 95 of file ../../third_party/cobalt/src/observation_store/observation_store.h

EnvelopeHolder holds a reference to a single Envelope and its underlying

data storage. An instance of EnvelopeHolder is considered to own its

Envelope. When EnvelopeHolder is deleted, the underlying data storage for

the owned Envelope will be deleted. The ObservationStore considers the

envelopes owned by EnvelopeHolders to no longer be in the store.

Public Methods

void EnvelopeHolder ()

Defined at line 97 of file ../../third_party/cobalt/src/observation_store/observation_store.h

void MergeWith (std::unique_ptr<EnvelopeHolder> other)

MergeWith takes posession of the Envelope owned by |other| and merges

that EnvelopeHolder's underlying data with that of its own. After the

call completes, |other| no longer owns any Envelope and it is deleted

without deleting any underlying data.

const Envelope & GetEnvelope (util::EncryptedMessageMaker * encrypter)

Returns a const reference to the Envelope owned by this EnvelopeHolder. This is not

necessarily a cheap operation and may involve reading from disk or encrypting.

|encrypter| Is used to encrypt observations that were not encrypted when they were added to

the store. It should not be null. (n.b. It is possible that observations were added to the

store with a different EncryptedMessageMaker, in this case, the envelope that is produced

will have observations encrypted with two (or more) different EncryptedMessageMakers.)

TODO(https://fxbug.dev/278924679): Make ObservationStore *only* store unencrypted

observations.

size_t Size ()

Returns an estimated size on the wire of the resulting Envelope owned by

this EnvelopeHolder.

void MoveSystemProfilesToEnvelope (Envelope & envelope)

Adds a copy of each unique system profile to the Envelope level. Clears the system profile

from each ObservationBatch and sets the system profile index to the appropriate value based

on the system profile's location in the envelope.

Note: the ordering of the system profiles in the Envelope is dependent on the order of

batches in the Envelope, i.e. the first system profile in the Envelope will be the system

profile from the first observation batch.

void ~EnvelopeHolder ()

When this EnvelopeHolder is deleted, the underlying data will be deleted.

Defined at line 100 of file ../../third_party/cobalt/src/observation_store/observation_store.h