Updates for sectors-storge next
This commit is contained in:
@@ -3,6 +3,7 @@ package impl
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/filecoin-project/sector-storage/fsutil"
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
"net/http"
|
||||
@@ -175,7 +176,7 @@ func (sm *StorageMinerAPI) SectorsRefs(context.Context) (map[string][]api.Sealed
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) StorageStat(ctx context.Context, id stores.ID) (stores.FsStat, error) {
|
||||
func (sm *StorageMinerAPI) StorageStat(ctx context.Context, id stores.ID) (fsutil.FsStat, error) {
|
||||
return sm.StorageMgr.FsStat(ctx, id)
|
||||
}
|
||||
|
||||
|
||||
+11
-2
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/filecoin-project/sector-storage/fsutil"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -340,8 +341,16 @@ func (fsr *fsLockedRepo) SetStorage(c func(*stores.StorageConfig)) error {
|
||||
return config.WriteStorageFile(fsr.join(fsStorageConfig), sc)
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) Stat(path string) (stores.FsStat, error) {
|
||||
return stores.Stat(path)
|
||||
func (fsr *fsLockedRepo) Stat(path string) (fsutil.FsStat, error) {
|
||||
return fsutil.Statfs(path)
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) DiskUsage(path string) (int64, error) {
|
||||
si, err := fsutil.FileSize(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return si.OnDisk, nil
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error {
|
||||
|
||||
@@ -2,6 +2,7 @@ package repo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/filecoin-project/sector-storage/fsutil"
|
||||
|
||||
"github.com/filecoin-project/sector-storage/stores"
|
||||
|
||||
@@ -42,7 +43,8 @@ type LockedRepo interface {
|
||||
|
||||
GetStorage() (stores.StorageConfig, error)
|
||||
SetStorage(func(*stores.StorageConfig)) error
|
||||
Stat(path string) (stores.FsStat, error)
|
||||
Stat(path string) (fsutil.FsStat, error)
|
||||
DiskUsage(path string) (int64, error)
|
||||
|
||||
// SetAPIEndpoint sets the endpoint of the current API
|
||||
// so it can be read by API clients
|
||||
|
||||
+12
-2
@@ -2,6 +2,7 @@ package repo
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/filecoin-project/sector-storage/fsutil"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -77,8 +78,17 @@ func (lmem *lockedMemRepo) SetStorage(c func(*stores.StorageConfig)) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (lmem *lockedMemRepo) Stat(path string) (stores.FsStat, error) {
|
||||
return stores.Stat(path)
|
||||
func (lmem *lockedMemRepo) Stat(path string) (fsutil.FsStat, error) {
|
||||
return fsutil.Statfs(path)
|
||||
}
|
||||
|
||||
|
||||
func (lmem *lockedMemRepo) DiskUsage(path string) (int64, error) {
|
||||
si, err := fsutil.FileSize(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return si.OnDisk, nil
|
||||
}
|
||||
|
||||
func (lmem *lockedMemRepo) Path() string {
|
||||
|
||||
Reference in New Issue
Block a user