internal static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback<Table> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions??new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<Table>( ()=>{ return LoadTable(ddbClient,tableName,consumer,conversion); },asyncOptions,callback); }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// </summary> /// <param name="doc">Document to save.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void PutItemAsync(Document doc, AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<Document>( () => { return PutItemHelper(doc, null, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the GetRemaining operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Search.GetRemaining"/> /// </summary> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void GetRemainingAsync(AmazonDynamoDBCallback<List<Document>> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<List<Document>>( () => { return GetRemainingHelper(true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the Execute operation. /// <seealso cref="Amazon.DynamoDBv2.DataModel.MultiTableBatchWrite.Execute"/> /// </summary> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void ExecuteAsync(AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { ExecuteHelper(true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the GetItem operation. /// </summary> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void GetItemAsync(Primitive hashKey, GetItemOperationConfig config, AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Document>( () => { return(GetItemHelper(MakeKey(hashKey, null), config, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem"/> /// </summary> /// <param name="key">Key of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(IDictionary <string, DynamoDBEntry> key, DeleteItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(key), config, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem"/> /// </summary> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="rangeKey">Range key element of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(Primitive hashKey, Primitive rangeKey, DeleteItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(hashKey, rangeKey), config, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem"/> /// </summary> /// <param name="document">Document to delete.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(Document document, DeleteItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(document), config, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.DeleteItem"/> /// </summary> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(Primitive hashKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(hashKey, null), null, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the UpdateItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem"/> /// </summary> /// <param name="doc">Attributes to update.</param> /// <param name="key">Key of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void UpdateItemAsync(Document doc, IDictionary <string, DynamoDBEntry> key, UpdateItemOperationConfig config, AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Document>( () => { return(UpdateHelper(doc, MakeKey(key), config, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the UpdateItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem"/> /// </summary> /// <param name="doc">Attributes to update.</param> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="rangeKey">Range key element of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Document>( () => { return(UpdateHelper(doc, MakeKey(hashKey, rangeKey), config, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the UpdateItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.UpdateItem"/> /// </summary> /// <param name="doc">Document to update.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void UpdateItemAsync(Document doc, AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Document>( () => { return(UpdateHelper(doc, MakeKey(doc), null, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the GetItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/> /// </summary> /// <param name="key">Key of the document.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void GetItemAsync(IDictionary <string, DynamoDBEntry> key, AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Document>( () => { return(GetItemHelper(MakeKey(key), null, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.PutItem"/> /// </summary> /// <param name="doc">Document to save.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void PutItemAsync(Document doc, PutItemOperationConfig config, AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Document>( () => { return(PutItemHelper(doc, config, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the Delete operation. /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete"/> /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="value">Object to delete.</param> /// <param name="operationConfig">Overriding configuration.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteAsync <T>(T value, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper <T>(value, operationConfig, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the Delete operation. /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete"/> /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="hashKey">Hash key element of the object to delete.</param> /// <param name="rangeKey">Range key element of the object to delete.</param> /// <param name="operationConfig">Config object which can be used to override that table used.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteAsync <T>(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper <T>(hashKey, rangeKey, operationConfig, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the ExecuteBatchWrite operation. /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.ExecuteBatchWrite"/> /// </summary> /// <param name="batches">Configured BatchWrite objects</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void ExecuteBatchWriteAsync <T>(BatchWrite[] batches, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches); DynamoDBAsyncExecutor.ExecuteAsync( () => { superBatch.ExecuteHelper(true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the Load operation. /// </summary> /// <typeparam name="T">Type to populate.</typeparam> /// <param name="keyObject">Key of the target item.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void LoadAsync <T>(T keyObject, AmazonDynamoDBCallback <T> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <T>( () => { return(LoadHelper <T>(keyObject, null)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the Load operation. /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load"/> /// </summary> /// <typeparam name="T">Type to populate.</typeparam> /// <param name="hashKey">Hash key element of the target item.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void LoadAsync <T>(object hashKey, AmazonDynamoDBCallback <T> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <T>( () => { return(LoadHelper <T>(hashKey, null, null, true)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the DownloadTo operation. /// </summary> /// <param name="downloadPath">Path to save the file.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DownloadToAsync(string downloadPath, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { this.s3ClientCache.GetClient(this.RegionAsEndpoint).DownloadToFilePath( this.linker.s3.bucket, this.linker.s3.key, downloadPath, null); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the UploadFrom operation. /// </summary> /// <param name="sourcePath">Path of the file to be uploaded.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void UploadFromAsync(string sourcePath, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { this.s3ClientCache.GetClient(this.RegionAsEndpoint).UploadObjectFromFilePath( this.linker.s3.bucket, this.linker.s3.key, sourcePath, null); }, asyncOptions, callback); }
/// <summary> /// Configures an async Query operation against DynamoDB, finding items /// that match the specified hash primary key. /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="hashKeyValue">Hash key of the items to query.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void QueryAsync <T>(object hashKeyValue, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <AsyncSearch <T> >( () => { var query = ConvertQueryByValue <T>(hashKeyValue, null, null); return(FromSearchAsync <T>(query)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the Load operation. /// </summary> /// <typeparam name="T">Type to populate.</typeparam> /// <param name="hashKey">Hash key element of the target item.</param> /// <param name="rangeKey">Range key element of the target item.</param> /// <param name="operationConfig">Overriding configuration.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void LoadAsync <T>(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <T> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <T>( () => { return(LoadHelper <T>(hashKey, rangeKey, operationConfig)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution to get all the remaining results from DynamoDB. /// </summary> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void GetRemainingAsync(AmazonDynamoDBCallback <List <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <List <T> >( () => { var documents = DocumentSearch.GetRemainingHelper(true); List <T> items = SourceContext.FromDocumentsHelper <T>(documents, Config).ToList(); return(items); }, asyncOptions, callback); }
public static void ExecuteAsync <T>(Func <T> function, AsyncOptions options, AmazonDynamoDBCallback <T> callback) { ThreadPool.QueueUserWorkItem((state) => { T result = default(T); Exception exception = null; try { result = function(); } catch (Exception ex) { exception = ex; } if (callback != null) { if (options.ExecuteCallbackOnMainThread) { UnityRequestQueue.Instance.ExecuteOnMainThread(() => { callback(new AmazonDynamoDBResult <T>(result, exception, options.State)); }); } else { try { callback(new AmazonDynamoDBResult <T>(result, exception, options.State)); } catch (Exception callbackException) { // Catch any unhandled exceptions from the user callback // and log it. Logger.Error(callbackException, "An unhandled exception was thrown from the callback method {0}.", callback.Method.Name); } } } }); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// </summary> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="rangeKey">Range key element of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(Primitive hashKey, Primitive rangeKey, DeleteItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(hashKey, rangeKey), config, true); }, asyncOptions, callback); }
/// <summary> /// Configures an async Query operation against DynamoDB, finding items /// that match the specified range element condition for a hash-and-range primary key. /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="hashKeyValue">Hash key of the items to query.</param> /// <param name="op">Operation of the condition.</param> /// <param name="values"> /// Value(s) of the condition. /// For all operations except QueryOperator.Between, values should be one value. /// For QueryOperator.Between, values should be two values. /// </param> /// <param name="operationConfig">Config object which can be used to override the table used.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void QueryAsync <T>(object hashKeyValue, QueryOperator op, IEnumerable <object> values, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <AsyncSearch <T> >( () => { if (values == null) { throw new ArgumentNullException("values"); } ContextSearch query = ConvertQueryByValue <T>(hashKeyValue, op, values, operationConfig); return(FromSearchAsync <T>(query)); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the GetItem operation. /// </summary> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void GetItemAsync(Primitive hashKey, GetItemOperationConfig config, AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<Document>( () => { return GetItemHelper(MakeKey(hashKey, null), config, true); }, asyncOptions, callback); }
/// <summary> /// Configures an async Query operation against DynamoDB, finding items /// that match the specified conditions. /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="queryConfig">Query request object.</param> /// <param name="operationConfig">Config object which can be used to override the table used.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void FromQueryAsync <T>(QueryOperationConfig queryConfig, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <AsyncSearch <T> >( () => { if (queryConfig == null) { throw new ArgumentNullException("queryConfig"); } var query = ConvertFromQuery <T>(queryConfig, operationConfig); return(FromSearchAsync <T>(query)); }, asyncOptions, callback); }
/// <summary> /// Configures an async Query operation against DynamoDB, finding items /// that match the specified conditions. /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="queryConfig">Query request object.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void FromQueryAsync <T>(QueryOperationConfig queryConfig, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null) { FromQueryAsync <T>(queryConfig, null, callback, asyncOptions); }
/// <summary> /// Creates a strongly-typed BatchWrite object, allowing /// a batch-write operation against DynamoDB. /// </summary> /// <typeparam name="T">Type of objects to write</typeparam> /// <param name="operationConfig">Config object which can be used to override that table used.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void CreateBatchWriteAsync <T>(DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <BatchWrite <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DynamoDBFlatConfig config = new DynamoDBFlatConfig(operationConfig, this.Config); return(new BatchWrite <T>(this, config));; }, asyncOptions, callback); }
/// <summary> /// Configures an async Scan operation against DynamoDB, finding items /// that match the specified conditions. /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="scanConfig">Scan request object.</param> /// <param name="operationConfig">Config object which can be used to override the table used.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void FromScanAsync <T>(ScanOperationConfig scanConfig, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <AsyncSearch <T> >( () => { if (scanConfig == null) { throw new ArgumentNullException("scanConfig"); } var scan = ConvertFromScan <T>(scanConfig, operationConfig); return(FromSearchAsync <T>(scan)); }, asyncOptions, callback); }
/// <summary> /// Configures an async Scan operation against DynamoDB, finding items /// that match the specified conditions. /// </summary> /// <typeparam name="T">Type of object.</typeparam> /// <param name="conditions"> /// Conditions that the results should meet. /// </param> /// <param name="operationConfig">Config object which can be used to override that table used.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void ScanAsync <T>(IEnumerable <ScanCondition> conditions, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <AsyncSearch <T> >( () => { if (conditions == null) { throw new ArgumentNullException("conditions"); } var scan = ConvertScan <T>(conditions, operationConfig); return(FromSearchAsync <T>(scan)); }, asyncOptions, callback); }
/// <summary> /// Creates a strongly-typed BatchWrite object, allowing /// a batch-write operation against DynamoDB. /// </summary> /// <typeparam name="T">Type of objects to write</typeparam> /// <returns>Empty strongly-typed BatchWrite object</returns> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void CreateBatchWriteAsync <T>(AmazonDynamoDBCallback <BatchWrite <T> > callback, AsyncOptions asyncOptions = null) { CreateBatchWriteAsync <T>(null, callback, asyncOptions); }
/// <summary> /// Initiates the asynchronous execution of the GetItem operation. /// </summary> /// <param name="key">Key of the document.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void GetItemAsync(IDictionary<string, DynamoDBEntry> key, AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<Document>( () => { return GetItemHelper(MakeKey(key), null, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the UpdateItem operation. /// </summary> /// <param name="doc">Attributes to update.</param> /// <param name="key">Key of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void UpdateItemAsync(Document doc, IDictionary<string, DynamoDBEntry> key, UpdateItemOperationConfig config, AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<Document>( () => { return UpdateHelper(doc, MakeKey(key), config, true); }, asyncOptions, callback); }
/// <summary> /// Creates a Table object with the specified name, using the /// passed-in client to load the table definition. /// /// This method return an exception if the table does not exist within the callback. /// </summary> /// <param name="ddbClient">Client to use to access DynamoDB.</param> /// <param name="tableName">Name of the table.</param> /// <param name="conversion">Conversion to use for converting .NET values to DynamoDB values.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</para> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</para> public static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback <Table> callback, AsyncOptions asyncOptions = null) { LoadTableAsync(ddbClient, tableName, DynamoDBConsumer.DocumentModel, conversion, callback, asyncOptions); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// </summary> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(Primitive hashKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(hashKey, null), null, true); }, asyncOptions, callback); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// </summary> /// <param name="document">Document to delete.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(Document document, DeleteItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(document), config, true); }, asyncOptions, callback); }
/// <summary> /// Creates a Table object with the specified name, using the /// passed-in client to load the table definition. /// The returned table will use the conversion specified by /// AWSConfigs.DynamoDBConfig.ConversionSchema /// /// This method return an exception if the table does not exist within the callback. /// </summary> /// <param name="ddbClient">Client to use to access DynamoDB.</param> /// <param name="tableName">Name of the table.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, AmazonDynamoDBCallback<Table> callback, AsyncOptions asyncOptions = null) { LoadTableAsync(ddbClient,tableName, DynamoDBEntryConversion.CurrentConversion, callback,asyncOptions); }
/// <summary> /// Initiates the asynchronous execution of the DeleteItem operation. /// </summary> /// <param name="key">Key of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void DeleteItemAsync(IDictionary<string, DynamoDBEntry> key, DeleteItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync( () => { DeleteHelper(MakeKey(key), config, true); }, asyncOptions, callback); }
/// <summary> /// Creates a Table object with the specified name, using the /// passed-in client to load the table definition. /// /// This method return an exception if the table does not exist within the callback. /// </summary> /// <param name="ddbClient">Client to use to access DynamoDB.</param> /// <param name="tableName">Name of the table.</param> /// <param name="conversion">Conversion to use for converting .NET values to DynamoDB values.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback<Table> callback, AsyncOptions asyncOptions = null) { LoadTableAsync(ddbClient,tableName, DynamoDBConsumer.DocumentModel, conversion,callback,asyncOptions); }
/// <summary> /// Initiates the asynchronous execution of the UpdateItem operation. /// </summary> /// <param name="doc">Attributes to update.</param> /// <param name="hashKey">Hash key element of the document.</param> /// <param name="rangeKey">Range key element of the document.</param> /// <param name="config">Configuration to use.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public void UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync<Document>( () => { return UpdateHelper(doc, MakeKey(hashKey, rangeKey), config, true); }, asyncOptions, callback); }
internal static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback <Table> callback, AsyncOptions asyncOptions = null) { asyncOptions = asyncOptions ?? new AsyncOptions(); DynamoDBAsyncExecutor.ExecuteAsync <Table>( () => { return(LoadTable(ddbClient, tableName, consumer, conversion)); }, asyncOptions, callback); }