Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cSyncBuilder Class Reference

#include <cSyncDir.h>

Inheritance diagram for GrayLib::cSyncBuilder:
GrayLib::cManifestBuilder

Public Member Functions

 cSyncBuilder (cSyncContext &context)
 
virtual ~cSyncBuilder ()
 
bool isEstimateComplete () const
 
HRESULT BuildOpList (const FILECHAR_t *pszRelativePath=nullptr, CSYNC_TYPE eSyncType=CSYNC_Pull)
 
- Public Member Functions inherited from GrayLib::cManifestBuilder
 cManifestBuilder (cManifestContext &context)
 
virtual ~cManifestBuilder ()
 
HRESULT DoBuildManifest (const FILECHAR_t *pszRelativePath=nullptr)
 
 UNITTEST_FRIEND (cManifestDir)
 

Public Attributes

cSyncContextm_Context
 
bool m_bRootOnly
 just sync the root only. don't descend child dirs. More...
 
CSYNC_TYPE m_eSyncType
 What type of sync do i want to perform. More...
 
cArraySortString< FILECHAR_tm_aLockedFiles
 Files/Directories to be ignored. (NOT synced even tho the manifest says they should be) More...
 
cStreamProgress m_Remote
 Total bytes declared in the top level server/remote manifest. >= m_Context.m_Rx. More...
 
cStreamProgress m_Local
 Total bytes declared in the top level local/client manifest. >= m_Context.m_Tx. More...
 
bool m_bEstimateComplete
 the estimation pass is complete. m_Context.m_Rx and m_Context.m_Tx are set. More...
 
- Public Attributes inherited from GrayLib::cManifestBuilder
cManifestContextm_Context
 Config info regarding my root and preferences. More...
 
bool m_bTrustCRC
 trust manifest CRC if file matches by date & size. so don't bother recalculating CRC. default=true. More...
 
cArraySortString< FILECHAR_t > * m_pChangeList
 Don't trust these paths. Assume they have changed. nullptr = descend all directories. More...
 
int m_iChanges
 Count changes for the last DoBuildManifest. More...
 

Protected Member Functions

HRESULT UpdateProgress ()
 
void BuildOpAdd (cSyncOp *pOp)
 
HRESULT BuildOpDir2 (cSyncOp *pOpDir, COMPARE_t iComp, cManifestElem *pFileElem)
 
HRESULT BuildOpElem (cSyncOp *pOpDir, const cManifestDir &manLocal, cManifestElem *pFileRemote, cManifestElem *pFileLocal)
 
HRESULT BuildOpDir (cSyncOp *pOpDir)
 
- Protected Member Functions inherited from GrayLib::cManifestBuilder
bool isTrustedDir (const FILECHAR_t *pszDirPath) const
 
virtual HRESULT onFilePrep (cManifestDir *pManLocal, cFileFindEntry &FileEntry, cManifestElem *pElementOld)
 override these to process the manifests differently. More...
 
virtual HRESULT onDirComplete (cManifestDir *pManLocal, HRESULT hRes)
 
virtual HRESULT onChangeManifest (cManifestDir *pManLocal, const FILECHAR_t *pszElemName)
 

Additional Inherited Members

- Protected Attributes inherited from GrayLib::cManifestBuilder
cStreamProgressF m_ManProgress
 How far into processing the full tree are we? More...
 

Detailed Description

Build the list of commands/operations to do for the sync. build manifests as well if needed. This estimates the amount of work to do. Sets m_Context.m_Rx and m_Context.m_Tx. Similar to linux "rsync"

Constructor & Destructor Documentation

◆ cSyncBuilder()

GrayLib::cSyncBuilder::cSyncBuilder ( cSyncContext context)

◆ ~cSyncBuilder()

GrayLib::cSyncBuilder::~cSyncBuilder ( )
virtual

Member Function Documentation

◆ BuildOpAdd()

void GrayLib::cSyncBuilder::BuildOpAdd ( cSyncOp pOp)
protected

Add this operation to the list of things we should do. Estimate the total bytes requested/sent to/from server.

◆ BuildOpDir()

HRESULT GrayLib::cSyncBuilder::BuildOpDir ( cSyncOp pOpDir)
protected

create/sync a remote directory that may not yet exist locally the Remote/Server list = files as they should be (read Remote manifest from the server) Sync this against the local files.

Returns
S_OK = no changes.

0 = changes

ERROR_REQUEST_ABORTED = canceled. ERROR_PATH_NOT_FOUND, ERROR_FILE_NOT_FOUND = doesn't exist on one side or the other. HRESULT_WIN32_C(ERROR_INVALID_TABLE) = corrupt file.

◆ BuildOpDir2()

HRESULT GrayLib::cSyncBuilder::BuildOpDir2 ( cSyncOp pOpDir,
COMPARE_t  iComp,
cManifestElem pFileElem 
)
protected
Returns
S_OK = NO changes. >0 = Number of changes

◆ BuildOpElem()

HRESULT GrayLib::cSyncBuilder::BuildOpElem ( cSyncOp pOpDir,
const cManifestDir manLocal,
cManifestElem pFileRemote,
cManifestElem pFileLocal 
)
protected

test if we should move a single file/dir to/from the server.

  • pFileLocal = can be null. (if didn't exist locally yet)
    Returns
    S_OK = NO changes. >0 = Number of changes, it changed pFileLocal. (or pFileLocal = nullptr)
    Tell the remote/server to delete its copy of a file or directory.

◆ BuildOpList()

HRESULT GrayLib::cSyncBuilder::BuildOpList ( const FILECHAR_t pszRelativePath = nullptr,
CSYNC_TYPE  eSyncType = CSYNC_Pull 
)

First pass. estimate how much to move. ASSUME Local manifests are valid. m_pRemoteConnect = the underlying connection can be XProtocol, HTTP, File, FTP?

Returns
S_OK = NO changes. >0 = Number of changes ERROR_REQUEST_ABORTED = canceled.

◆ isEstimateComplete()

bool GrayLib::cSyncBuilder::isEstimateComplete ( ) const
inline

Estimation pass is complete?

Returns
true = exec ops to move files, false = still building the op list.

◆ UpdateProgress()

HRESULT GrayLib::cSyncBuilder::UpdateProgress ( )
protected

Push progress to a subscriber. Get total progress for cSyncBuilder.

Member Data Documentation

◆ m_aLockedFiles

cArraySortString<FILECHAR_t> GrayLib::cSyncBuilder::m_aLockedFiles

Files/Directories to be ignored. (NOT synced even tho the manifest says they should be)

◆ m_bEstimateComplete

bool GrayLib::cSyncBuilder::m_bEstimateComplete

the estimation pass is complete. m_Context.m_Rx and m_Context.m_Tx are set.

◆ m_bRootOnly

bool GrayLib::cSyncBuilder::m_bRootOnly

just sync the root only. don't descend child dirs.

◆ m_Context

cSyncContext& GrayLib::cSyncBuilder::m_Context

◆ m_eSyncType

CSYNC_TYPE GrayLib::cSyncBuilder::m_eSyncType

What type of sync do i want to perform.

◆ m_Local

cStreamProgress GrayLib::cSyncBuilder::m_Local

Total bytes declared in the top level local/client manifest. >= m_Context.m_Tx.

◆ m_Remote

cStreamProgress GrayLib::cSyncBuilder::m_Remote

Total bytes declared in the top level server/remote manifest. >= m_Context.m_Rx.


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