public Task <bool> RemoveRow(GrainReference grainRef, string reminderName, string eTag)
 {
     return(Task.Run(() =>
     {
         var key = CreateKey(grainRef, reminderName);
         return _client.Delete(null, key);
     }));
 }
Beispiel #2
0
        public void DeleteReachesTheServer()
        {
            _lastMethod = null;
            Func <Task> delete = () => AsyncClient.Delete("~/");

            delete.ShouldNotThrow();
            _lastMethod.Should().Be("Delete");
        }
Beispiel #3
0
        public async Task DeleteMembershipTableEntries(string clusterId)
        {
            var allEntries = await ReadAll();

            foreach (var entry in allEntries.Members)
            {
                _client.Delete(new WritePolicy(), new Key(_options.Namespace, _options.SetName, GetSiloEntityId(entry.Item1.SiloAddress)));
            }
        }
        public async Task ClearStateAsync(string grainType, GrainReference grainReference, IGrainState grainState)
        {
            var key = GetKey(grainReference, grainState);

            try
            {
                await _client.Delete(_writeStatePolicy, Task.Factory.CancellationToken, key);

                grainState.ETag         = null;
                grainState.RecordExists = false;
            }
            catch (AerospikeException aep)
            {
                _logger.LogError(aep, $"Failure clearing state for Grain Type {grainType} with key {grainReference.ToKeyString()}.");
                throw new AerospikeOrleansException(aep.Message);
            }
            catch (Exception exp)
            {
                _logger.LogError(exp, $"Failure clearing state for Grain Type {grainType} with key {grainReference.ToKeyString()}.");
            }
        }
        public Task DeleteEntity <TEntity>(string key) where TEntity : IAeroEntity, new()
        {
            Key aeroKey = new Key(_namespace, typeof(TEntity).Name, key);

            return(_aerospikeClient.Delete(null, CancellationTokenSource.Token, aeroKey));
        }
Beispiel #6
0
 private Task <bool> DeleteInternal(Key key, CancellationToken token) => _client.Delete(_writePolicy, token, key);
Beispiel #7
0
        public void Remove(string key)
        {
            Connect();

            client.Delete(null, new Key(config.Namespace, config.Set, key));
        }
Beispiel #8
0
        static async Task Main(string[] args)
        {
            var host = Host();

            var client = new AsyncClient(host.Item1, host.Item2);

            var key1 = new Key("test", "myset1", "mykey1");
            var key2 = new Key("test", "myset2", "mykey2");
            var key3 = new Key("test", "myset3", "mykey3");

            var bin1 = new Bin("name", "John");
            var bin2 = new Bin("age", 25);
            var bin3 = new Bin("hello", "world");
            var bin4 = new Bin("first", "first");
            var bin5 = new Bin("first", "last");

            // Synchronous methods
            client.Put(null, key1, bin1, bin2);
            client.Add(null, key1, bin3);
            client.Prepend(null, key1, bin4);
            client.Append(null, key1, bin5);

            _ = client.Get(null, key1);
            _ = client.Exists(null, key1);
            _ = client.Get(null, new[] { key1, key2, key3 });
            _ = client.Exists(null, new[] { key1, key2, key3 });

            client.CreateIndex(null, "test", "myset1", indexName: "age", binName: "age", IndexType.NUMERIC).Wait();

            var statement = new Statement
            {
                Namespace = "test",
                SetName   = "myset1",
                BinNames  = new[] { "name", "age" },
                Filter    = Filter.Range("age", 20, 30)
            };

            var result = client.Query(new QueryPolicy(), statement);

            while (result.Next())
            {
                ;                   // Force the query to execute
            }
            client.Delete(null, key1);

            // Asynchronous methods
            await client.Put(null, CancellationToken.None, key1, bin1, bin2);

            await client.Add(null, CancellationToken.None, key1, bin3);

            await client.Prepend(null, CancellationToken.None, key1, bin4);

            await client.Append(null, CancellationToken.None, key1, bin5);

            _ = await client.Get(null, CancellationToken.None, key1);

            _ = await client.Exists(null, CancellationToken.None, key1);

            _ = await client.Get(null, CancellationToken.None, new[] { key1, key2, key3 });

            _ = await client.Exists(null, CancellationToken.None, new[] { key1, key2, key3 });

            await client.Delete(null, CancellationToken.None, key1);

            client.DropIndex(null, "test", "myset1", indexName: "age").Wait();

            client.Close();
        }