From f947e65f152b6214ca2fbe5e784060a32a1a4154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Jul 2022 20:09:21 +0200 Subject: [PATCH] wip storage redeclare/detach --- api/api_storage.go | 6 +- api/api_worker.go | 4 +- api/proxy_gen.go | 28 ++++++- build/openrpc/full.json.gz | Bin 28036 -> 28041 bytes build/openrpc/gateway.json.gz | Bin 4893 -> 4893 bytes build/openrpc/miner.json.gz | Bin 14241 -> 14241 bytes build/openrpc/worker.json.gz | Bin 4764 -> 4841 bytes cmd/lotus-worker/sealworker/rpc.go | 52 +++++++++++++ documentation/en/api-v0-methods-miner.md | 2 +- documentation/en/api-v0-methods-worker.md | 30 ++++++++ storage/paths/index.go | 89 ++++++++++++++++++++++ storage/paths/local.go | 23 ++++++ storage/paths/mocks/index.go | 14 ++++ 13 files changed, 243 insertions(+), 5 deletions(-) diff --git a/api/api_storage.go b/api/api_storage.go index e9135e30d..bb679d63f 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -175,6 +175,10 @@ type StorageMiner interface { StorageAuthVerify(ctx context.Context, token string) ([]auth.Permission, error) //perm:read + StorageAddLocal(ctx context.Context, path string) error //perm:admin + //StorageDetachLocal(ctx context.Context, path string) error //perm:admin + //StorageRedeclareLocal(ctx context.Context, id storiface.ID) error //perm:admin + MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) //perm:read @@ -272,8 +276,6 @@ type StorageMiner interface { DealsConsiderUnverifiedStorageDeals(context.Context) (bool, error) //perm:admin DealsSetConsiderUnverifiedStorageDeals(context.Context, bool) error //perm:admin - StorageAddLocal(ctx context.Context, path string) error //perm:admin - PiecesListPieces(ctx context.Context) ([]cid.Cid, error) //perm:read PiecesListCidInfos(ctx context.Context) ([]cid.Cid, error) //perm:read PiecesGetPieceInfo(ctx context.Context, pieceCid cid.Cid) (*piecestore.PieceInfo, error) //perm:read diff --git a/api/api_worker.go b/api/api_worker.go index 17dac8e3d..4e1a5e3df 100644 --- a/api/api_worker.go +++ b/api/api_worker.go @@ -59,7 +59,9 @@ type Worker interface { // Storage / Other Remove(ctx context.Context, sector abi.SectorID) error //perm:admin - StorageAddLocal(ctx context.Context, path string) error //perm:admin + StorageAddLocal(ctx context.Context, path string) error //perm:admin + StorageDetachLocal(ctx context.Context, path string) error //perm:admin + StorageRedeclareLocal(ctx context.Context, id storiface.ID) error //perm:admin // SetEnabled marks the worker as enabled/disabled. Not that this setting // may take a few seconds to propagate to task scheduler diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 401a37ec2..d0097ed8e 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -850,7 +850,7 @@ type StorageMinerStruct struct { SectorsUpdate func(p0 context.Context, p1 abi.SectorNumber, p2 SectorState) error `perm:"admin"` - StorageAddLocal func(p0 context.Context, p1 string) error `perm:"admin"` + StorageAddLocal func(p0 context.Context, p1 string) error `` StorageAttach func(p0 context.Context, p1 storiface.StorageInfo, p2 fsutil.FsStat) error `perm:"admin"` @@ -967,6 +967,10 @@ type WorkerStruct struct { StorageAddLocal func(p0 context.Context, p1 string) error `perm:"admin"` + StorageDetachLocal func(p0 context.Context, p1 string) error `perm:"admin"` + + StorageRedeclareLocal func(p0 context.Context, p1 storiface.ID) error `perm:"admin"` + TaskDisable func(p0 context.Context, p1 sealtasks.TaskType) error `perm:"admin"` TaskEnable func(p0 context.Context, p1 sealtasks.TaskType) error `perm:"admin"` @@ -5571,6 +5575,28 @@ func (s *WorkerStub) StorageAddLocal(p0 context.Context, p1 string) error { return ErrNotSupported } +func (s *WorkerStruct) StorageDetachLocal(p0 context.Context, p1 string) error { + if s.Internal.StorageDetachLocal == nil { + return ErrNotSupported + } + return s.Internal.StorageDetachLocal(p0, p1) +} + +func (s *WorkerStub) StorageDetachLocal(p0 context.Context, p1 string) error { + return ErrNotSupported +} + +func (s *WorkerStruct) StorageRedeclareLocal(p0 context.Context, p1 storiface.ID) error { + if s.Internal.StorageRedeclareLocal == nil { + return ErrNotSupported + } + return s.Internal.StorageRedeclareLocal(p0, p1) +} + +func (s *WorkerStub) StorageRedeclareLocal(p0 context.Context, p1 storiface.ID) error { + return ErrNotSupported +} + func (s *WorkerStruct) TaskDisable(p0 context.Context, p1 sealtasks.TaskType) error { if s.Internal.TaskDisable == nil { return ErrNotSupported diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index 8ff1c06f49e820c252d2fdfa2b178936125e60b0..bc7ebd3f9b84c39c5ff4c9ba1310cf3950b9bc10 100644 GIT binary patch delta 27512 zcmV)^K!Cr5+X0E&0gxMi-r^*#I`x#7EWYC;zP4v_&xv#IKqMq#OaUAMw5>_yyZ;Ld zNpKZNQHgBh)YOSZVrhUt_pcj`?r#GcA`*q(V1KZ+vAwZ37!EKQ)4~3?0mnQ*gZ;rN z