Storage Engine API
mongo::DataProtector Class Referenceabstract

Performs an implementation specific transformation on a series of input buffers to produce a protected form of their concatenated contents. More...

#include <data_protector.h>

Detailed Description

Performs an implementation specific transformation on a series of input buffers to produce a protected form of their concatenated contents.

protect() must be called on each input buffer, to produce a series of output buffers. The caller must ensure that the output buffers are large enough to contain the protected data resulting from the call. The caller must concatenate the output buffers together, in order. Once all input buffers have been protect()ed, finalize() must be called, and its output appended to the end of the protected data. The caller may then call finalizeTag() to get implementation defined metadata.

Public Member Functions

virtual ~DataProtector ()=default
 
virtual Status protect (const std::uint8_t *in, std::size_t inLen, std::uint8_t *out, std::size_t outLen, std::size_t *bytesWritten)=0
 Copy inLen bytes from in, process them, and write the processed bytes into out. More...
 
virtual Status finalize (std::uint8_t *out, std::size_t outLen, std::size_t *bytesWritten)=0
 Declares that this DataProtector will be provided no more data to protect. More...
 
virtual std::size_t getNumberOfBytesReservedForTag () const =0
 Returns the number of bytes reserved for metadata at the beginning of the first output buffer. More...
 
virtual Status finalizeTag (std::uint8_t *out, std::size_t outLen, std::size_t *bytesWritten)=0
 Fills buffer out of size outLen, with implementation defined metadata that had to be calculated after finalization. More...
 

Constructor & Destructor Documentation

◆ ~DataProtector()

virtual mongo::DataProtector::~DataProtector ( )
virtualdefault

Member Function Documentation

◆ finalize()

virtual Status mongo::DataProtector::finalize ( std::uint8_t *  out,
std::size_t  outLen,
std::size_t *  bytesWritten 
)
pure virtual

Declares that this DataProtector will be provided no more data to protect.

Fills out with any leftover state that needs serialization.

◆ finalizeTag()

virtual Status mongo::DataProtector::finalizeTag ( std::uint8_t *  out,
std::size_t  outLen,
std::size_t *  bytesWritten 
)
pure virtual

Fills buffer out of size outLen, with implementation defined metadata that had to be calculated after finalization.

bytesWritten is filled with the number of bytes written into out.

◆ getNumberOfBytesReservedForTag()

virtual std::size_t mongo::DataProtector::getNumberOfBytesReservedForTag ( ) const
pure virtual

Returns the number of bytes reserved for metadata at the beginning of the first output buffer.

Not all implementations will choose to reserve this space. They will return 0.

◆ protect()

virtual Status mongo::DataProtector::protect ( const std::uint8_t *  in,
std::size_t  inLen,
std::uint8_t *  out,
std::size_t  outLen,
std::size_t *  bytesWritten 
)
pure virtual

Copy inLen bytes from in, process them, and write the processed bytes into out.

As processing may produce more or fewer bytes than were provided, the actual number of bytes written will placed in bytesWritten.


The documentation for this class was generated from the following file: