Ejemplo n.º 1
0
        // [END bigtable_filters_limit_block_all]

        // [START bigtable_filters_limit_pass_all]
        /// <summary>
        /// /// Read using a pass all filter from an existing table.
        ///</summary>
        /// <param name="projectId">Your Google Cloud Project ID.</param>
        /// <param name="instanceId">Your Google Cloud Bigtable Instance ID.</param>
        /// <param name="tableId">Your Google Cloud Bigtable table ID.</param>

        public string filterLimitPassAll(string projectId = "YOUR-PROJECT-ID", string instanceId = "YOUR-INSTANCE-ID", string tableId = "YOUR-TABLE-ID")
        {
            // A filter that matches all cells
            RowFilter filter = RowFilters.PassAllFilter();

            return(readFilter(projectId, instanceId, tableId, filter));
        }
Ejemplo n.º 2
0
        public async Task CheckAndMutateRow_Validate_RowKey()
        {
            var client    = new TestBigtableClient();
            var tableName = new TableName("project", "instance", "table");

            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                "",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                new byte[0],
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                ByteString.Empty,
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
Ejemplo n.º 3
0
        public async Task CheckAndMutateRow_Validate_Mutations()
        {
            var tableName = new TableName("project", "instance", "table");

            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                null,
                null);
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                new Mutation[0],
                new Mutation[0]);
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                new Mutation[] { null },
                new[] { Mutations.DeleteFromRow() },
                callTrueMutationsOnlyOverload : false);
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new Mutation[] { null },
                callTrueMutationsOnlyOverload : false);
        }
Ejemplo n.º 4
0
        public void Condition_Validations()
        {
            Assert.Throws <ArgumentNullException>
                (() => RowFilters.Condition(null, RowFilters.PassAllFilter(), RowFilters.PassAllFilter()));

            // The true/false mutations are allowed to be null.
            RowFilters.Condition(RowFilters.PassAllFilter(), null, null);
        }
Ejemplo n.º 5
0
 public async Task CheckAndMutateRow_Validate_TableName()
 {
     await CheckAndMutateRow_ValidateArguments <ArgumentNullException>(
         null,
         "abc",
         RowFilters.PassAllFilter(),
         new[] { Mutations.DeleteFromRow() },
         new[] { Mutations.DeleteFromRow() });
 }
Ejemplo n.º 6
0
        public async Task CheckAndMutateRow_Validate_RowKey(BigtableByteString rowKey)
        {
            var tableName = new TableName("project", "instance", "table");

            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                rowKey,
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
        }
Ejemplo n.º 7
0
        public async Task CheckAndMutateRow_Valid_Request()
        {
            var tableName = new TableName("project", "instance", "table");

            await CheckAndMutateRow_ValidateArguments <RequestMadeException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
        }
        private CheckAndMutateRowRequest ToMutateRowIfNotExistsRequest(IPersistentRepresentation persistent, ActorSystem system)
        {
            var request = new CheckAndMutateRowRequest();

            request.TableNameAsTableName = _tableName;
            var payload = PersistentToBytes(persistent, system);

            request.PredicateFilter = RowFilters.PassAllFilter();
            request.RowKey          = ByteString.CopyFromUtf8(ToRowKeyString(persistent.PersistenceId, persistent.SequenceNr));
            request.FalseMutations.Add(Mutations.SetCell(_family, PayloadColumnQualifier, payload, new BigtableVersion(-1)));
            return(request);
        }
Ejemplo n.º 9
0
        public static async Task HasNoValuesAsync(
            BigtableClient client,
            TableName tableName,
            BigtableByteString rowKey,
            string familyName = null)
        {
            var filter = familyName == null
                ? RowFilters.PassAllFilter()
                : RowFilters.FamilyNameExact(familyName);

            Assert.Null(await client.ReadRowAsync(tableName, rowKey, filter));
        }
Ejemplo n.º 10
0
        public async Task CheckAndMutateRow_Valid_Request()
        {
            var client    = new TestBigtableClient();
            var tableName = new TableName("project", "instance", "table");

            // NotImplementedException means it got through the normal validations and tried to actually
            // make the request on the TestBigtableClient.
            await CheckAndMutateRow_ValidateArguments <NotImplementedException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
        }
Ejemplo n.º 11
0
        public void PassAllFilter()
        {
            var filter = RowFilters.PassAllFilter();

            Assert.True(filter.PassAllFilter);
        }
Ejemplo n.º 12
0
 public void Condition_Validations()
 {
     // The true/false mutations are allowed to be null.
     RowFilters.Condition(RowFilters.PassAllFilter(), null, null);
 }