/// <summary> /// Executes a table operation on the table. /// </summary> /// <param name="operation">The operation to execute.</param> /// <param name="options">Options to use to perform the operation.</param> /// <param name="state">The state.</param> /// <returns> /// The result of the operation. /// </returns> /// <exception cref="ReactiveProcessingStorageException">The specified resource already exists or The specified resource does not exist or Unknown</exception> public Task <TableResult> ExecuteAsync(ITableOperation operation, TableRequestOptions options, object state) { if (operation == null) { throw new ArgumentNullException(nameof(operation)); } var azureOperation = operation.Type switch { TableOperationType.Delete => TableOperation.Delete(operation.Entity), TableOperationType.Insert => TableOperation.Insert(operation.Entity), TableOperationType.InsertOrMerge => TableOperation.InsertOrMerge(operation.Entity), TableOperationType.InsertOrReplace => TableOperation.InsertOrReplace(operation.Entity), TableOperationType.Merge => TableOperation.Merge(operation.Entity), TableOperationType.Replace => TableOperation.Replace(operation.Entity), TableOperationType.Retrieve => TableOperation.Retrieve(operation.Entity.PartitionKey, operation.Entity.RowKey), _ => throw new NotSupportedException( string.Format( CultureInfo.InvariantCulture, "'{0}' operation is not supported; only insert and delete are currently supported.", operation.Type)), }; return(_table.ExecuteAsync(azureOperation, options, null /* TODO: context */)); }
/// <summary> /// Runs a query on all routines. /// </summary> public void RunQueryAll(ITableQuery inQuery, ITableOperation inOperation) { int totalLeft = m_ActiveCount; int currentNode = m_ActiveHead; while (currentNode != -1 && totalLeft-- > 0) { Entry e = m_Entries[currentNode]; currentNode = e.NextIndex; if (inQuery.Validate(e.Fiber)) { inOperation.Execute(e.Fiber); } } }
/// <summary> /// Runs a query and returns the first routine to pass. /// </summary> public Routine RunQueryFirst(ITableQuery inQuery, ITableOperation inOperation) { int totalLeft = m_ActiveCount; int currentNode = m_ActiveHead; while (currentNode != -1 && totalLeft-- > 0) { Entry e = m_Entries[currentNode]; currentNode = e.NextIndex; if (inQuery.Validate(e.Fiber)) { inOperation.Execute(e.Fiber); return(e.Fiber.GetHandle()); } } return(Routine.Null); }
public Task <TableResult> ExecuteAsync(ITableOperation operation, TableRequestOptions options, object state) { if (operation == null) { throw new ArgumentNullException(nameof(operation)); } return(operation.Type switch { TableOperationType.Delete => Delete(operation.Entity), TableOperationType.Insert => Insert(operation.Entity), _ => throw new NotSupportedException( string.Format( CultureInfo.InvariantCulture, "'{0}' operation is not supported; only insert or delete operations are supported.", operation.Type )), });
/// <summary> /// Runs a query on all routines. /// </summary> public void RunQueryAll(ITableQuery inQuery, ITableOperation inOperation, ref ICollection <Routine> ioRoutines) { int totalLeft = m_ActiveCount; int currentNode = m_ActiveHead; while (currentNode != -1 && totalLeft-- > 0) { Entry e = m_Entries[currentNode]; currentNode = e.NextIndex; if (inQuery.Validate(e.Fiber)) { inOperation.Execute(e.Fiber); if (ioRoutines == null) { ioRoutines = new List <Routine>(); } ioRoutines.Add(e.Fiber.GetHandle()); } } }