Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
rename total to size in stat
Browse files Browse the repository at this point in the history
  • Loading branch information
g0rbe committed Jul 27, 2023
1 parent 07b5eb1 commit 8b9ea56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions db/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func ScannerGetIndexes() ([]ScannerSchema, error) {
return nil, fmt.Errorf("failed to decode: %w", err)
}

err = sc.UpdateTotal()
err = sc.UpdateSize()
if err != nil {
return nil, fmt.Errorf("failed to update total of %s: %w", sc.Name, err)
return nil, fmt.Errorf("failed to update size of %s: %w", sc.Name, err)
}

scs = append(scs, *sc)
Expand Down
8 changes: 4 additions & 4 deletions db/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ func (d *DomainSchema) FullDomain() string {
type ScannerSchema struct {
Name string `bson:"name" json:"name"`
Index int64 `bson:"index" json:"index"`
Total int64 `bson:"-" json:"total"`
Size int64 `bson:"-" json:"size"`
}

func (s *ScannerSchema) UpdateTotal() error {
func (s *ScannerSchema) UpdateSize() error {

l := ctlog.LogByName(s.Name)
if l == nil {
return fmt.Errorf("invalid name")
}

total, err := ctlog.Size(l.URI)
size, err := ctlog.Size(l.URI)
if err != nil {
return fmt.Errorf("failed to get size: %w", err)
}

s.Total = total
s.Size = size

return nil
}

0 comments on commit 8b9ea56

Please sign in to comment.