Skip to content

Commit 4e3c3f4

Browse files
authored
booster-http (#574)
* feat: booster-http * fix: car mime type * feat: better booster error messages * fix: catch errors in booster run * refactor: remove unused flag * feat: http retrieval by payload CID * feat: add index.html
1 parent 49f3c1a commit 4e3c3f4

File tree

15 files changed

+937
-4
lines changed

15 files changed

+937
-4
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ boost: $(BUILD_DEPS)
8989
.PHONY: boost
9090
BINS+=boost boostx boostd
9191

92+
booster-http: $(BUILD_DEPS)
93+
rm -f booster-http
94+
$(GOCC) build $(GOFLAGS) -o booster-http ./cmd/booster-http
95+
.PHONY: booster-http
96+
BINS+=booster-http
97+
9298
devnet: $(BUILD_DEPS)
9399
rm -f devnet
94100
$(GOCC) build $(GOFLAGS) -o devnet ./cmd/devnet

api/api.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/google/uuid"
1616
"github.com/ipfs/go-cid"
1717
"github.com/libp2p/go-libp2p-core/peer"
18+
"github.com/multiformats/go-multihash"
1819
)
1920

2021
// MODIFYING THE API INTERFACE
@@ -43,8 +44,8 @@ type Boost interface {
4344
BoostDagstoreInitializeAll(ctx context.Context, params DagstoreInitializeAllParams) (<-chan DagstoreInitializeAllEvent, error) //perm:admin
4445
BoostDagstoreRecoverShard(ctx context.Context, key string) error //perm:admin
4546
BoostDagstoreGC(ctx context.Context) ([]DagstoreShardResult, error) //perm:admin
46-
47-
BoostDagstoreListShards(ctx context.Context) ([]DagstoreShardInfo, error) //perm:read
47+
BoostDagstorePiecesContainingMultihash(ctx context.Context, mh multihash.Multihash) ([]cid.Cid, error) //perm:read
48+
BoostDagstoreListShards(ctx context.Context) ([]DagstoreShardInfo, error) //perm:read
4849

4950
// RuntimeSubsystems returns the subsystems that are enabled
5051
// in this instance.
@@ -67,6 +68,7 @@ type Boost interface {
6768
PiecesListCidInfos(ctx context.Context) ([]cid.Cid, error) //perm:read
6869
PiecesGetPieceInfo(ctx context.Context, pieceCid cid.Cid) (*piecestore.PieceInfo, error) //perm:read
6970
PiecesGetCIDInfo(ctx context.Context, payloadCid cid.Cid) (*piecestore.CIDInfo, error) //perm:read
71+
PiecesGetMaxOffset(ctx context.Context, pieceCid cid.Cid) (uint64, error) //perm:read
7072

7173
// MethodGroup: Actor
7274
ActorSectorSize(context.Context, address.Address) (abi.SectorSize, error) //perm:read

api/proxy_gen.go

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/openrpc/boost.json.gz

131 Bytes
Binary file not shown.

cmd/boostd/run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ var runCmd = &cli.Command{
2828
Name: "pprof",
2929
Usage: "run pprof web server on localhost:6060",
3030
},
31+
&cli.BoolFlag{
32+
Name: "nosync",
33+
Usage: "dont wait for the full node to sync with the chain",
34+
},
3135
},
3236
Action: func(cctx *cli.Context) error {
3337
if cctx.Bool("pprof") {

cmd/booster-http/main.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package main
2+
3+
import (
4+
"os"
5+
6+
"github.com/filecoin-project/boost/build"
7+
cliutil "github.com/filecoin-project/boost/cli/util"
8+
logging "github.com/ipfs/go-log/v2"
9+
"github.com/urfave/cli/v2"
10+
)
11+
12+
var log = logging.Logger("booster")
13+
14+
func main() {
15+
app := &cli.App{
16+
Name: "booster-http",
17+
Usage: "HTTP endpoint for retrieval from Filecoin",
18+
EnableBashCompletion: true,
19+
Version: build.UserVersion(),
20+
Flags: []cli.Flag{
21+
cliutil.FlagVeryVerbose,
22+
},
23+
Commands: []*cli.Command{
24+
runCmd,
25+
},
26+
}
27+
app.Setup()
28+
29+
if err := app.Run(os.Args); err != nil {
30+
os.Stderr.WriteString("Error: " + err.Error() + "\n")
31+
}
32+
}
33+
34+
func before(cctx *cli.Context) error {
35+
_ = logging.SetLogLevel("booster", "INFO")
36+
37+
if cliutil.IsVeryVerbose {
38+
_ = logging.SetLogLevel("booster", "DEBUG")
39+
}
40+
41+
return nil
42+
}

0 commit comments

Comments
 (0)