public void SendTransactionToSlaves(ClusterTransaction txn) { var msg = txn.AsMessage(); foreach (var slave in _slaves) { msg.WriteTo(slave.TcpClient.GetStream()); } }
private void QueueTransaction(ClusterTransaction txn) { if (txn is ClusterUpdateTransaction) { var cut = txn as ClusterUpdateTransaction; _storeInfo[txn.StoreId].Queue(txn.JobId); _serverCore.QueueTransaction(txn.JobId, txn.StoreId, cut.Preconditions, cut.Deletes, cut.Inserts); } else if (txn is ClusterSparqlTransaction) { var sut = txn as ClusterSparqlTransaction; _storeInfo[txn.StoreId].Queue(txn.JobId); _serverCore.QueueUpdate(txn.JobId, txn.StoreId, sut.Expression); } }
public bool ProcessSyncTransaction(ClusterTransaction txn) { if (_state == CoreState.SyncToMaster) { if (HaveTransaction(txn)) { // Already have a job with this GUID return(true); } if (HavePrecedingTransaction(txn)) { QueueTransaction(txn); return(true); } } return(false); }
public bool ProcessSlaveTransaction(ClusterTransaction txn) { // check we have store info if (!_storeInfo.ContainsKey(txn.StoreId)) { // we need to create the store CreateStore(txn.StoreId); } if (!HavePrecedingTransaction(txn)) { if (_state == CoreState.SyncToMaster) { // TODO: buffer this transaction locally to replay when sync is finished return(true); } // We must have missed at least one message. Resync to master StartSyncToMaster(); return(false); } QueueTransaction(txn); return(true); }
public void SendTransactionToSlaves(ClusterTransaction txn) { var msg = txn.AsMessage(); foreach(var slave in _slaves) { msg.WriteTo(slave.TcpClient.GetStream()); } }
private bool HavePrecedingTransaction(ClusterTransaction txn) { return(_storeInfo[txn.StoreId].Last.Equals(txn.PrevTxnId)); }
private bool HaveTransaction(ClusterTransaction txn) { // TODO: If not in cached transaction list, check back through txn log return(_storeInfo[txn.StoreId].HaveTransaction(txn.JobId)); }
private bool HavePrecedingTransaction(ClusterTransaction txn) { return _storeInfo[txn.StoreId].Last.Equals(txn.PrevTxnId); }
public bool ProcessSlaveTransaction(ClusterTransaction txn) { // check we have store info if (!_storeInfo.ContainsKey(txn.StoreId)) { // we need to create the store CreateStore(txn.StoreId); } if (!HavePrecedingTransaction(txn)) { if (_state == CoreState.SyncToMaster) { // TODO: buffer this transaction locally to replay when sync is finished return true; } // We must have missed at least one message. Resync to master StartSyncToMaster(); return false; } QueueTransaction(txn); return true; }
private bool HaveTransaction(ClusterTransaction txn) { // TODO: If not in cached transaction list, check back through txn log return _storeInfo[txn.StoreId].HaveTransaction(txn.JobId); }
public bool ProcessSyncTransaction(ClusterTransaction txn) { if(_state == CoreState.SyncToMaster) { if (HaveTransaction(txn)) { // Already have a job with this GUID return true; } if (HavePrecedingTransaction(txn)) { QueueTransaction(txn); return true; } } return false; }