forked from mtusi2026/mtusi2026lab5
feat: process attachments through durable versioned jobs
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package objectstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
|
||||
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/media"
|
||||
)
|
||||
|
||||
// List bounds each reconciliation page and cancels the SDK producer before returning.
|
||||
func (c *Client) List(ctx context.Context, after string) ([]media.ObjectInfo, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, operationTimeout)
|
||||
defer cancel()
|
||||
result := make([]media.ObjectInfo, 0, 1000)
|
||||
for object := range c.client.ListObjects(ctx, c.bucket, minio.ListObjectsOptions{Prefix: "", StartAfter: after, Recursive: true, MaxKeys: 1000}) {
|
||||
if object.Err != nil {
|
||||
return nil, object.Err
|
||||
}
|
||||
result = append(result, media.ObjectInfo{Key: object.Key, ModifiedAt: object.LastModified})
|
||||
if len(result) == 1000 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user