示例#1
0
        /// <summary>Snippet for CheckAndMutateRowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task CheckAndMutateRow1Async()
        {
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            string                 tableName       = "projects/[PROJECT]/instances/[INSTANCE]/tables/[TABLE]";
            ByteString             rowKey          = ByteString.Empty;
            RowFilter              predicateFilter = new RowFilter();
            IEnumerable <Mutation> trueMutations   = new Mutation[] { new Mutation(), };
            IEnumerable <Mutation> falseMutations  = new Mutation[] { new Mutation(), };
            // Make the request
            CheckAndMutateRowResponse response = await bigtableClient.CheckAndMutateRowAsync(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
        }
示例#2
0
        /// <summary>Snippet for CheckAndMutateRowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task CheckAndMutateRow1ResourceNamesAsync()
        {
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            TableName              tableName       = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
            ByteString             rowKey          = ByteString.Empty;
            RowFilter              predicateFilter = new RowFilter();
            IEnumerable <Mutation> trueMutations   = new Mutation[] { new Mutation(), };
            IEnumerable <Mutation> falseMutations  = new Mutation[] { new Mutation(), };
            // Make the request
            CheckAndMutateRowResponse response = await bigtableClient.CheckAndMutateRowAsync(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
        }
        public async Task CheckAndMutateRowAsync_RequestObject()
        {
            // Snippet: CheckAndMutateRowAsync(CheckAndMutateRowRequest,CallSettings)
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            CheckAndMutateRowRequest request = new CheckAndMutateRowRequest
            {
                TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
                RowKey    = ByteString.CopyFromUtf8(""),
            };
            // Make the request
            CheckAndMutateRowResponse response = await bigtableClient.CheckAndMutateRowAsync(request);

            // End snippet
        }
        public async Task CheckAndMutateRowAsync()
        {
            // Snippet: CheckAndMutateRowAsync(string,ByteString,IEnumerable<Mutation>,IEnumerable<Mutation>,CallSettings)
            // Additional: CheckAndMutateRowAsync(string,ByteString,IEnumerable<Mutation>,IEnumerable<Mutation>,CancellationToken)
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            string                 formattedTableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString();
            ByteString             rowKey             = ByteString.CopyFromUtf8("");
            IEnumerable <Mutation> trueMutations      = new List <Mutation>();
            IEnumerable <Mutation> falseMutations     = new List <Mutation>();
            // Make the request
            CheckAndMutateRowResponse response = await bigtableClient.CheckAndMutateRowAsync(formattedTableName, rowKey, trueMutations, falseMutations);

            // End snippet
        }
        /// <summary>Snippet for CheckAndMutateRowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task CheckAndMutateRowRequestObjectAsync()
        {
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            CheckAndMutateRowRequest request = new CheckAndMutateRowRequest
            {
                TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"),
                RowKey          = ByteString.Empty,
                TrueMutations   = { new Mutation(), },
                FalseMutations  = { new Mutation(), },
                PredicateFilter = new RowFilter(),
                AppProfileId    = "",
            };
            // Make the request
            CheckAndMutateRowResponse response = await bigtableClient.CheckAndMutateRowAsync(request);
        }
        protected override async Task <IImmutableList <Exception> > WriteMessagesAsync(IEnumerable <AtomicWrite> messages)
        {
            var actorSystem = Context.System;

            foreach (var atomicWrite in messages)
            {
                var request  = ToBigtableWriteRequest(atomicWrite, actorSystem);
                var response = await _bigtableClient.CheckAndMutateRowAsync(request).ConfigureAwait(false);

                if (response.PredicateMatched) // row already existed
                {
                    var msg = $"The journal event already exists: {atomicWrite.PersistenceId}-{atomicWrite.LowestSequenceNr}";
                    _log.Error(msg);
                    throw new IllegalActorStateException(msg);
                }
            }
            return(null);
        }
示例#7
0
        /// <summary>Snippet for CheckAndMutateRowAsync</summary>
        public async Task CheckAndMutateRow2ResourceNamesAsync()
        {
            // Snippet: CheckAndMutateRowAsync(TableName, ByteString, RowFilter, IEnumerable<Mutation>, IEnumerable<Mutation>, string, CallSettings)
            // Additional: CheckAndMutateRowAsync(TableName, ByteString, RowFilter, IEnumerable<Mutation>, IEnumerable<Mutation>, string, CancellationToken)
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            TableName              tableName       = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
            ByteString             rowKey          = ByteString.Empty;
            RowFilter              predicateFilter = new RowFilter();
            IEnumerable <Mutation> trueMutations   = new Mutation[] { new Mutation(), };
            IEnumerable <Mutation> falseMutations  = new Mutation[] { new Mutation(), };
            string appProfileId = "";
            // Make the request
            CheckAndMutateRowResponse response = await bigtableClient.CheckAndMutateRowAsync(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);

            // End snippet
        }