/// <summary> /// Places the server in service immediately. The server will try immediately to /// pull and service a service object from its input port. /// </summary> /// <param name="exec">The executive controlling the timebase in which this server is /// to operate. Typically, model.Executive.</param> /// <param name="userData"></param> private void PlaceInService(IExecutive exec, object userData) { PlaceInService(); }
/// <summary> /// Constructor for the Metronome_Simple class. Assumes auto-start, and auto-finish. /// </summary> /// <param name="exec">The executive that will be serving the events.</param> /// <param name="period">The periodicity of the event train.</param> private Metronome_Simple(IExecutive exec, TimeSpan period) : base(exec, period) { }
private static void exec_ExecutiveFinished(IExecutive exec) { m_channels.Remove(exec); }
private void m_executive_ExecutiveStarted(IExecutive exec) { exec.EventAboutToFire += m_kickoffManager.Kickoff; }
protected abstract void FireEvents(IExecutive exec, object userData);
private void TankIsFull(IExecutive exec, object userData) { Console.WriteLine("{0} : Tank full notification received.", m_exec.Now); m_fullEventID = -1; CloseFillValve(); }
static void ReportTankLevel(IExecutive exec, object userData) { Console.WriteLine("{0} : Tank level is {1}.", exec.Now, _tank.Level); }
private static bool IsParallelizable(this IExecutive executive) { return(executive.Descriptors.Any(service => service.File.GetIndentity() == "acs2")); }
public Employee([MapService("CEO")] IExecutive executive1, [MapService("CTO")] IExecutive executive2) { CEO = executive1; CTO = executive2; }
public static async Task <TransactionResourceInfo> GetTransactionResourceInfoAsync(this IExecutive executive, IChainContext chainContext, Transaction input) { var txId = input.GetHash(); var transactionContext = GetTransactionContext(chainContext, input.To, input.ToByteString(), out var trace); await executive.ApplyAsync(transactionContext); if (!trace.IsSuccessful()) { return(NotParallelizable(txId, executive.ContractHash)); } try { var resourceInfo = ResourceInfo.Parser.ParseFrom(trace.ReturnValue); return(new TransactionResourceInfo { TransactionId = txId, Paths = { resourceInfo.Paths }, ParallelType = resourceInfo.NonParallelizable ? ParallelType.NonParallelizable : ParallelType.Parallelizable, ContractHash = executive.ContractHash }); } catch (Exception) { return(NotParallelizable(txId, executive.ContractHash)); } }
// TODO: maybe use ITransactionReadOnlyExecutionService public static async Task <TransactionResourceInfo> GetTransactionResourceInfoAsync(this IExecutive executive, IChainContext chainContext, Transaction input) { var generatedTxn = new Transaction { From = FromAddress, To = input.To, MethodName = nameof(ACS2BaseContainer.ACS2BaseStub.GetResourceInfo), Params = input.ToByteString(), Signature = ByteString.CopyFromUtf8("SignaturePlaceholder") }; var txId = input.GetHash(); if (!IsParallelizable(executive)) { return(NotParallelizable(txId)); } var trace = new TransactionTrace { TransactionId = generatedTxn.GetHash() }; var transactionContext = new TransactionContext { PreviousBlockHash = chainContext.BlockHash, CurrentBlockTime = TimestampHelper.GetUtcNow(), Transaction = generatedTxn, BlockHeight = chainContext.BlockHeight + 1, Trace = trace, CallDepth = 0, StateCache = chainContext.StateCache }; await executive.ApplyAsync(transactionContext); if (!trace.IsSuccessful()) { return(NotParallelizable(txId)); } try { var resourceInfo = ResourceInfo.Parser.ParseFrom(trace.ReturnValue); return(new TransactionResourceInfo { TransactionId = txId, Paths = { resourceInfo.Paths }, ParallelType = resourceInfo.NonParallelizable ? ParallelType.NonParallelizable : ParallelType.Parallelizable }); } catch (Exception) { return(NotParallelizable(txId)); } }
public virtual async Task PutExecutiveAsync(Address address, IExecutive executive) { await _smartContractExecutiveProvider.PutExecutiveAsync(address, executive); }
public override void Run(PfcExecutionContext pfcec, StepStateMachine ssm) { IExecutive exec = Model.Executive; exec.CurrentEventController.SuspendUntil(exec.Now + m_tsd.GetNext()); }
private void DequeueEventHandler(IExecutive exec, object bin) { m_lastExitArrivalTime = exec.Now; m_exit.OwnerPut(((Bin)bin).Payload); }
private string getExecNow(IExecutive exec) { return(exec.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); }
private void DoItWithSuspension(IExecutive exec, object userData) { Console.WriteLine(exec.Now + " : Starting \"DoItWithSuspension\""); exec.CurrentEventController.SuspendUntil(exec.Now + TimeSpan.FromMinutes(5.0)); Console.WriteLine(exec.Now + " : Finished \"DoItWithSuspension\""); }
void exec1_ExecutiveStarted_SingleShot(IExecutive exec) { m_exec1_ExecutiveStarted_SingleShot_Count++; }
private void DoItWithoutSuspension(IExecutive exec, object userData) { Console.WriteLine(exec.Now + " : Doing \"DoItWithoutSuspension\""); }
private static void FinishProcessToken(IExecutive exec, object userData) { // UserData is a string, now. Console.WriteLine("{0} : Done processing {1}.", exec.Now, userData); }
void exec_ExecutivePaused(IExecutive exec) { throw new NotImplementedException(); }
private void DoneDelaying(IExecutive exec, object graphContext) { SignalTaskCompletion((IDictionary)graphContext); _Debug.WriteLine(Model.Executive.Now + " : " + Name + " is done."); }
void exec_ExecutiveStarted_SingleShot(IExecutive exec) { throw new NotImplementedException(); }
public KickoffMgr(ExecController parent, IExecutive exec) { m_exec = exec; m_parent = parent; }
private void ExecEventRecieverCount(IExecutive exec, object userData) { --m_validateCount; }
/// <summary> /// Constructor for the Metronome_Simple class. /// </summary> /// <param name="exec">The executive that will be serving the events.</param> /// <param name="startAt">The start time for the event train.</param> /// <param name="finishAfter">The end time for the event train.</param> /// <param name="period">The periodicity of the event train.</param> private Metronome_Simple(IExecutive exec, DateTime startAt, DateTime finishAfter, TimeSpan period) : base(exec, startAt, finishAfter, period) { }
void exec1_ClockAboutToChange(IExecutive exec) { m_result += ("\tClock, currently at " + getExecNow(exec) + ", is about to change.\r\n"); }
protected override void FireEvents(IExecutive exec, object userData) { TickEvent?.Invoke(exec, userData); }
void MyExecEventReceiver2(IExecutive exec, object userData) { m_result += (getExecNow(exec) + " : Event is firing.\r\n"); }
private void OnRequestAborting(IExecutive exec, IDetachableEventController idec, params object[] args) { ResourceRequestAborting?.Invoke(this, exec, idec); }
private void RemoveFromService(IExecutive exec, object userData) { RemoveFromService(); }