2

I went through the documentation of minio-go-api. But didn't get any solution for that, as objects are sorted based on the alphabetic order.

A hack way, will be to first read all the objects and then take last modified date from each object and form the new list, which is not at all feasible for production

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Siddhanta Rath
  • 976
  • 3
  • 21
  • 37

2 Answers2

1

@Siddhanta Rath, One way to handle this is to use mc tool. Command mc find --newer and mc find --older will handle this. But internally, it will do listObjects and do the sorting for you.

The other approach would be to subscribe to notification and make sure that there is a list of uploaded objects in a database.

r1j1m1n1
  • 345
  • 1
  • 4
0

There is no capability to specify sort order in the Amazon S3 API. Your application will need to sort the objects into the desired oder.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • 1
    In a bucket, there are 2 millions of record and requirement is to get the list of records during a particular period. Is it wise to iterate through 2 millions of records to get the desired results ? – Siddhanta Rath Nov 16 '18 at 16:59
  • You might prefer using [Amazon S3 Inventory - Amazon Simple Storage Service](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html), which can provide a daily listing of all the objects in the bucket. – John Rotenstein Nov 16 '18 at 17:05
  • Actually, we are using self-hosted minio server at our production,not the amazon s3. I I don't think, I can use that :( – Siddhanta Rath Nov 16 '18 at 17:23
  • 1
    Ah! Correct. You might want to ask Minio whether they have additional features that might help you. – John Rotenstein Nov 16 '18 at 17:47