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

Use minios disk package for cross-platform disk stats #62

Closed

Conversation

sanderpick
Copy link

Textile's powergate has a Lotus dependency. Powergate is leveraged by the hub, which has Linux and Darwin CLI builds. This syscall prevents us from releasing a Window build:

1 errors occurred:
--> windows/amd64 error: exit status 2
Stderr: # github.com/filecoin-project/sector-storage/stores
../../../go/pkg/mod/github.com/filecoin-project/sector-storage@v0.0.0-20200605192746-4b9317d1f08f/stores/interface.go:41:11: undefined: syscall.Statfs_t
../../../go/pkg/mod/github.com/filecoin-project/sector-storage@v0.0.0-20200605192746-4b9317d1f08f/stores/interface.go:42:12: undefined: syscall.Statfs

This PR just replaces syscall.Statfs with disk.GetInfo from https://github.com/minio/minio/tree/release/pkg/disk, which makes a library depending on Lotus compile on Windows.

@jsign
Copy link
Contributor

jsign commented Jun 30, 2020

Adding some extra info. Down the path of some dependency imports, the previous step to jump to this repo is the Lotus API using types for its API definitions: see here.

Copy link
Collaborator

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to import this without importing the whole minio dependency tree? (or a lighter library?)

@sanderpick
Copy link
Author

Some other lighter packages that I found:

Though, it's straightforward enough to just copy the minio implementation into here with the license. What's your preference?

@magik6k
Copy link
Collaborator

magik6k commented Jul 6, 2020

go-disk-usage looks good

Signed-off-by: Sander Pick <sanderpick@gmail.com>
@sanderpick sanderpick force-pushed the sander/cross-os-disk branch from 5c386d7 to 3784564 Compare July 6, 2020 15:41
@sanderpick
Copy link
Author

Okay, migrated to go-disk-usage.

if err := syscall.Statfs(path, &stat); err != nil {
return FsStat{}, xerrors.Errorf("statfs: %w", err)
}
di := du.NewDiskUsage(path)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magik6k
Copy link
Collaborator

magik6k commented Jul 8, 2020

The same thing is now addressed in https://github.com/filecoin-project/sector-storage/pull/66/files#diff-3edd672f6d345b2738ba957c8bb19960R1

Thanks for the PR anyways

@magik6k
Copy link
Collaborator

magik6k commented Jul 9, 2020

Done in #66

@magik6k magik6k closed this Jul 9, 2020
@sanderpick
Copy link
Author

Sure thing ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants