TrinityCore
UpdateFetcher Class Reference

#include <UpdateFetcher.h>

Classes

struct  AppliedFileEntry
 
struct  DirectoryEntry
 
struct  PathCompare
 

Public Member Functions

 UpdateFetcher (Path const &updateDirectory, std::function< void(std::string const &)> const &apply, std::function< void(Path const &path)> const &applyFile, std::function< QueryResult(std::string const &)> const &retrieve)
 
 ~UpdateFetcher ()
 
UpdateResult Update (bool const redundancyChecks, bool const allowRehash, bool const archivedRedundancy, int32 const cleanDeadReferencesMaxCount) const
 

Private Types

enum  UpdateMode { MODE_APPLY , MODE_REHASH }
 
enum  State { RELEASED , ARCHIVED }
 
typedef boost::filesystem::path Path
 
typedef std::pair< Path, StateLocaleFileEntry
 
typedef std::set< LocaleFileEntry, PathCompareLocaleFileStorage
 
typedef std::unordered_map< std::string, std::string > HashToFileNameStorage
 
typedef std::unordered_map< std::string, AppliedFileEntryAppliedFileStorage
 
typedef std::vector< UpdateFetcher::DirectoryEntryDirectoryStorage
 

Private Member Functions

LocaleFileStorage GetFileList () const
 
void FillFileListRecursively (Path const &path, LocaleFileStorage &storage, State const state, uint32 const depth) const
 
DirectoryStorage ReceiveIncludedDirectories () const
 
AppliedFileStorage ReceiveAppliedFiles () const
 
std::string ReadSQLUpdate (Path const &file) const
 
uint32 Apply (Path const &path) const
 
void UpdateEntry (AppliedFileEntry const &entry, uint32 const speed=0) const
 
void RenameEntry (std::string const &from, std::string const &to) const
 
void CleanUp (AppliedFileStorage const &storage) const
 
void UpdateState (std::string const &name, State const state) const
 

Private Attributes

std::unique_ptr< Path > const _sourceDirectory
 
std::function< void(std::string const &)> const _apply
 
std::function< void(Path const &path)> const _applyFile
 
std::function< QueryResult(std::string const &)> const _retrieve
 

Detailed Description

Definition at line 49 of file UpdateFetcher.h.

Member Typedef Documentation

◆ AppliedFileStorage

typedef std::unordered_map<std::string, AppliedFileEntry> UpdateFetcher::AppliedFileStorage
private

Definition at line 116 of file UpdateFetcher.h.

◆ DirectoryStorage

Definition at line 117 of file UpdateFetcher.h.

◆ HashToFileNameStorage

typedef std::unordered_map<std::string, std::string> UpdateFetcher::HashToFileNameStorage
private

Definition at line 115 of file UpdateFetcher.h.

◆ LocaleFileEntry

typedef std::pair<Path, State> UpdateFetcher::LocaleFileEntry
private

Definition at line 107 of file UpdateFetcher.h.

◆ LocaleFileStorage

Definition at line 114 of file UpdateFetcher.h.

◆ Path

typedef boost::filesystem::path UpdateFetcher::Path
private

Definition at line 51 of file UpdateFetcher.h.

Member Enumeration Documentation

◆ State

enum UpdateFetcher::State
private
Enumerator
RELEASED 
ARCHIVED 

Definition at line 70 of file UpdateFetcher.h.

◆ UpdateMode

Enumerator
MODE_APPLY 
MODE_REHASH 

Definition at line 64 of file UpdateFetcher.h.

Constructor & Destructor Documentation

◆ UpdateFetcher()

UpdateFetcher::UpdateFetcher ( Path const &  updateDirectory,
std::function< void(std::string const &)> const &  apply,
std::function< void(Path const &path)> const &  applyFile,
std::function< QueryResult(std::string const &)> const &  retrieve 
)

Definition at line 40 of file UpdateFetcher.cpp.

◆ ~UpdateFetcher()

UpdateFetcher::~UpdateFetcher ( )

Definition at line 49 of file UpdateFetcher.cpp.

Member Function Documentation

◆ Apply()

uint32 UpdateFetcher::Apply ( Path const &  path) const
private

Definition at line 348 of file UpdateFetcher.cpp.

+ Here is the caller graph for this function:

◆ CleanUp()

void UpdateFetcher::CleanUp ( AppliedFileStorage const &  storage) const
private

Definition at line 390 of file UpdateFetcher.cpp.

+ Here is the caller graph for this function:

◆ FillFileListRecursively()

void UpdateFetcher::FillFileListRecursively ( Path const &  path,
LocaleFileStorage storage,
State const  state,
uint32 const  depth 
) const
private

Definition at line 63 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFileList()

UpdateFetcher::LocaleFileStorage UpdateFetcher::GetFileList ( ) const
private

Definition at line 53 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadSQLUpdate()

std::string UpdateFetcher::ReadSQLUpdate ( Path const &  file) const
private

Definition at line 152 of file UpdateFetcher.cpp.

+ Here is the caller graph for this function:

◆ ReceiveAppliedFiles()

UpdateFetcher::AppliedFileStorage UpdateFetcher::ReceiveAppliedFiles ( ) const
private

Definition at line 130 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReceiveIncludedDirectories()

UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories ( ) const
private

Definition at line 96 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenameEntry()

void UpdateFetcher::RenameEntry ( std::string const &  from,
std::string const &  to 
) const
private

Definition at line 371 of file UpdateFetcher.cpp.

+ Here is the caller graph for this function:

◆ Update()

UpdateResult UpdateFetcher::Update ( bool const  redundancyChecks,
bool const  allowRehash,
bool const  archivedRedundancy,
int32 const  cleanDeadReferencesMaxCount 
) const

Definition at line 175 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:

◆ UpdateEntry()

void UpdateFetcher::UpdateEntry ( AppliedFileEntry const &  entry,
uint32 const  speed = 0 
) const
private

Definition at line 362 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateState()

void UpdateFetcher::UpdateState ( std::string const &  name,
State const  state 
) const
private

Definition at line 413 of file UpdateFetcher.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _apply

std::function<void(std::string const&)> const UpdateFetcher::_apply
private

Definition at line 138 of file UpdateFetcher.h.

◆ _applyFile

std::function<void(Path const& path)> const UpdateFetcher::_applyFile
private

Definition at line 139 of file UpdateFetcher.h.

◆ _retrieve

std::function<QueryResult(std::string const&)> const UpdateFetcher::_retrieve
private

Definition at line 140 of file UpdateFetcher.h.

◆ _sourceDirectory

std::unique_ptr<Path> const UpdateFetcher::_sourceDirectory
private

Definition at line 136 of file UpdateFetcher.h.


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