Exemplo n.º 1
0
        public async Task <ResponseModel> Read(string collectionId, HttpRequest request)
        {
            var typeId   = request.Query["type"].ToString().ToHash();
            var path     = Path.Combine(_config.Get("data_dir"), $"{typeId}.{collectionId.ToHash()}.rocks");
            var ids      = request.Query["id"].ToArray().Select(s => BitConverter.GetBytes(long.Parse(s))).ToArray();
            var payload  = _store.GetMany(ids);
            var response = new MemoryStream();

            foreach (var item in payload)
            {
                await response.WriteAsync(item.Value);
            }

            return(new ResponseModel {
                Stream = response, MediaType = "application/rocksdb+octet-stream"
            });
        }
Exemplo n.º 2
0
 public IDictionary <string, object> GetMany(string section)
 {
     return(_keyValueStore.GetMany(section));
 }