MADARA
3.4.1
|
A helper class that can reconstruct files or request files be transferred in fragments from a Madara File Service (MFS) More...
#include <FileRequester.h>
Public Member Functions | |
FileRequester () | |
Constructor. More... | |
FileRequester (const std::string &prefix, const std::string &sync_key, const std::string &filename, KnowledgeBase kb, int max_request_fragments=-1) | |
Constructor. More... | |
std::vector< int64_t > | build_fragment_request (void) |
Builds fragment request to send. More... | |
void | clear_fragments (void) |
Clears any lingering file fragments. More... | |
uint32_t | get_crc (void) |
Returns the crc of the file. More... | |
std::string | get_filename (void) |
Returns the name of the file. More... | |
double | get_percent_complete (void) |
Returns the percentage of transfer that is completed. More... | |
size_t | get_size (void) |
Returns the size of the file. More... | |
void | init (const std::string &prefix, const std::string &sync_key, const std::string &filename, KnowledgeBase kb, int max_request_fragments=-1) |
Initializes the requester. More... | |
void | modify (void) |
Remodifies the file size and crc. More... | |
bool | needs_request (void) |
Builds fragment request to send. More... | |
Public Attributes | |
int | max_fragments |
the maximum fragments allowed in a resend request More... | |
Private Attributes | |
containers::Integer | file_crc_ |
the crc of the file More... | |
containers::Integer | file_size_ |
the size of the file contents More... | |
std::string | filename_ |
the name of the file on the hard drive being reconstructed More... | |
knowledge::KnowledgeBase | kb_ |
saves the kb for general usage More... | |
containers::NativeIntegerVector | sync_ |
The key that is being synced to. More... | |
A helper class that can reconstruct files or request files be transferred in fragments from a Madara File Service (MFS)
Definition at line 24 of file FileRequester.h.
|
inline |
Constructor.
Definition at line 30 of file FileRequester.h.
|
inline |
Constructor.
prefix | the prefix in the knowledge base that precedes .crc and .size keys (e.g. from MFS) |
sync_key | the key in the knowledge base that is used to send sync requests (e.g. to MFS) |
filename | the file that should be recreated from fragments |
kb | the knowledge base where the sync key is located at |
max_request_fragments | the most fragments that can be requested in a single send_modifieds |
Definition at line 43 of file FileRequester.h.
|
inline |
Builds fragment request to send.
Definition at line 144 of file FileRequester.h.
|
inline |
Clears any lingering file fragments.
Definition at line 187 of file FileRequester.h.
|
inline |
Returns the crc of the file.
Definition at line 89 of file FileRequester.h.
|
inline |
Returns the name of the file.
Definition at line 107 of file FileRequester.h.
|
inline |
Returns the percentage of transfer that is completed.
Definition at line 116 of file FileRequester.h.
|
inline |
Returns the size of the file.
Definition at line 98 of file FileRequester.h.
|
inline |
Initializes the requester.
prefix | the prefix in the knowledge base that precedes .crc and .size keys (e.g. from MFS) |
sync_key | the key in the knowledge base that is used to send sync requests (e.g. to MFS) |
filename | the file to open and read from |
kb | the knowledge base to stream to |
max_request_fragments | the most fragments that can be requested in a single send_modifieds |
Definition at line 61 of file FileRequester.h.
|
inline |
Remodifies the file size and crc.
Definition at line 217 of file FileRequester.h.
|
inline |
Builds fragment request to send.
If the return is true, call send_modifieds on the KB to send the request.
Definition at line 155 of file FileRequester.h.
|
private |
the crc of the file
Definition at line 235 of file FileRequester.h.
|
private |
the size of the file contents
Definition at line 232 of file FileRequester.h.
|
private |
the name of the file on the hard drive being reconstructed
Definition at line 238 of file FileRequester.h.
|
private |
saves the kb for general usage
Definition at line 241 of file FileRequester.h.
int madara::knowledge::FileRequester::max_fragments |
the maximum fragments allowed in a resend request
Definition at line 223 of file FileRequester.h.
|
private |
The key that is being synced to.
Definition at line 229 of file FileRequester.h.