如何在 minio 的单个请求中统计多个对象

How to stat multiple objects in a single request on minio

我正在 NodeJS 中使用 Minio 和 graphql,我想为我的 minio 资源设置一个数据加载器。

我知道 statObject 函数可以让我通过提供资源的存储桶和名称来获取资源的元数据。

我希望能够传入多个名称,基本上得到一个数组,其中包含具有我传递的名称的对象的元数据。

例如:

const objectNames = ['a.txt', 'b.txt', 'c.txt'];

minioClient.statObjects('bucket', objectNames, (err, res) => {});

我在文档中或在网上搜索时都没有找到类似的内容。有这样的东西吗?

我在 JavaScript 存储库上提出了一个问题:https://github.com/minio/minio-js/issues/889 并得到了以下响应。

SDK will still have to make a call individually and return the values. There is no S3 API that corresponds to this feature request. I think the application itself can handle this instead of the SDK.Closing this issue, please feel free to reach out to us if you feel otherwsie

因为没有 S3 API 可以做我想做的事,我认为目前这不可能。我为自己设计了一种解决方法,即使用我自己的数据库来存储文件的元数据。我可以简单地列出存储桶中的所有对象并将它们的元数据上传到我自己的数据库。大多数数据库都支持通过值数组进行查询,这将有助于避免任何 N+1 问题。