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

#include <cSyncDir.h>

Inheritance diagram for GrayLib::cSyncDir:
Gray::IStreamProgressCallback

Public Member Functions

 cSyncDir (cSyncContext &context)
 
virtual ~cSyncDir ()
 
HRESULT ExecSyncOps ()
 
- Public Member Functions inherited from Gray::IStreamProgressCallback
virtual ~ IStreamProgressCallback ()
 

Public Attributes

cSyncContextm_Context
 
bool m_bRecycleDeletes
 send deletes to the recycle bin. More...
 
FILE_SIZE_t m_RxPrev
 How many bytes to move? (on ExecSyncOps) More...
 
FILE_SIZE_t m_TxPrev
 previous to the IStreamProgressCallback callback. More...
 

Static Public Attributes

static const LOGCHAR_t sm_szFileInLimbo [] = "Can't sync file in use."
 file is placed in sm_szLimboDir More...
 

Protected Member Functions

virtual HRESULT _stdcall onProgressCallback (const cStreamProgress &progress) override
 
HRESULT DoOp_LocalAttr (cManifestDir *pManLocal)
 
HRESULT DoOp_PullFromRemote (cManifestDir *pManLocal)
 
HRESULT DoOp_LocalDelete (cManifestDir *pManLocal)
 
HRESULT DoOp_RemoteAttr ()
 
HRESULT DoOp_PushToRemote ()
 
HRESULT DoOp_RemoteDelete ()
 
HRESULT DoOp_Dir ()
 
HRESULT ExecSyncOp (cManifestDir *pManLocal, cSyncOp *pOp)
 

Protected Attributes

cSyncOpPtr m_pOpCur
 the current operation/action for ExecSyncOp. More...
 

Detailed Description

Sync 2 directories. a local and remote. may be a large list of operations. Assume manifests exist for all files before we start. We must rebuild the manifests when we are done. IStreamProgressCallback = status of the sub operations. Similar to linux "rsync"

Note
TODO warn if I appear to be overwriting newer files ?

Constructor & Destructor Documentation

◆ cSyncDir()

GrayLib::cSyncDir::cSyncDir ( cSyncContext context)

◆ ~cSyncDir()

GrayLib::cSyncDir::~cSyncDir ( )
virtual

Member Function Documentation

◆ DoOp_Dir()

HRESULT GrayLib::cSyncDir::DoOp_Dir ( )
protected

Push or pull a whole directory.

Returns
# of operations.

◆ DoOp_LocalAttr()

HRESULT GrayLib::cSyncDir::DoOp_LocalAttr ( cManifestDir pManLocal)
protected

CSYNCOP_LocalAttr CSYNCOP_LocalAttrName CRC says the file/dir is the same content. adjust the time stamp, case, and attributes. Updates pManLocal with pOp->m_pElem.

◆ DoOp_LocalDelete()

HRESULT GrayLib::cSyncDir::DoOp_LocalDelete ( cManifestDir pManLocal)
protected

CSYNCOP_LocalDelete Sync dictates that the local file/dir should be deleted. pulled from remote/server but the file/dir is not in the server list!

Returns
S_OK

◆ DoOp_PullFromRemote()

HRESULT GrayLib::cSyncDir::DoOp_PullFromRemote ( cManifestDir pManLocal)
protected

CSYNCOP_PullFromRemote get file element from the remote/server.

Returns
S_OK HRESULT_WIN32_C(ERROR_INVALID_TABLE) = corrupt file.

◆ DoOp_PushToRemote()

HRESULT GrayLib::cSyncDir::DoOp_PushToRemote ( )
protected

CSYNCOP_PushToRemote CSYNC_Push Push a file to the remote/server.

Returns
S_OK = not changed.

◆ DoOp_RemoteAttr()

HRESULT GrayLib::cSyncDir::DoOp_RemoteAttr ( )
protected

CSYNCOP_RemoteAttr CSYNC_Push Push a files attributes to the remote/server.

Returns
S_OK

◆ DoOp_RemoteDelete()

HRESULT GrayLib::cSyncDir::DoOp_RemoteDelete ( )
protected

CSYNCOP_RemoteDelete CSYNC_Push Tell the remote/server to delete its copy of a file or directory.

Returns
S_OK = no change.

◆ ExecSyncOp()

HRESULT GrayLib::cSyncDir::ExecSyncOp ( cManifestDir pManLocal,
cSyncOp pOp 
)
protected

manLocal will be modified if this is a local operation. CSYNC_Pull

  • pManLocal = update the local manifest if local changes are to be made.
    Returns
    # of child operations.
    do nothing.

just set the attributes on the local file. date stamp, case, attribute flags.

get file from the remote/server to this local machine.

replace file from the remote/server to this local machine.

Delete a local file.

just set the attributes for the remote/server file. date stamp, case.

push file to the remote/server from the local machine.

replace file on the remote/server from this local machine.

Delete a remote/server side file.

◆ ExecSyncOps()

HRESULT GrayLib::cSyncDir::ExecSyncOps ( )

Second pass. start moving the files.

Returns
# of operations.

◆ onProgressCallback()

HRESULT _stdcall GrayLib::cSyncDir::onProgressCallback ( const cStreamProgress progress)
overrideprotectedvirtual

Report progress from a single sub action and roll it into progress for all actions. Get total status for Exec. ASSUME from call to m_pRemoteConnect->RequestFile()

Reimplemented from Gray::IStreamProgressCallback.

Member Data Documentation

◆ m_bRecycleDeletes

bool GrayLib::cSyncDir::m_bRecycleDeletes

send deletes to the recycle bin.

◆ m_Context

cSyncContext& GrayLib::cSyncDir::m_Context

◆ m_pOpCur

cSyncOpPtr GrayLib::cSyncDir::m_pOpCur
protected

the current operation/action for ExecSyncOp.

◆ m_RxPrev

FILE_SIZE_t GrayLib::cSyncDir::m_RxPrev

How many bytes to move? (on ExecSyncOps)

previous to the IStreamProgressCallback callback.

◆ m_TxPrev

FILE_SIZE_t GrayLib::cSyncDir::m_TxPrev

previous to the IStreamProgressCallback callback.

◆ sm_szFileInLimbo

const LOGCHAR_t GrayLib::cSyncDir::sm_szFileInLimbo = "Can't sync file in use."
static

file is placed in sm_szLimboDir

file is in use. put in LIMBO ?


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