private GrpcTxEvent ConvertEvent(TxEvent @event) { var payloads = ByteString.CopyFrom(_serializer.Serialize(@event.Payloads), Encoding.UTF8); return(new GrpcTxEvent() { ServiceName = _serviceConfig.ServiceName, InstanceId = _serviceConfig.InstanceId, Timestamp = @event.Timestamp, GlobalTxId = @event.GlobalTxId, LocalTxId = @event.LocalTxId, ParentTxId = @event.ParentTxId ?? "", Type = @event.Type.ToString(), Timeout = @event.Timeout, CompensationMethod = @event.CompensationMethod, RetryMethod = @event.RetryMethod ?? "", Retries = @event.Retries, Payloads = payloads }); }
public void UpdateRecipes(string[] ids, string[] names, string[] cookbooks, string[] decriptions, long[] blockIntervals, string[] coinInputs, string[] itemInputs, string[] outputTables, string[] outputs, TxEvent evt) => TxEventMessageHandler(() => new UpdateRecipes(ids, names, cookbooks, decriptions, blockIntervals, coinInputs, itemInputs, outputTables, outputs), evt);
public void UpdateCookbooks(string[] ids, string[] names, string[] developers, string[] descriptions, string[] versions, string[] supportEmails, TxEvent evt) => TxEventMessageHandler(() => new UpdateCookbooks(ids, names, developers, descriptions, versions, supportEmails), evt);
public void SetItemString(string item, string field, string value, TxEvent evt) => TxEventMessageHandler(() => new SetItemString(item, field, value), evt);
public void SendCoins(string denom, long count, string receiver, TxEvent evt) => TxEventMessageHandler(() => new SendCoins(JsonConvert.SerializeObject(new Coin[] { new Coin(denom, count) }), receiver), evt);
public void RegisterProfile(string name, TxEvent evt) => TxEventMessageHandler(() => new RegisterProfile(name, false), evt);
public void ExecuteRecipe(string recipe, string cookbook, string[] itemInputs, TxEvent evt) => TxEventMessageHandler(() => new ExecuteRecipe(recipe, cookbook, itemInputs), evt);
public void FulfillTrade(string tradeId, string[] itemIds, TxEvent evt) => TxEventMessageHandler(() => new FulfillTrade(tradeId, itemIds), evt);
public void CreateTrade(string[] coinInputs, string[] itemInputs, string[] coinOutputs, string[] itemOutputs, string extraInfo, TxEvent evt) => TxEventMessageHandler(() => new CreateTrade(coinInputs, itemInputs, coinOutputs, itemOutputs, extraInfo), evt);
public void EnableRecipes(string[] recipeIds, TxEvent evt) => TxEventMessageHandler(() => new EnableRecipes(recipeIds), evt);
public void CreateCookbooks(string[] ids, string[] names, string[] developers, string[] descriptions, string[] versions, string[] supportEmails, long[] levels, long[] costsPerBlock, TxEvent evt) => TxEventMessageHandler(() => new CreateCookbooks(ids, names, developers, descriptions, versions, supportEmails, levels, costsPerBlock), evt);
public void CheckExecution(string execId, bool payForCompletion, TxEvent evt) => TxEventMessageHandler(() => new CheckExecution(execId, payForCompletion), evt);
public void CancelTrade(string tradeId, TxEvent evt) => TxEventMessageHandler(() => new CancelTrade(tradeId), evt);
private void DefineRegisters() { Registers.RxBufferBaseAddress.Define(this) // this is not consistent with the documentation // that states that only 21 bits are used for the address, // but otherwise the sample fails .WithValueField(0, 32, out rxBufferAddress, name: "RX_SADDR") ; Registers.RxBufferSize.Define(this) .WithValueField(0, 20, out rxBufferSize, name: "RX_SIZE") .WithReservedBits(20, 12) ; Registers.RxStreamConfiguration.Define(this) .WithTag("CONTINOUS", 0, 1) .WithReservedBits(1, 3) .WithFlag(4, out rxStreamEnabled, name: "EN") .WithTag("PENDING", 5, 1) .WithTag("CLR", 6, 1) .WithReservedBits(7, 25) ; Registers.TxBufferBaseAddress.Define(this) // this is not consistent with the documentation // that states that only 21 bits are used for the address, // but otherwise the sample fails .WithValueField(0, 32, out txBufferAddress, name: "TX_SADDR") ; Registers.TxBufferSize.Define(this) .WithValueField(0, 20, out txBufferSize, name: "TX_SIZE") .WithReservedBits(20, 12) ; Registers.TxStreamConfiguration.Define(this) .WithTag("CONTINOUS", 0, 1) .WithReservedBits(1, 3) .WithFlag(4, name: "EN", valueProviderCallback: _ => false, // the transfer is instant + we don't support the continous mode, so we disable right away writeCallback: (_, val) => { if (!val) { return; } this.Log(LogLevel.Debug, "Starting a DMA TX transaction"); var data = machine.SystemBus.ReadBytes(txBufferAddress.Value, (int)txBufferSize.Value); #if DEBUG_PACKETS this.Log(LogLevel.Noisy, "Read data from the memory @ 0x{0:X}: {1}", txBufferAddress.Value, Misc.PrettyPrintCollectionHex(data)); #endif HandleIncomingBytes(data); TxEvent.Blink(); }) .WithFlag(5, FieldMode.Read, name: "PENDING", valueProviderCallback: _ => false) .WithTag("CLR", 6, 1) .WithReservedBits(7, 25) ; Registers.CommandBufferBaseAddress.Define(this) .WithValueField(0, 21, name: "CMD_SADDR") .WithReservedBits(21, 11) ; Registers.CommandBufferSize.Define(this) .WithValueField(0, 20, name: "CMD_SIZE") .WithReservedBits(20, 12) ; Registers.CommandStreamConfiguration.Define(this) .WithTag("CONTINOUS", 0, 1) .WithReservedBits(1, 3) .WithTag("EN", 4, 1) .WithTag("PENDING", 5, 1) .WithTag("CLR", 6, 1) .WithReservedBits(7, 25) ; Registers.Status.Define(this) .WithTag("BUSY", 0, 1) .WithTag("ARB_LOST", 1, 1) .WithReservedBits(2, 30) ; Registers.Setup.Define(this) .WithTag("DO_RST", 0, 1) .WithReservedBits(1, 31) ; }
public void GetPylons(long count, TxEvent evt) => #if DEBUG TxEventMessageHandler(() => new GetPylons(count), evt);
public AlphaResponse Send(TxEvent @event) { var grpcAck = _client.OnTxEvent(ConvertEvent(@event)); return(new AlphaResponse(grpcAck.Aborted)); }
public void GetTransaction(string txHash, TxEvent evt) => TxEventMessageHandler(() => new GetTransaction(txHash), evt);
public AlphaResponse Send(TxEvent @event) { throw new NotImplementedException(); }
public void TxEventMessageHandler(Func <IpcMessage> msg, TxEvent evt) => IpcInteraction.Stage(msg, (s, e) => { evt.Invoke(s, ((TxResponse)e).Transactions); });