示例#1
0
        public override async Task Get(DataSourceGetRequest request,
                                       IServerStreamWriter <DataSourceGetResponse> responseStream, ServerCallContext context)
        {
            var requestUid = Guid.NewGuid().ToString(); // TODO: Bind the UID to the request

            _logger.LogInformation($"Started processing Get request: '{requestUid}' from '{context.Peer}'");

            var(id, version, timestamp) = request.Deconstruct();

            foreach (var i in Enumerable.Range(0, _rowsInTheResponse))
            {
                var response = GenerateGetResponse(id, version, timestamp, i, _rowsInTheResponse);
                await responseStream.WriteAsync(response);
            }

            _logger.LogInformation($"Finished processing Get request: '{requestUid}' from '{context.Peer}'");
        }
示例#2
0
        public override async Task Get(DataSourceGetRequest request,
                                       IServerStreamWriter <DataSourceGetResponse> responseStream, ServerCallContext context)
        {
            var requestUid = Guid.NewGuid().ToString(); // TODO: Bind the UID to the request

            _logger.LogInformation($"Started processing Get request: '{requestUid}' from '{context.Peer}'");

            var(id, version, timestamp) = request.Deconstruct();

            var(_, mbpid) = request.Id.ToGrainKey();
            var rows = await ReadFileAsync($"{mbpid.Id.Key}/{mbpid.Version}", false);

            var i = 0;

            foreach (var row in rows)
            {
                var response = GenerateGetResponse(row, id, version, timestamp, i++, rows.Length);
                await responseStream.WriteAsync(response);
            }

            _logger.LogInformation($"Finished processing Get request: '{requestUid}' from '{context.Peer}'");
        }