MADARA  3.4.1
madara::knowledge::FileHeader Class Reference

Defines a file header which is the default for KaRL checkpointing. More...

#include <FileHeader.h>

Public Member Functions

 FileHeader ()
 Constructor. More...
 
virtual ~FileHeader ()
 Destructor. More...
 
virtual bool equals (const FileHeader &other)
 Compares the fields of this instance to another instance. More...
 
virtual const char * read (const char *buffer, int64_t &buffer_remaining)
 Reads a FileHeader instance from a buffer and updates the amount of buffer room remaining. More...
 
virtual char * write (char *buffer, int64_t &buffer_remaining)
 Writes a FileHeader instance to a buffer and updates the amount of buffer room remaining. More...
 

Static Public Member Functions

static uint32_t encoded_size (void)
 Returns the size of the encoded FileHeader class, which may be different from sizeof (FileHeader) because of compiler optimizations for word boundaries. More...
 
static bool file_header_test (const char *buffer)
 Tests the buffer for a normal message identifier. More...
 

Public Attributes

char file_type [8]
 file type identifier ("KaRL1.5") More...
 
uint64_t initial_timestamp
 the timestamp for the initial checkpointing More...
 
uint32_t karl_version
 Version of KaRL installed when file was created. More...
 
uint64_t last_timestamp
 the timestamp for the last checkpoint More...
 
char originator [64]
 the originator of the message (host:port) More...
 
uint64_t size
 the size of this header plus the updates More...
 
uint64_t states
 the number of states checkpointed in the file stream More...
 

Detailed Description

Defines a file header which is the default for KaRL checkpointing.

Format:

[00] [64 bit file size]
[08] [64 bit states]
[16] [64 bit timestamp]
[24] [64 bit last_timestamp]
[32] [8 byte file_type = "KaRL1.5"]
[40] [32 bit karl_version = version (0.255.255.255)]
[44] [64 byte id = originator]
[108] [Updates]

Definition at line 36 of file FileHeader.h.

Constructor & Destructor Documentation

◆ FileHeader()

madara::knowledge::FileHeader::FileHeader ( )

Constructor.

Definition at line 9 of file FileHeader.cpp.

◆ ~FileHeader()

madara::knowledge::FileHeader::~FileHeader ( )
virtual

Destructor.

Definition at line 24 of file FileHeader.cpp.

Member Function Documentation

◆ encoded_size()

uint32_t madara::knowledge::FileHeader::encoded_size ( void  )
static

Returns the size of the encoded FileHeader class, which may be different from sizeof (FileHeader) because of compiler optimizations for word boundaries.

Definition at line 26 of file FileHeader.cpp.

◆ equals()

bool madara::knowledge::FileHeader::equals ( const FileHeader other)
virtual

Compares the fields of this instance to another instance.

Parameters
otherthe other instance to compare against
Returns
true if equal, false otherwise

Definition at line 297 of file FileHeader.cpp.

◆ file_header_test()

static bool madara::knowledge::FileHeader::file_header_test ( const char *  buffer)
inlinestatic

Tests the buffer for a normal message identifier.

Returns
true if identifier indicates reduced message header

Definition at line 89 of file FileHeader.h.

◆ read()

const char * madara::knowledge::FileHeader::read ( const char *  buffer,
int64_t &  buffer_remaining 
)
virtual

Reads a FileHeader instance from a buffer and updates the amount of buffer room remaining.

Parameters
bufferthe readable buffer where data is stored
buffer_remainingthe count of bytes remaining in the buffer to read
Returns
current buffer position for next read
Exceptions
exceptions::MemoryExceptionnot enough buffer to encode

Definition at line 31 of file FileHeader.cpp.

◆ write()

char * madara::knowledge::FileHeader::write ( char *  buffer,
int64_t &  buffer_remaining 
)
virtual

Writes a FileHeader instance to a buffer and updates the amount of buffer room remaining.

Parameters
bufferthe readable buffer where data is stored
buffer_remainingthe count of bytes remaining in the buffer to read
Returns
current buffer position for next write
Exceptions
exceptions::MemoryExceptionnot enough buffer to encode

Definition at line 164 of file FileHeader.cpp.

Member Data Documentation

◆ file_type

char madara::knowledge::FileHeader::file_type[8]

file type identifier ("KaRL1.5")

Definition at line 117 of file FileHeader.h.

◆ initial_timestamp

uint64_t madara::knowledge::FileHeader::initial_timestamp

the timestamp for the initial checkpointing

Definition at line 107 of file FileHeader.h.

◆ karl_version

uint32_t madara::knowledge::FileHeader::karl_version

Version of KaRL installed when file was created.

Definition at line 122 of file FileHeader.h.

◆ last_timestamp

uint64_t madara::knowledge::FileHeader::last_timestamp

the timestamp for the last checkpoint

Definition at line 112 of file FileHeader.h.

◆ originator

char madara::knowledge::FileHeader::originator[64]

the originator of the message (host:port)

Definition at line 127 of file FileHeader.h.

◆ size

uint64_t madara::knowledge::FileHeader::size

the size of this header plus the updates

Definition at line 97 of file FileHeader.h.

◆ states

uint64_t madara::knowledge::FileHeader::states

the number of states checkpointed in the file stream

Definition at line 102 of file FileHeader.h.


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