From 8409e155d424e91c09cf0cfb9bf7725238f64b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 12 Nov 2020 10:29:42 +0100 Subject: [PATCH 1/4] docsgen: Support miner/worker structs --- Makefile | 4 +- api/docgen/docgen.go | 149 +++++++++++++++++++++----- extern/sector-storage/stores/index.go | 7 +- extern/sector-storage/stores/local.go | 9 +- 4 files changed, 135 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 535873614..a018e86f8 100644 --- a/Makefile +++ b/Makefile @@ -304,7 +304,9 @@ method-gen: gen: type-gen method-gen docsgen: - go run ./api/docgen > documentation/en/api-methods.md + go run ./api/docgen "api/api_full.go" "FullNode" > documentation/en/api-methods.md + go run ./api/docgen "api/api_storage.go" "StorageMiner" > documentation/en/api-methods-miner.md + go run ./api/docgen "api/api_worker.go" "WorkerAPI" > documentation/en/api-methods-worker.md print-%: @echo $*=$($*) diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index dc6004121..efb9edcb3 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -3,9 +3,16 @@ package main import ( "encoding/json" "fmt" + filestore2 "github.com/filecoin-project/go-fil-markets/filestore" + "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" + "github.com/filecoin-project/lotus/extern/sector-storage/stores" + "github.com/filecoin-project/lotus/extern/sector-storage/storiface" + sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + "github.com/google/uuid" "go/ast" "go/parser" "go/token" + "os" "reflect" "sort" "strings" @@ -117,17 +124,17 @@ func init() { addExample(network.ReachabilityPublic) addExample(build.NewestNetworkVersion) addExample(&types.ExecutionTrace{ - Msg: exampleValue(reflect.TypeOf(&types.Message{}), nil).(*types.Message), - MsgRct: exampleValue(reflect.TypeOf(&types.MessageReceipt{}), nil).(*types.MessageReceipt), + Msg: exampleValue("init", reflect.TypeOf(&types.Message{}), nil).(*types.Message), + MsgRct: exampleValue("init", reflect.TypeOf(&types.MessageReceipt{}), nil).(*types.MessageReceipt), }) addExample(map[string]types.Actor{ - "t01236": exampleValue(reflect.TypeOf(types.Actor{}), nil).(types.Actor), + "t01236": exampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor), }) addExample(map[string]api.MarketDeal{ - "t026363": exampleValue(reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal), + "t026363": exampleValue("init", reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal), }) addExample(map[string]api.MarketBalance{ - "t026363": exampleValue(reflect.TypeOf(api.MarketBalance{}), nil).(api.MarketBalance), + "t026363": exampleValue("init", reflect.TypeOf(api.MarketBalance{}), nil).(api.MarketBalance), }) addExample(map[string]*pubsub.TopicScoreSnapshot{ "/blocks": { @@ -162,9 +169,82 @@ func init() { // because reflect.TypeOf(maddr) returns the concrete type... ExampleValues[reflect.TypeOf(struct{ A multiaddr.Multiaddr }{}).Field(0).Type] = maddr + // miner specific + addExample(filestore2.Path(".lotusminer/fstmp123")) + si := multistore.StoreID(12) + addExample(&si) + addExample(retrievalmarket.DealID(5)) + addExample(abi.ActorID(1000)) + addExample(map[string][]api.SealedRef{ + "98000": { + api.SealedRef{ + SectorID: 100, + Offset: 10 << 20, + Size: 1 << 20, + }, + }, + }) + addExample(api.SectorState(sealing.Proving)) + addExample(stores.ID("76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8")) + addExample(storiface.FTUnsealed) + addExample(storiface.PathSealing) + addExample(map[stores.ID][]stores.Decl{ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": { + { + SectorID: abi.SectorID{Miner: 1000, Number: 100}, + SectorFileType: storiface.FTSealed, + }, + }, + }) + addExample(map[stores.ID]string{ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": "/data/path", + }) + addExample(map[uuid.UUID][]storiface.WorkerJob{ + uuid.MustParse("ef8d99a2-6865-4189-8ffa-9fef0f806eee"): { + { + ID: storiface.CallID{ + Sector: abi.SectorID{Miner: 1000, Number: 100}, + ID: uuid.MustParse("76081ba0-61bd-45a5-bc08-af05f1c26e5d"), + }, + Sector: abi.SectorID{Miner: 1000, Number: 100}, + Task: sealtasks.TTPreCommit2, + RunWait: 0, + Start: time.Unix(1605172927, 0), + Hostname: "host", + }, + }, + }) + addExample(map[uuid.UUID]storiface.WorkerStats{ + uuid.MustParse("ef8d99a2-6865-4189-8ffa-9fef0f806eee"): { + Info: storiface.WorkerInfo{ + Hostname: "host", + Resources: storiface.WorkerResources{ + MemPhysical: 256 << 30, + MemSwap: 120 << 30, + MemReserved: 2 << 30, + CPUs: 64, + GPUs: []string{"aGPU 1337"}, + }, + }, + Enabled: true, + MemUsedMin: 0, + MemUsedMax: 0, + GpuUsed: false, + CpuUse: 0, + }, + }) + + // worker specific + addExample(storiface.AcquireMove) + addExample(storiface.UnpaddedByteIndex(abi.PaddedPieceSize(1 << 20).Unpadded())) + addExample(map[sealtasks.TaskType]struct {}{ + sealtasks.TTPreCommit2: {}, + sealtasks.TTCommit1: {}, + sealtasks.TTCommit2: {}, + }) } -func exampleValue(t, parent reflect.Type) interface{} { +func exampleValue(method string, t, parent reflect.Type) interface{} { v, ok := ExampleValues[t] if ok { return v @@ -173,25 +253,25 @@ func exampleValue(t, parent reflect.Type) interface{} { switch t.Kind() { case reflect.Slice: out := reflect.New(t).Elem() - reflect.Append(out, reflect.ValueOf(exampleValue(t.Elem(), t))) + reflect.Append(out, reflect.ValueOf(exampleValue(method, t.Elem(), t))) return out.Interface() case reflect.Chan: - return exampleValue(t.Elem(), nil) + return exampleValue(method, t.Elem(), nil) case reflect.Struct: - es := exampleStruct(t, parent) + es := exampleStruct(method, t, parent) v := reflect.ValueOf(es).Elem().Interface() ExampleValues[t] = v return v case reflect.Array: out := reflect.New(t).Elem() for i := 0; i < t.Len(); i++ { - out.Index(i).Set(reflect.ValueOf(exampleValue(t.Elem(), t))) + out.Index(i).Set(reflect.ValueOf(exampleValue(method, t.Elem(), t))) } return out.Interface() case reflect.Ptr: if t.Elem().Kind() == reflect.Struct { - es := exampleStruct(t.Elem(), t) + es := exampleStruct(method, t.Elem(), t) //ExampleValues[t] = es return es } @@ -199,10 +279,10 @@ func exampleValue(t, parent reflect.Type) interface{} { return struct{}{} } - panic(fmt.Sprintf("No example value for type: %s", t)) + panic(fmt.Sprintf("No example value for type: %s (method '%s')", t, method)) } -func exampleStruct(t, parent reflect.Type) interface{} { +func exampleStruct(method string, t, parent reflect.Type) interface{} { ns := reflect.New(t) for i := 0; i < t.NumField(); i++ { f := t.Field(i) @@ -210,7 +290,7 @@ func exampleStruct(t, parent reflect.Type) interface{} { continue } if strings.Title(f.Name) == f.Name { - ns.Elem().Field(i).Set(reflect.ValueOf(exampleValue(f.Type, t))) + ns.Elem().Field(i).Set(reflect.ValueOf(exampleValue(method, f.Type, t))) } } @@ -218,6 +298,7 @@ func exampleStruct(t, parent reflect.Type) interface{} { } type Visitor struct { + Root string Methods map[string]ast.Node } @@ -227,7 +308,7 @@ func (v *Visitor) Visit(node ast.Node) ast.Visitor { return v } - if st.Name.Name != "FullNode" { + if st.Name.Name != v.Root { return nil } @@ -243,7 +324,7 @@ func (v *Visitor) Visit(node ast.Node) ast.Visitor { const noComment = "There are not yet any comments for this method." -func parseApiASTInfo() (map[string]string, map[string]string) { //nolint:golint +func parseApiASTInfo(apiFile, iface string) (map[string]string, map[string]string) { //nolint:golint fset := token.NewFileSet() pkgs, err := parser.ParseDir(fset, "./api", nil, parser.AllErrors|parser.ParseComments) if err != nil { @@ -252,11 +333,11 @@ func parseApiASTInfo() (map[string]string, map[string]string) { //nolint:golint ap := pkgs["api"] - f := ap.Files["api/api_full.go"] + f := ap.Files[apiFile] cmap := ast.NewCommentMap(fset, f, f.Comments) - v := &Visitor{make(map[string]ast.Node)} + v := &Visitor{iface, make(map[string]ast.Node)} ast.Walk(v, pkgs["api"]) groupDocs := make(map[string]string) @@ -312,13 +393,30 @@ func methodGroupFromName(mn string) string { } func main() { - - comments, groupComments := parseApiASTInfo() + comments, groupComments := parseApiASTInfo(os.Args[1], os.Args[2]) groups := make(map[string]*MethodGroup) - var api struct{ api.FullNode } - t := reflect.TypeOf(api) + var t reflect.Type + var permStruct, commonPermStruct reflect.Type + + switch os.Args[2] { + case "FullNode": + t = reflect.TypeOf(new(struct{ api.FullNode })).Elem() + permStruct = reflect.TypeOf(apistruct.FullNodeStruct{}.Internal) + commonPermStruct = reflect.TypeOf(apistruct.CommonStruct{}.Internal) + case "StorageMiner": + t = reflect.TypeOf(new(struct{ api.StorageMiner })).Elem() + permStruct = reflect.TypeOf(apistruct.StorageMinerStruct{}.Internal) + commonPermStruct = reflect.TypeOf(apistruct.CommonStruct{}.Internal) + case "WorkerAPI": + t = reflect.TypeOf(new(struct{ api.WorkerAPI })).Elem() + permStruct = reflect.TypeOf(apistruct.WorkerStruct{}.Internal) + commonPermStruct = reflect.TypeOf(apistruct.WorkerStruct{}.Internal) + default: + panic("unknown type") + } + for i := 0; i < t.NumMethod(); i++ { m := t.Method(i) @@ -336,7 +434,7 @@ func main() { ft := m.Func.Type() for j := 2; j < ft.NumIn(); j++ { inp := ft.In(j) - args = append(args, exampleValue(inp, nil)) + args = append(args, exampleValue(m.Name, inp, nil)) } v, err := json.MarshalIndent(args, "", " ") @@ -344,7 +442,7 @@ func main() { panic(err) } - outv := exampleValue(ft.Out(0), nil) + outv := exampleValue(m.Name, ft.Out(0), nil) ov, err := json.MarshalIndent(outv, "", " ") if err != nil { @@ -377,9 +475,6 @@ func main() { } } - permStruct := reflect.TypeOf(apistruct.FullNodeStruct{}.Internal) - commonPermStruct := reflect.TypeOf(apistruct.CommonStruct{}.Internal) - for _, g := range groupslice { g := g fmt.Printf("## %s\n", g.GroupName) diff --git a/extern/sector-storage/stores/index.go b/extern/sector-storage/stores/index.go index acd799ab7..eb3e7690f 100644 --- a/extern/sector-storage/stores/index.go +++ b/extern/sector-storage/stores/index.go @@ -2,6 +2,7 @@ package stores import ( "context" + "errors" "net/url" gopath "path" "sort" @@ -35,7 +36,7 @@ type StorageInfo struct { type HealthReport struct { Stat fsutil.FsStat - Err error + Err string } type SectorStorageInfo struct { @@ -175,7 +176,9 @@ func (i *Index) StorageReportHealth(ctx context.Context, id ID, report HealthRep } ent.fsi = report.Stat - ent.heartbeatErr = report.Err + if report.Err != "" { + ent.heartbeatErr = errors.New(report.Err) + } ent.lastHeartbeat = time.Now() return nil diff --git a/extern/sector-storage/stores/local.go b/extern/sector-storage/stores/local.go index f0e487da7..faa5c5176 100644 --- a/extern/sector-storage/stores/local.go +++ b/extern/sector-storage/stores/local.go @@ -308,11 +308,12 @@ func (st *Local) reportStorage(ctx context.Context) { toReport := map[ID]HealthReport{} for id, p := range st.paths { stat, err := p.stat(st.localStorage) - - toReport[id] = HealthReport{ - Stat: stat, - Err: err, + r := HealthReport{Stat: stat} + if err != nil { + r.Err = err.Error() } + + toReport[id] = r } st.localLk.RUnlock() From 2f0075752de0610bf8536fbf829113358bf75ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 12 Nov 2020 10:31:12 +0100 Subject: [PATCH 2/4] docsgen: generate miner/worker docs --- documentation/en/api-methods-miner.md | 1787 ++++++++++++++++++++++++ documentation/en/api-methods-worker.md | 539 +++++++ 2 files changed, 2326 insertions(+) create mode 100644 documentation/en/api-methods-miner.md create mode 100644 documentation/en/api-methods-worker.md diff --git a/documentation/en/api-methods-miner.md b/documentation/en/api-methods-miner.md new file mode 100644 index 000000000..22f027154 --- /dev/null +++ b/documentation/en/api-methods-miner.md @@ -0,0 +1,1787 @@ +# Groups +* [](#) + * [Closing](#Closing) + * [Session](#Session) + * [Shutdown](#Shutdown) + * [Version](#Version) +* [Actor](#Actor) + * [ActorAddress](#ActorAddress) + * [ActorSectorSize](#ActorSectorSize) +* [Auth](#Auth) + * [AuthNew](#AuthNew) + * [AuthVerify](#AuthVerify) +* [Create](#Create) + * [CreateBackup](#CreateBackup) +* [Deals](#Deals) + * [DealsConsiderOfflineRetrievalDeals](#DealsConsiderOfflineRetrievalDeals) + * [DealsConsiderOfflineStorageDeals](#DealsConsiderOfflineStorageDeals) + * [DealsConsiderOnlineRetrievalDeals](#DealsConsiderOnlineRetrievalDeals) + * [DealsConsiderOnlineStorageDeals](#DealsConsiderOnlineStorageDeals) + * [DealsImportData](#DealsImportData) + * [DealsList](#DealsList) + * [DealsPieceCidBlocklist](#DealsPieceCidBlocklist) + * [DealsSetConsiderOfflineRetrievalDeals](#DealsSetConsiderOfflineRetrievalDeals) + * [DealsSetConsiderOfflineStorageDeals](#DealsSetConsiderOfflineStorageDeals) + * [DealsSetConsiderOnlineRetrievalDeals](#DealsSetConsiderOnlineRetrievalDeals) + * [DealsSetConsiderOnlineStorageDeals](#DealsSetConsiderOnlineStorageDeals) + * [DealsSetPieceCidBlocklist](#DealsSetPieceCidBlocklist) +* [I](#I) + * [ID](#ID) +* [Log](#Log) + * [LogList](#LogList) + * [LogSetLevel](#LogSetLevel) +* [Market](#Market) + * [MarketCancelDataTransfer](#MarketCancelDataTransfer) + * [MarketDataTransferUpdates](#MarketDataTransferUpdates) + * [MarketGetAsk](#MarketGetAsk) + * [MarketGetDealUpdates](#MarketGetDealUpdates) + * [MarketGetRetrievalAsk](#MarketGetRetrievalAsk) + * [MarketImportDealData](#MarketImportDealData) + * [MarketListDataTransfers](#MarketListDataTransfers) + * [MarketListDeals](#MarketListDeals) + * [MarketListIncompleteDeals](#MarketListIncompleteDeals) + * [MarketListRetrievalDeals](#MarketListRetrievalDeals) + * [MarketRestartDataTransfer](#MarketRestartDataTransfer) + * [MarketSetAsk](#MarketSetAsk) + * [MarketSetRetrievalAsk](#MarketSetRetrievalAsk) +* [Mining](#Mining) + * [MiningBase](#MiningBase) +* [Net](#Net) + * [NetAddrsListen](#NetAddrsListen) + * [NetAgentVersion](#NetAgentVersion) + * [NetAutoNatStatus](#NetAutoNatStatus) + * [NetBandwidthStats](#NetBandwidthStats) + * [NetBandwidthStatsByPeer](#NetBandwidthStatsByPeer) + * [NetBandwidthStatsByProtocol](#NetBandwidthStatsByProtocol) + * [NetConnect](#NetConnect) + * [NetConnectedness](#NetConnectedness) + * [NetDisconnect](#NetDisconnect) + * [NetFindPeer](#NetFindPeer) + * [NetPeers](#NetPeers) + * [NetPubsubScores](#NetPubsubScores) +* [Pieces](#Pieces) + * [PiecesGetCIDInfo](#PiecesGetCIDInfo) + * [PiecesGetPieceInfo](#PiecesGetPieceInfo) + * [PiecesListCidInfos](#PiecesListCidInfos) + * [PiecesListPieces](#PiecesListPieces) +* [Pledge](#Pledge) + * [PledgeSector](#PledgeSector) +* [Return](#Return) + * [ReturnAddPiece](#ReturnAddPiece) + * [ReturnFetch](#ReturnFetch) + * [ReturnFinalizeSector](#ReturnFinalizeSector) + * [ReturnMoveStorage](#ReturnMoveStorage) + * [ReturnReadPiece](#ReturnReadPiece) + * [ReturnReleaseUnsealed](#ReturnReleaseUnsealed) + * [ReturnSealCommit1](#ReturnSealCommit1) + * [ReturnSealCommit2](#ReturnSealCommit2) + * [ReturnSealPreCommit1](#ReturnSealPreCommit1) + * [ReturnSealPreCommit2](#ReturnSealPreCommit2) + * [ReturnUnsealPiece](#ReturnUnsealPiece) +* [Sealing](#Sealing) + * [SealingAbort](#SealingAbort) + * [SealingSchedDiag](#SealingSchedDiag) +* [Sector](#Sector) + * [SectorGetExpectedSealDuration](#SectorGetExpectedSealDuration) + * [SectorGetSealDelay](#SectorGetSealDelay) + * [SectorMarkForUpgrade](#SectorMarkForUpgrade) + * [SectorRemove](#SectorRemove) + * [SectorSetExpectedSealDuration](#SectorSetExpectedSealDuration) + * [SectorSetSealDelay](#SectorSetSealDelay) + * [SectorStartSealing](#SectorStartSealing) +* [Sectors](#Sectors) + * [SectorsList](#SectorsList) + * [SectorsRefs](#SectorsRefs) + * [SectorsStatus](#SectorsStatus) + * [SectorsUpdate](#SectorsUpdate) +* [Storage](#Storage) + * [StorageAddLocal](#StorageAddLocal) + * [StorageAttach](#StorageAttach) + * [StorageBestAlloc](#StorageBestAlloc) + * [StorageDeclareSector](#StorageDeclareSector) + * [StorageDropSector](#StorageDropSector) + * [StorageFindSector](#StorageFindSector) + * [StorageInfo](#StorageInfo) + * [StorageList](#StorageList) + * [StorageLocal](#StorageLocal) + * [StorageLock](#StorageLock) + * [StorageReportHealth](#StorageReportHealth) + * [StorageStat](#StorageStat) + * [StorageTryLock](#StorageTryLock) +* [Worker](#Worker) + * [WorkerConnect](#WorkerConnect) + * [WorkerJobs](#WorkerJobs) + * [WorkerStats](#WorkerStats) +## + + +### Closing + + +Perms: read + +Inputs: `null` + +Response: `{}` + +### Session + + +Perms: read + +Inputs: `null` + +Response: `"07070707-0707-0707-0707-070707070707"` + +### Shutdown + + +Perms: admin + +Inputs: `null` + +Response: `{}` + +### Version + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "Version": "string value", + "APIVersion": 4352, + "BlockDelay": 42 +} +``` + +## Actor + + +### ActorAddress +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `"f01234"` + +### ActorSectorSize +There are not yet any comments for this method. + +Perms: read + +Inputs: +```json +[ + "f01234" +] +``` + +Response: `34359738368` + +## Auth + + +### AuthNew + + +Perms: admin + +Inputs: +```json +[ + null +] +``` + +Response: `"Ynl0ZSBhcnJheQ=="` + +### AuthVerify + + +Perms: read + +Inputs: +```json +[ + "string value" +] +``` + +Response: `null` + +## Create + + +### CreateBackup +CreateBackup creates node backup onder the specified file name. The +method requires that the lotus-miner is running with the +LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that +the path specified when calling CreateBackup is within the base path + + +Perms: admin + +Inputs: +```json +[ + "string value" +] +``` + +Response: `{}` + +## Deals + + +### DealsConsiderOfflineRetrievalDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `true` + +### DealsConsiderOfflineStorageDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `true` + +### DealsConsiderOnlineRetrievalDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `true` + +### DealsConsiderOnlineStorageDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `true` + +### DealsImportData +There are not yet any comments for this method. + +Perms: write + +Inputs: +```json +[ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "string value" +] +``` + +Response: `{}` + +### DealsList +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +### DealsPieceCidBlocklist +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +### DealsSetConsiderOfflineRetrievalDeals +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + true +] +``` + +Response: `{}` + +### DealsSetConsiderOfflineStorageDeals +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + true +] +``` + +Response: `{}` + +### DealsSetConsiderOnlineRetrievalDeals +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + true +] +``` + +Response: `{}` + +### DealsSetConsiderOnlineStorageDeals +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + true +] +``` + +Response: `{}` + +### DealsSetPieceCidBlocklist +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + null +] +``` + +Response: `{}` + +## I + + +### ID + + +Perms: read + +Inputs: `null` + +Response: `"12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf"` + +## Log + + +### LogList + + +Perms: write + +Inputs: `null` + +Response: `null` + +### LogSetLevel + + +Perms: write + +Inputs: +```json +[ + "string value", + "string value" +] +``` + +Response: `{}` + +## Market + + +### MarketCancelDataTransfer +ClientCancelDataTransfer cancels a data transfer with the given transfer ID and other peer + + +Perms: read + +Inputs: +```json +[ + 3, + "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + true +] +``` + +Response: `{}` + +### MarketDataTransferUpdates +There are not yet any comments for this method. + +Perms: write + +Inputs: `null` + +Response: +```json +{ + "TransferID": 3, + "Status": 1, + "BaseCID": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "IsInitiator": true, + "IsSender": true, + "Voucher": "string value", + "Message": "string value", + "OtherPeer": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "Transferred": 42 +} +``` + +### MarketGetAsk +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "Ask": { + "Price": "0", + "VerifiedPrice": "0", + "MinPieceSize": 1032, + "MaxPieceSize": 1032, + "Miner": "f01234", + "Timestamp": 10101, + "Expiry": 10101, + "SeqNo": 42 + }, + "Signature": { + "Type": 2, + "Data": "Ynl0ZSBhcnJheQ==" + } +} +``` + +### MarketGetDealUpdates +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "Proposal": { + "PieceCID": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "PieceSize": 1032, + "VerifiedDeal": true, + "Client": "f01234", + "Provider": "f01234", + "Label": "string value", + "StartEpoch": 10101, + "EndEpoch": 10101, + "StoragePricePerEpoch": "0", + "ProviderCollateral": "0", + "ClientCollateral": "0" + }, + "ClientSignature": { + "Type": 2, + "Data": "Ynl0ZSBhcnJheQ==" + }, + "ProposalCid": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "AddFundsCid": null, + "PublishCid": null, + "Miner": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "State": 42, + "PiecePath": ".lotusminer/fstmp123", + "MetadataPath": ".lotusminer/fstmp123", + "SlashEpoch": 10101, + "FastRetrieval": true, + "Message": "string value", + "StoreID": 12, + "FundsReserved": "0", + "Ref": { + "TransferType": "string value", + "Root": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "PieceCid": null, + "PieceSize": 1024 + }, + "AvailableForRetrieval": true, + "DealID": 5432, + "CreationTime": "0001-01-01T00:00:00Z", + "TransferChannelId": { + "Initiator": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "Responder": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "ID": 3 + } +} +``` + +### MarketGetRetrievalAsk +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "PricePerByte": "0", + "UnsealPrice": "0", + "PaymentInterval": 42, + "PaymentIntervalIncrease": 42 +} +``` + +### MarketImportDealData +There are not yet any comments for this method. + +Perms: write + +Inputs: +```json +[ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "string value" +] +``` + +Response: `{}` + +### MarketListDataTransfers +There are not yet any comments for this method. + +Perms: write + +Inputs: `null` + +Response: `null` + +### MarketListDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +### MarketListIncompleteDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +### MarketListRetrievalDeals +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +### MarketRestartDataTransfer +MinerRestartDataTransfer attempts to restart a data transfer with the given transfer ID and other peer + + +Perms: read + +Inputs: +```json +[ + 3, + "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + true +] +``` + +Response: `{}` + +### MarketSetAsk +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + "0", + "0", + 10101, + 1032, + 1032 +] +``` + +Response: `{}` + +### MarketSetRetrievalAsk +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + { + "PricePerByte": "0", + "UnsealPrice": "0", + "PaymentInterval": 42, + "PaymentIntervalIncrease": 42 + } +] +``` + +Response: `{}` + +## Mining + + +### MiningBase +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "Cids": null, + "Blocks": null, + "Height": 0 +} +``` + +## Net + + +### NetAddrsListen + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "Addrs": null, + "ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" +} +``` + +### NetAgentVersion + + +Perms: read + +Inputs: +```json +[ + "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" +] +``` + +Response: `"string value"` + +### NetAutoNatStatus + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "Reachability": 1, + "PublicAddr": "string value" +} +``` + +### NetBandwidthStats + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "TotalIn": 9, + "TotalOut": 9, + "RateIn": 12.3, + "RateOut": 12.3 +} +``` + +### NetBandwidthStatsByPeer + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "12D3KooWSXmXLJmBR1M7i9RW9GQPNUhZSzXKzxDHWtAgNuJAbyEJ": { + "TotalIn": 174000, + "TotalOut": 12500, + "RateIn": 100, + "RateOut": 50 + } +} +``` + +### NetBandwidthStatsByProtocol + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "/fil/hello/1.0.0": { + "TotalIn": 174000, + "TotalOut": 12500, + "RateIn": 100, + "RateOut": 50 + } +} +``` + +### NetConnect + + +Perms: write + +Inputs: +```json +[ + { + "Addrs": null, + "ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" + } +] +``` + +Response: `{}` + +### NetConnectedness + + +Perms: read + +Inputs: +```json +[ + "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" +] +``` + +Response: `1` + +### NetDisconnect + + +Perms: write + +Inputs: +```json +[ + "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" +] +``` + +Response: `{}` + +### NetFindPeer + + +Perms: read + +Inputs: +```json +[ + "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" +] +``` + +Response: +```json +{ + "Addrs": null, + "ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf" +} +``` + +### NetPeers + + +Perms: read + +Inputs: `null` + +Response: `null` + +### NetPubsubScores + + +Perms: read + +Inputs: `null` + +Response: `null` + +## Pieces + + +### PiecesGetCIDInfo +There are not yet any comments for this method. + +Perms: read + +Inputs: +```json +[ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + } +] +``` + +Response: +```json +{ + "CID": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "PieceBlockLocations": null +} +``` + +### PiecesGetPieceInfo +There are not yet any comments for this method. + +Perms: read + +Inputs: +```json +[ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + } +] +``` + +Response: +```json +{ + "PieceCID": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Deals": null +} +``` + +### PiecesListCidInfos +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +### PiecesListPieces +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: `null` + +## Pledge + + +### PledgeSector +Temp api for testing + + +Perms: write + +Inputs: `null` + +Response: `{}` + +## Return + + +### ReturnAddPiece + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + { + "Size": 1032, + "PieceCID": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + } + }, + "string value" +] +``` + +Response: `{}` + +### ReturnFetch + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + "string value" +] +``` + +Response: `{}` + +### ReturnFinalizeSector + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + "string value" +] +``` + +Response: `{}` + +### ReturnMoveStorage + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + "string value" +] +``` + +Response: `{}` + +### ReturnReadPiece + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + true, + "string value" +] +``` + +Response: `{}` + +### ReturnReleaseUnsealed + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + "string value" +] +``` + +Response: `{}` + +### ReturnSealCommit1 + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + null, + "string value" +] +``` + +Response: `{}` + +### ReturnSealCommit2 + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + null, + "string value" +] +``` + +Response: `{}` + +### ReturnSealPreCommit1 + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + null, + "string value" +] +``` + +Response: `{}` + +### ReturnSealPreCommit2 + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + { + "Unsealed": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Sealed": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + } + }, + "string value" +] +``` + +Response: `{}` + +### ReturnUnsealPiece + + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + }, + "string value" +] +``` + +Response: `{}` + +## Sealing + + +### SealingAbort +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + { + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" + } +] +``` + +Response: `{}` + +### SealingSchedDiag +SealingSchedDiag dumps internal sealing scheduler state + + +Perms: admin + +Inputs: +```json +[ + true +] +``` + +Response: `{}` + +## Sector + + +### SectorGetExpectedSealDuration +SectorGetExpectedSealDuration gets the expected time for a sector to seal + + +Perms: read + +Inputs: `null` + +Response: `60000000000` + +### SectorGetSealDelay +SectorGetSealDelay gets the time that a newly-created sector +waits for more deals before it starts sealing + + +Perms: read + +Inputs: `null` + +Response: `60000000000` + +### SectorMarkForUpgrade +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + 9 +] +``` + +Response: `{}` + +### SectorRemove +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + 9 +] +``` + +Response: `{}` + +### SectorSetExpectedSealDuration +SectorSetExpectedSealDuration sets the expected time for a sector to seal + + +Perms: write + +Inputs: +```json +[ + 60000000000 +] +``` + +Response: `{}` + +### SectorSetSealDelay +SectorSetSealDelay sets the time that a newly-created sector +waits for more deals before it starts sealing + + +Perms: write + +Inputs: +```json +[ + 60000000000 +] +``` + +Response: `{}` + +### SectorStartSealing +SectorStartSealing can be called on sectors in Empty or WaitDeals states +to trigger sealing early + + +Perms: write + +Inputs: +```json +[ + 9 +] +``` + +Response: `{}` + +## Sectors + + +### SectorsList +List all staged sectors + + +Perms: read + +Inputs: `null` + +Response: `null` + +### SectorsRefs +There are not yet any comments for this method. + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "98000": [ + { + "SectorID": 100, + "Offset": 10485760, + "Size": 1048576 + } + ] +} +``` + +### SectorsStatus +Get the status of a given sector by ID + + +Perms: read + +Inputs: +```json +[ + 9, + true +] +``` + +Response: +```json +{ + "SectorID": 9, + "State": "Proving", + "CommD": null, + "CommR": null, + "Proof": "Ynl0ZSBhcnJheQ==", + "Deals": null, + "Ticket": { + "Value": null, + "Epoch": 10101 + }, + "Seed": { + "Value": null, + "Epoch": 10101 + }, + "PreCommitMsg": null, + "CommitMsg": null, + "Retries": 42, + "ToUpgrade": true, + "LastErr": "string value", + "Log": null, + "SealProof": 3, + "Activation": 10101, + "Expiration": 10101, + "DealWeight": "0", + "VerifiedDealWeight": "0", + "InitialPledge": "0", + "OnTime": 10101, + "Early": 10101 +} +``` + +### SectorsUpdate +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + 9, + "Proving" +] +``` + +Response: `{}` + +## Storage + + +### StorageAddLocal +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + "string value" +] +``` + +Response: `{}` + +### StorageAttach + + +Perms: admin + +Inputs: +```json +[ + { + "ID": "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8", + "URLs": null, + "Weight": 42, + "CanSeal": true, + "CanStore": true + }, + { + "Capacity": 9, + "Available": 9, + "Reserved": 9 + } +] +``` + +Response: `{}` + +### StorageBestAlloc + + +Perms: admin + +Inputs: +```json +[ + 1, + 34359738368, + "sealing" +] +``` + +Response: `null` + +### StorageDeclareSector + + +Perms: admin + +Inputs: +```json +[ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8", + { + "Miner": 1000, + "Number": 9 + }, + 1, + true +] +``` + +Response: `{}` + +### StorageDropSector + + +Perms: admin + +Inputs: +```json +[ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8", + { + "Miner": 1000, + "Number": 9 + }, + 1 +] +``` + +Response: `{}` + +### StorageFindSector + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + 1, + 34359738368, + true +] +``` + +Response: `null` + +### StorageInfo + + +Perms: admin + +Inputs: +```json +[ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8" +] +``` + +Response: +```json +{ + "ID": "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8", + "URLs": null, + "Weight": 42, + "CanSeal": true, + "CanStore": true +} +``` + +### StorageList +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: +```json +{ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": [ + { + "Miner": 1000, + "Number": 100, + "SectorFileType": 2 + } + ] +} +``` + +### StorageLocal +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: +```json +{ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": "/data/path" +} +``` + +### StorageLock + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + 1, + 1 +] +``` + +Response: `{}` + +### StorageReportHealth + + +Perms: admin + +Inputs: +```json +[ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8", + { + "Stat": { + "Capacity": 9, + "Available": 9, + "Reserved": 9 + }, + "Err": "string value" + } +] +``` + +Response: `{}` + +### StorageStat +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8" +] +``` + +Response: +```json +{ + "Capacity": 9, + "Available": 9, + "Reserved": 9 +} +``` + +### StorageTryLock + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + 1, + 1 +] +``` + +Response: `true` + +## Worker + + +### WorkerConnect +WorkerConnect tells the node to connect to workers RPC + + +Perms: admin + +Inputs: +```json +[ + "string value" +] +``` + +Response: `{}` + +### WorkerJobs +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: +```json +{ + "ef8d99a2-6865-4189-8ffa-9fef0f806eee": [ + { + "ID": { + "Sector": { + "Miner": 1000, + "Number": 100 + }, + "ID": "76081ba0-61bd-45a5-bc08-af05f1c26e5d" + }, + "Sector": { + "Miner": 1000, + "Number": 100 + }, + "Task": "seal/v0/precommit/2", + "RunWait": 0, + "Start": "2020-11-12T10:22:07+01:00", + "Hostname": "host" + } + ] +} +``` + +### WorkerStats +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: +```json +{ + "ef8d99a2-6865-4189-8ffa-9fef0f806eee": { + "Info": { + "Hostname": "host", + "Resources": { + "MemPhysical": 274877906944, + "MemSwap": 128849018880, + "MemReserved": 2147483648, + "CPUs": 64, + "GPUs": [ + "aGPU 1337" + ] + } + }, + "Enabled": true, + "MemUsedMin": 0, + "MemUsedMax": 0, + "GpuUsed": false, + "CpuUse": 0 + } +} +``` + diff --git a/documentation/en/api-methods-worker.md b/documentation/en/api-methods-worker.md new file mode 100644 index 000000000..9bb948361 --- /dev/null +++ b/documentation/en/api-methods-worker.md @@ -0,0 +1,539 @@ +# Groups +* [](#) + * [Enabled](#Enabled) + * [Fetch](#Fetch) + * [Info](#Info) + * [Paths](#Paths) + * [Remove](#Remove) + * [Session](#Session) + * [Version](#Version) +* [Add](#Add) + * [AddPiece](#AddPiece) +* [Finalize](#Finalize) + * [FinalizeSector](#FinalizeSector) +* [Move](#Move) + * [MoveStorage](#MoveStorage) +* [Process](#Process) + * [ProcessSession](#ProcessSession) +* [Read](#Read) + * [ReadPiece](#ReadPiece) +* [Release](#Release) + * [ReleaseUnsealed](#ReleaseUnsealed) +* [Seal](#Seal) + * [SealCommit1](#SealCommit1) + * [SealCommit2](#SealCommit2) + * [SealPreCommit1](#SealPreCommit1) + * [SealPreCommit2](#SealPreCommit2) +* [Set](#Set) + * [SetEnabled](#SetEnabled) +* [Storage](#Storage) + * [StorageAddLocal](#StorageAddLocal) +* [Task](#Task) + * [TaskTypes](#TaskTypes) +* [Unseal](#Unseal) + * [UnsealPiece](#UnsealPiece) +* [Wait](#Wait) + * [WaitQuiet](#WaitQuiet) +## + + +### Enabled +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: `true` + +### Fetch + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + 1, + "sealing", + "move" +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +### Info +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: +```json +{ + "Hostname": "string value", + "Resources": { + "MemPhysical": 42, + "MemSwap": 42, + "MemReserved": 42, + "CPUs": 42, + "GPUs": null + } +} +``` + +### Paths +There are not yet any comments for this method. + +Perms: admin + +Inputs: `null` + +Response: `null` + +### Remove +Storage / Other + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + } +] +``` + +Response: `{}` + +### Session +Like ProcessSession, but returns an error when worker is disabled + + +Perms: admin + +Inputs: `null` + +Response: `"07070707-0707-0707-0707-070707070707"` + +### Version +TODO: Info() (name, ...) ? + + +Perms: admin + +Inputs: `null` + +Response: `4352` + +## Add + + +### AddPiece + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null, + 1024, + {} +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Finalize + + +### FinalizeSector + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Move + + +### MoveStorage + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + 1 +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Process + + +### ProcessSession +returns a random UUID of worker session, generated randomly when worker +process starts + + +Perms: admin + +Inputs: `null` + +Response: `"07070707-0707-0707-0707-070707070707"` + +## Read + + +### ReadPiece + + +Perms: admin + +Inputs: +```json +[ + {}, + { + "Miner": 1000, + "Number": 9 + }, + 1040384, + 1024 +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Release + + +### ReleaseUnsealed + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Seal + + +### SealCommit1 + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null, + null, + null, + { + "Unsealed": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Sealed": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + } + } +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +### SealCommit2 + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +### SealPreCommit1 + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null, + null +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +### SealPreCommit2 + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + null +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Set + + +### SetEnabled +SetEnabled marks the worker as enabled/disabled. Not that this setting +may take a few seconds to propagate to task scheduler + + +Perms: admin + +Inputs: +```json +[ + true +] +``` + +Response: `{}` + +## Storage + + +### StorageAddLocal +There are not yet any comments for this method. + +Perms: admin + +Inputs: +```json +[ + "string value" +] +``` + +Response: `{}` + +## Task + + +### TaskTypes +TaskType -> Weight + + +Perms: admin + +Inputs: `null` + +Response: +```json +{ + "seal/v0/commit/1": {}, + "seal/v0/commit/2": {}, + "seal/v0/precommit/2": {} +} +``` + +## Unseal + + +### UnsealPiece + + +Perms: admin + +Inputs: +```json +[ + { + "Miner": 1000, + "Number": 9 + }, + 1040384, + 1024, + null, + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + } +] +``` + +Response: +```json +{ + "Sector": { + "Miner": 1000, + "Number": 9 + }, + "ID": "07070707-0707-0707-0707-070707070707" +} +``` + +## Wait + + +### WaitQuiet +WaitQuiet blocks until there are no tasks running + + +Perms: admin + +Inputs: `null` + +Response: `{}` + From 408183c7a66b64d64e3941f36e27f64f92b5a58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 12 Nov 2020 10:42:06 +0100 Subject: [PATCH 3/4] docsgen: Fix CI --- .circleci/config.yml | 1 + api/docgen/docgen.go | 24 ++++++++++++------------ extern/sector-storage/stores/local.go | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f57c362e6..f0db4c3cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -359,6 +359,7 @@ jobs: steps: - install-deps - prepare + - run: make deps - run: make docsgen - run: git --no-pager diff - run: git --no-pager diff --quiet diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index efb9edcb3..15ed0a5b3 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -3,12 +3,6 @@ package main import ( "encoding/json" "fmt" - filestore2 "github.com/filecoin-project/go-fil-markets/filestore" - "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" - "github.com/filecoin-project/lotus/extern/sector-storage/stores" - "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/google/uuid" "go/ast" "go/parser" "go/token" @@ -19,6 +13,7 @@ import ( "time" "unicode" + "github.com/google/uuid" "github.com/ipfs/go-cid" "github.com/ipfs/go-filestore" metrics "github.com/libp2p/go-libp2p-core/metrics" @@ -31,6 +26,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-bitfield" datatransfer "github.com/filecoin-project/go-data-transfer" + filestore2 "github.com/filecoin-project/go-fil-markets/filestore" "github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/go-multistore" @@ -43,6 +39,10 @@ import ( "github.com/filecoin-project/lotus/api/apistruct" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" + "github.com/filecoin-project/lotus/extern/sector-storage/stores" + "github.com/filecoin-project/lotus/extern/sector-storage/storiface" + sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/node/modules/dtypes" ) @@ -202,7 +202,7 @@ func init() { addExample(map[uuid.UUID][]storiface.WorkerJob{ uuid.MustParse("ef8d99a2-6865-4189-8ffa-9fef0f806eee"): { { - ID: storiface.CallID{ + ID: storiface.CallID{ Sector: abi.SectorID{Miner: 1000, Number: 100}, ID: uuid.MustParse("76081ba0-61bd-45a5-bc08-af05f1c26e5d"), }, @@ -216,8 +216,8 @@ func init() { }) addExample(map[uuid.UUID]storiface.WorkerStats{ uuid.MustParse("ef8d99a2-6865-4189-8ffa-9fef0f806eee"): { - Info: storiface.WorkerInfo{ - Hostname: "host", + Info: storiface.WorkerInfo{ + Hostname: "host", Resources: storiface.WorkerResources{ MemPhysical: 256 << 30, MemSwap: 120 << 30, @@ -237,10 +237,10 @@ func init() { // worker specific addExample(storiface.AcquireMove) addExample(storiface.UnpaddedByteIndex(abi.PaddedPieceSize(1 << 20).Unpadded())) - addExample(map[sealtasks.TaskType]struct {}{ + addExample(map[sealtasks.TaskType]struct{}{ sealtasks.TTPreCommit2: {}, - sealtasks.TTCommit1: {}, - sealtasks.TTCommit2: {}, + sealtasks.TTCommit1: {}, + sealtasks.TTCommit2: {}, }) } diff --git a/extern/sector-storage/stores/local.go b/extern/sector-storage/stores/local.go index faa5c5176..7de3103b9 100644 --- a/extern/sector-storage/stores/local.go +++ b/extern/sector-storage/stores/local.go @@ -313,7 +313,7 @@ func (st *Local) reportStorage(ctx context.Context) { r.Err = err.Error() } - toReport[id] = r + toReport[id] = r } st.localLk.RUnlock() From 63f13977ce4ec253457d3b0a056292463a31d9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 12 Nov 2020 20:18:39 +0100 Subject: [PATCH 4/4] Make docsgen more deterministic --- api/docgen/docgen.go | 4 +--- documentation/en/api-methods-miner.md | 2 +- documentation/en/api-methods-worker.md | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index 15ed0a5b3..3eaa6359e 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -209,7 +209,7 @@ func init() { Sector: abi.SectorID{Miner: 1000, Number: 100}, Task: sealtasks.TTPreCommit2, RunWait: 0, - Start: time.Unix(1605172927, 0), + Start: time.Unix(1605172927, 0).UTC(), Hostname: "host", }, }, @@ -239,8 +239,6 @@ func init() { addExample(storiface.UnpaddedByteIndex(abi.PaddedPieceSize(1 << 20).Unpadded())) addExample(map[sealtasks.TaskType]struct{}{ sealtasks.TTPreCommit2: {}, - sealtasks.TTCommit1: {}, - sealtasks.TTCommit2: {}, }) } diff --git a/documentation/en/api-methods-miner.md b/documentation/en/api-methods-miner.md index 22f027154..e8c4d802c 100644 --- a/documentation/en/api-methods-miner.md +++ b/documentation/en/api-methods-miner.md @@ -1746,7 +1746,7 @@ Response: }, "Task": "seal/v0/precommit/2", "RunWait": 0, - "Start": "2020-11-12T10:22:07+01:00", + "Start": "2020-11-12T09:22:07Z", "Hostname": "host" } ] diff --git a/documentation/en/api-methods-worker.md b/documentation/en/api-methods-worker.md index 9bb948361..62b6d175c 100644 --- a/documentation/en/api-methods-worker.md +++ b/documentation/en/api-methods-worker.md @@ -483,8 +483,6 @@ Inputs: `null` Response: ```json { - "seal/v0/commit/1": {}, - "seal/v0/commit/2": {}, "seal/v0/precommit/2": {} } ```