Skip to content

Commit

Permalink
Merge pull request #1722 from 0chain/feat/num-objects
Browse files Browse the repository at this point in the history
Add number of files
  • Loading branch information
dabasov authored Jan 11, 2025
2 parents 5467083 + 8775498 commit ae439a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions zboxcore/fileref/fileref.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type Ref struct {
AllocationRoot string `json:"allocation_root" mapstructure:"allocation_root"`
CreatedAt common.Timestamp `json:"created_at" mapstructure:"created_at"`
UpdatedAt common.Timestamp `json:"updated_at" mapstructure:"updated_at"`
NumFiles int `json:"num_files" mapstructure:"num_files"`
}

// GetReferenceLookup returns the lookup hash for a given allocationID and path
Expand Down
4 changes: 4 additions & 0 deletions zboxcore/sdk/listworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type ListResult struct {
ThumbnailSize int64 `json:"thumbnail_size"`
ActualThumbnailHash string `json:"actual_thumbnail_hash"`
ActualThumbnailSize int64 `json:"actual_thumbnail_size"`
NumFiles int `json:"num_files"`

CreatedAt common.Timestamp `json:"created_at"`
UpdatedAt common.Timestamp `json:"updated_at"`
Expand Down Expand Up @@ -266,6 +267,9 @@ func (req *ListRequest) GetListFromBlobbers() (*ListResult, error) {
result.ThumbnailSize = ti.ref.ThumbnailSize
result.ActualThumbnailHash = ti.ref.ActualThumbnailHash
result.ActualThumbnailSize = ti.ref.ActualThumbnailSize
if result.Path == "/" && req.storageVersion == StorageV2 {
result.NumFiles = ti.ref.NumFiles
}

if ti.ref.ActualSize > 0 {
result.ActualNumBlocks = (ti.ref.ActualSize + CHUNK_SIZE - 1) / CHUNK_SIZE
Expand Down

0 comments on commit ae439a7

Please sign in to comment.