Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion models/fs_stat.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package models

import "time"

// FsStat model for file system statistics
type FsStat struct {
Size int64
Size int64
ETag string
LastModified time.Time
VersionID string
}
30 changes: 21 additions & 9 deletions oss/object_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"path"
"strings"
"time"

"github.com/cockroachdb/errors"
"github.com/minio/minio-go/v7"
Expand All @@ -19,10 +20,13 @@ type ObjectStore interface {
}

type ObjectInfo struct {
Key string
Size int64
IsDir bool
Err error
Key string
Size int64
ETag string
LastModified time.Time
VersionID string
IsDir bool
Err error
}

type ResolvedObjectStore struct {
Expand Down Expand Up @@ -112,7 +116,12 @@ func (s *minioObjectStore) Stat(ctx context.Context, key string) (*models.FsStat
if err != nil {
return nil, err
}
return &models.FsStat{Size: info.Size}, nil
return &models.FsStat{
Size: info.Size,
ETag: info.ETag,
LastModified: info.LastModified,
VersionID: info.VersionID,
}, nil
}

func (s *minioObjectStore) List(ctx context.Context, prefix string, recursive bool) (<-chan ObjectInfo, error) {
Expand All @@ -122,10 +131,13 @@ func (s *minioObjectStore) List(ctx context.Context, prefix string, recursive bo
defer close(result)
for info := range source {
result <- ObjectInfo{
Key: info.Key,
Size: info.Size,
IsDir: strings.HasSuffix(info.Key, "/"),
Err: info.Err,
Key: info.Key,
Size: info.Size,
ETag: info.ETag,
LastModified: info.LastModified,
VersionID: info.VersionID,
IsDir: strings.HasSuffix(info.Key, "/"),
Err: info.Err,
}
}
}()
Expand Down
Loading
Loading