public void Replicate(CouchUri sourceUri, CouchUri targetUri) { CreateUri().Replicate(); var request = ReplicationCommand.Continuous(sourceUri, targetUri); var body = request.ToJson(false); Post(body); }
public void Replicate <TModel>(CouchUri targetUri) { CreateUri().Replicate(); var sourceUri = configuration.NewUri <TModel>(); var request = ReplicationCommand.Continuous(sourceUri, targetUri); var body = request.ToJson(false); Post(body); }
public void CopyDatabase(CouchUri sourceUri, CouchUri targetUri) { try { CreateUri().Replicate(); var request = ReplicationCommand.Once(sourceUri, targetUri); var body = request.ToJson(false); Post(body); } catch (WebException ex) { //do nothing, it's a timeout if (!ex.Message.Contains("timed out")) { throw; } } }
public void Write(NetOutgoingMessage inOutputStream, ReplicationManagerTransmissionData ioTransmissinData) { //run through each replication command and do something... foreach (var pair in mNetworkIdToReplicationCommand) { ReplicationCommand replicationCommand = pair.Value; if (replicationCommand.HasDirtyState()) { int networkId = pair.Key; //well, first write the network id... inOutputStream.Write(networkId); //only need 2 bits for action... ReplicationAction action = replicationCommand.GetAction(); inOutputStream.Write(action); uint32_t writtenState = 0; uint32_t dirtyState = replicationCommand.GetDirtyState(); //now do what? switch (action) { case ReplicationAction.RA_Create: writtenState = WriteCreateAction(inOutputStream, networkId, dirtyState); break; case ReplicationAction.RA_Update: writtenState = WriteUpdateAction(inOutputStream, networkId, dirtyState); break; case ReplicationAction.RA_Destroy: //don't need anything other than state! writtenState = WriteDestroyAction(inOutputStream, networkId, dirtyState); break; } ioTransmissinData.AddTransmission(networkId, action, writtenState); //let's pretend everything was written- don't make this too hard replicationCommand.ClearDirtyState(writtenState); } } }
public void ReplicateCreate(int inNetworkId, uint32_t inInitialDirtyState) { mNetworkIdToReplicationCommand[inNetworkId] = new ReplicationCommand(inInitialDirtyState); }
public int Write(NetOutgoingMessage inOutputStream, ReplicationManagerTransmissionData ioTransmissinData, int inRestartedNetworkId, byte inWorldId) { int count = 0; bool skip = (inRestartedNetworkId != 0); //run through each replication command and do something... List <int> removeObject = null; foreach (var pair in mNetworkIdToReplicationCommand) { ReplicationCommand replicationCommand = pair.Value; if (replicationCommand.HasDirtyState()) { // 이전에 중단 되었던 network ID 부터 재개 if (skip) { if (inRestartedNetworkId == pair.Key) { skip = false; } else { continue; } } int networkId = pair.Key; ReplicationAction action = replicationCommand.GetAction(); NetGameObject gameObject = NetworkManagerServer.sInstance.GetGameObject(networkId, inWorldId); if (gameObject == null && action != ReplicationAction.RA_Destroy) { if (removeObject == null) { removeObject = new List <int>(); } removeObject.Add(networkId); continue; } // 최대로 동기화 할수 있는 개수 초과시 중단 ++count; if (count > max_replication_count) { return(pair.Key); } //well, first write the network id... inOutputStream.Write((uint)networkId, NetGameObject.NetworkIdSize); //Log.Information($"write networkId:{networkId}, classId:{gameObject?.GetClassId()}, action:{action}"); //only need 2 bits for action... inOutputStream.Write(action); uint32_t writtenState = 0; uint32_t dirtyState = replicationCommand.GetDirtyState(); //now do what? switch (action) { case ReplicationAction.RA_Create: { inOutputStream.Write(gameObject.GetClassId()); writtenState = gameObject.Write(inOutputStream, dirtyState); } break; case ReplicationAction.RA_Update: { writtenState = gameObject.Write(inOutputStream, dirtyState); } break; case ReplicationAction.RA_Destroy: { //don't need anything other than state! writtenState = dirtyState; } break; } ioTransmissinData.AddTransmission(networkId, action, writtenState, inWorldId); //let's pretend everything was written- don't make this too hard replicationCommand.ClearDirtyState(writtenState); } } if (removeObject != null) { foreach (var key in removeObject) { mNetworkIdToReplicationCommand.Remove(key); } } return(0); }