Skip to content

Commit

Permalink
remove read task type and run gen and docsgen
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 authored and dirkmc committed May 20, 2021
1 parent 50d7acf commit c17300d
Show file tree
Hide file tree
Showing 16 changed files with 858 additions and 923 deletions.
2 changes: 0 additions & 2 deletions api/api_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package api

import (
"context"
"io"

"github.com/google/uuid"
"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -43,7 +42,6 @@ type Worker interface {
ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (storiface.CallID, error) //perm:admin
MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin
UnsealPiece(context.Context, storage.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
ReadPiece(context.Context, io.Writer, storage.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize) (storiface.CallID, error) //perm:admin
Fetch(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin

TaskDisable(ctx context.Context, tt sealtasks.TaskType) error //perm:admin
Expand Down
812 changes: 406 additions & 406 deletions api/mocks/mock_full.go

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

808 changes: 404 additions & 404 deletions api/v0api/v0mocks/mock_full.go

Large diffs are not rendered by default.

Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
51 changes: 26 additions & 25 deletions cli/servicesmock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 0 additions & 37 deletions documentation/en/api-v0-methods-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* [MoveStorage](#MoveStorage)
* [Process](#Process)
* [ProcessSession](#ProcessSession)
* [Read](#Read)
* [ReadPiece](#ReadPiece)
* [Release](#Release)
* [ReleaseUnsealed](#ReleaseUnsealed)
* [Seal](#Seal)
Expand Down Expand Up @@ -263,41 +261,6 @@ Inputs: `null`

Response: `"07070707-0707-0707-0707-070707070707"`

## Read


### ReadPiece


Perms: admin

Inputs:
```json
[
{},
{
"ID": {
"Miner": 1000,
"Number": 9
},
"ProofType": 8
},
1040384,
1024
]
```

Response:
```json
{
"Sector": {
"Miner": 1000,
"Number": 9
},
"ID": "07070707-0707-0707-0707-070707070707"
}
```

## Release


Expand Down
2 changes: 1 addition & 1 deletion extern/sector-storage/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func New(ctx context.Context, lstor *stores.Local, stor *stores.Remote, ls store
go m.sched.runSched()

localTasks := []sealtasks.TaskType{
sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTReadUnsealed,
sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch,
}
if sc.AllowAddPiece {
localTasks = append(localTasks, sealtasks.TTAddPiece)
Expand Down
1 change: 0 additions & 1 deletion extern/sector-storage/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ var ResourceTable = map[sealtasks.TaskType]map[abi.RegisteredSealProof]Resources

func init() {
ResourceTable[sealtasks.TTUnseal] = ResourceTable[sealtasks.TTPreCommit1] // TODO: measure accurately
ResourceTable[sealtasks.TTReadUnsealed] = ResourceTable[sealtasks.TTFetch]

// V1_1 is the same as V1
for _, m := range ResourceTable {
Expand Down
27 changes: 12 additions & 15 deletions extern/sector-storage/sealtasks/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ const (

TTFinalize TaskType = "seal/v0/finalize"

TTFetch TaskType = "seal/v0/fetch"
TTUnseal TaskType = "seal/v0/unseal"
TTReadUnsealed TaskType = "seal/v0/unsealread"
TTFetch TaskType = "seal/v0/fetch"
TTUnseal TaskType = "seal/v0/unseal"
)

var order = map[TaskType]int{
TTAddPiece: 6, // least priority
TTPreCommit1: 5,
TTPreCommit2: 4,
TTCommit2: 3,
TTCommit1: 2,
TTUnseal: 1,
TTFetch: -1,
TTReadUnsealed: -1,
TTFinalize: -2, // most priority
TTAddPiece: 6, // least priority
TTPreCommit1: 5,
TTPreCommit2: 4,
TTCommit2: 3,
TTCommit1: 2,
TTUnseal: 1,
TTFetch: -1,
TTFinalize: -2, // most priority
}

var shortNames = map[TaskType]string{
Expand All @@ -38,9 +36,8 @@ var shortNames = map[TaskType]string{

TTFinalize: "FIN",

TTFetch: "GET",
TTUnseal: "UNS",
TTReadUnsealed: "RD",
TTFetch: "GET",
TTUnseal: "UNS",
}

func (a TaskType) MuchLess(b TaskType) (bool, bool) {
Expand Down
10 changes: 9 additions & 1 deletion extern/sector-storage/stores/util_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"os/exec"
"path/filepath"
"runtime"
"strings"

"github.com/mitchellh/go-homedir"
Expand Down Expand Up @@ -33,7 +34,14 @@ func move(from, to string) error {
// can do better

var errOut bytes.Buffer
cmd := exec.Command("/usr/bin/env", "mv", "-t", toDir, from) // nolint

var cmd *exec.Cmd
if runtime.GOOS == "darwin" {
cmd = exec.Command("/usr/bin/env", "mv", from, toDir) // nolint
} else {
cmd = exec.Command("/usr/bin/env", "mv", "-t", toDir, from) // nolint
}

cmd.Stderr = &errOut
if err := cmd.Run(); err != nil {
return xerrors.Errorf("exec mv (stderr: %s): %w", strings.TrimSpace(errOut.String()), err)
Expand Down
2 changes: 0 additions & 2 deletions extern/sector-storage/storiface/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io"
"time"

"github.com/google/uuid"
Expand Down Expand Up @@ -87,7 +86,6 @@ type WorkerCalls interface {
ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (CallID, error)
MoveStorage(ctx context.Context, sector storage.SectorRef, types SectorFileType) (CallID, error)
UnsealPiece(context.Context, storage.SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (CallID, error)
ReadPiece(context.Context, io.Writer, storage.SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize) (CallID, error)
Fetch(context.Context, storage.SectorRef, SectorFileType, PathType, AcquireMode) (CallID, error)
}

Expand Down
Loading

0 comments on commit c17300d

Please sign in to comment.