goduf.go
changeset 41 bce80b708ddb
parent 40 7f9cdb9d166d
child 42 3fa13770e970
equal deleted inserted replaced
40:7f9cdb9d166d 41:bce80b708ddb
    59 	IgnoreEmpty bool
    59 	IgnoreEmpty bool
    60 }
    60 }
    61 
    61 
    62 // Results contains the results of the duplicates search
    62 // Results contains the results of the duplicates search
    63 type Results struct {
    63 type Results struct {
    64 	Groups             []ResultSet `json:"groups"`
    64 	Groups             []ResultSet `json:"groups"`                // List of duplicate sets
    65 	Duplicates         uint        `json:"duplicates"`
    65 	Duplicates         uint        `json:"duplicates"`            // Number of duplicates
    66 	NumberOfSets       uint        `json:"number_of_sets"`
    66 	NumberOfSets       uint        `json:"number_of_sets"`        // Number of duplicate sets
    67 	RedundantDataSize  uint64      `json:"redundant_data_size"`
    67 	RedundantDataSize  uint64      `json:"redundant_data_size"`   // Redundant data size
    68 	RedundantDataSizeH string      `json:"redundant_data_size_h"`
    68 	RedundantDataSizeH string      `json:"redundant_data_size_h"` // Same, human-readable
    69 	TotalFileCount     uint        `json:"total_file_count"`
    69 	TotalFileCount     uint        `json:"total_file_count"`      // Total number of checked files
       
    70 	TotalSize          uint64      `json:"total_size"`            // Total size for checked files
       
    71 	TotalSizeH         string      `json:"total_size_h"`          // Same, human-readable
    70 }
    72 }
    71 
    73 
    72 // ResultSet contains a group of identical duplicate files
    74 // ResultSet contains a group of identical duplicate files
    73 type ResultSet struct {
    75 type ResultSet struct {
    74 	Size  uint64   `json:"size"`  // Size of each item
    76 	Size  uint64   `json:"size"`  // Size of each item
   530 		results.Groups = append(results.Groups, newSet)
   532 		results.Groups = append(results.Groups, newSet)
   531 	}
   533 	}
   532 	results.NumberOfSets = uint(len(results.Groups))
   534 	results.NumberOfSets = uint(len(results.Groups))
   533 	results.RedundantDataSizeH = formatSize(results.RedundantDataSize, true)
   535 	results.RedundantDataSizeH = formatSize(results.RedundantDataSize, true)
   534 	results.TotalFileCount = data.cmpt
   536 	results.TotalFileCount = data.cmpt
       
   537 	results.TotalSize = data.totalSize
       
   538 	results.TotalSizeH = formatSize(data.totalSize, true)
   535 
   539 
   536 	return results, nil
   540 	return results, nil
   537 }
   541 }
   538 
   542 
   539 // It all starts here.
   543 // It all starts here.