Example #1
0
        private async Task <IReadOnlyDictionary <TKey, TValue> > GetEntriesAsync(CancellationToken cancellationToken)
        {
            var requestMessage  = ReplicatedMapEntrySetCodec.EncodeRequest(Name);
            var responseMessage = await Cluster.Messaging.SendToPartitionOwnerAsync(requestMessage, _partitionId, cancellationToken).CfAwait();

            var response = ReplicatedMapEntrySetCodec.DecodeResponse(responseMessage).Response;

            return(new ReadOnlyLazyDictionary <TKey, TValue>(SerializationService)
            {
                response
            });
        }
        public async Task <IReadOnlyDictionary <TKey, TValue> > GetAsync()
        {
            var requestMessage  = ReplicatedMapEntrySetCodec.EncodeRequest(Name);
            var responseMessage = await Cluster.Messaging.SendToPartitionOwnerAsync(requestMessage, _partitionId).CAF();

            var response = ReplicatedMapEntrySetCodec.DecodeResponse(responseMessage).Response;

            return(new ReadOnlyLazyDictionary <TKey, TValue>(SerializationService)
            {
                response
            });
        }
Example #3
0
        public ISet <KeyValuePair <TKey, TValue> > EntrySet()
        {
            var request = ReplicatedMapEntrySetCodec.EncodeRequest(GetName());
            var entries = InvokeOnPartition(request, _targetPartitionId, m => ReplicatedMapEntrySetCodec.DecodeResponse(m).response);
            ISet <KeyValuePair <TKey, TValue> > entrySet = new HashSet <KeyValuePair <TKey, TValue> >();

            foreach (var entry in entries)
            {
                var key   = ToObject <TKey>(entry.Key);
                var value = ToObject <TValue>(entry.Value);
                entrySet.Add(new KeyValuePair <TKey, TValue>(key, value));
            }
            return(entrySet);
        }