3.1.4.22.4 BeginReplicationAsTarget (Opnum 6)
This method is called by a replication client application to request that a server perform the actions necessary to begin a replication operation in which the server is a replication target. This typically happens after the application has copied import package files for the conglomerations to be copied to a replication target file share on the server. As part of the handling of the method, the server sets up a replication working directory and file share. The server's handling of the method might also include management of replication history and backup state.
-
HRESULT BeginReplicationAsTarget( [in] LPCWSTR pwszBaseReplicationDir );
pwszBaseReplicationDir: The server's base replication directory path.
Return Values: This method MUST return S_OK (0x00000000) on success, and a failure result, as specified in [MS-ERREF] section 2.1, on failure. All failure results MUST be treated identically.
Upon receiving a call to this method, the server MAY verify that pwszBaseReplicationDir is the server's base replication directory path, and fail the call if not.
The server then MAY<352> attempt to perform implementation-specific management of replication history and/or backup state, and fail the call if it cannot do so.
The server then MUST attempt to set up a replication working directory as described in the following steps. This described behavior is provided to facilitate the explanation of how the protocol behaves. This document does not mandate that implementations adhere to this model as long as their external behavior is consistent with that described in this document:
If there already exists a directory whose path is derived from the base replication directory path by appending "\ReplicaCurrent", the server MUST attempt to either remove or rename this directory, and fail the call if it cannot.
The server then MUST attempt to rename the directory whose path is derived from the base replication directory path by appending "\ReplicaNew" (the directory that previously backed the replication target share) such that its new path is derived from the base replication directory by appending "\ReplicaCurrent", and fail the call if it cannot.
The server then MUST attempt to create a CIFS file share with the name "ReplicaTargetCurrent", backed by the replication working directory, and ensure that the COMA client's user identity is granted at least read access, and fail the call if it cannot. Upon failure at this point in the server's handling of the method call, it is implementation-specific<353> whether the server attempts to perform any cleanup of the actions already performed.
The server MUST then return success.