Skip to content

Commit

Permalink
Merge pull request #5 from filecoin-project/feat/data_storage_mgr
Browse files Browse the repository at this point in the history
Feat/data storage mgr
  • Loading branch information
diwufeiwen authored Mar 1, 2021
2 parents 0a81345 + 69b9735 commit 3971a3e
Show file tree
Hide file tree
Showing 41 changed files with 94 additions and 3,043 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@ jobs:
- install-deps
- prepare
- run:
command: make deps venus-miner
command: make deps miner
no_output_timeout: 30m
- go/install-gotestsum:
gobin: $HOME/.local/bin
version: 0.5.2
- run:
name: go test
environment:
LOTUS_TEST_WINDOW_POST: << parameters.winpost-test >>
SKIP_CONFORMANCE: "1"
command: |
mkdir -p /tmp/test-reports/<< parameters.test-suite-name >>
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL=/usr/bin/env bash
GOVERSION:=$(shell go version | cut -d' ' -f 3 | cut -d. -f 2)
ifeq ($(shell expr $(GOVERSION) \< 15), 1)
$(warning Your Golang version is go 1.$(GOVERSION))
$(error Update Golang to version $(shell grep '^go' go.mod))
$(error Update Golang to version to at least 1.15.5)
endif

# git modules that need to be loaded
Expand Down Expand Up @@ -69,10 +69,12 @@ miner: $(BUILD_DEPS)
go run github.com/GeertJohan/go.rice/rice append --exec venus-miner -i ./build

.PHONY: miner
BINS+=venus-miner
BINS+=miner

# MISC

buildall: $(BINS)

clean:
rm -rf $(CLEAN) $(BINS)
-$(MAKE) -C $(FFI_PATH) clean
Expand Down
Binary file added build/sqlite-sql/venus-miner.db
Binary file not shown.
44 changes: 44 additions & 0 deletions build/sqlite-sql/venus-miner.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Navicat SQLite Data Transfer
Source Server : venus-miner
Source Server Version : 30714
Source Host : :0
Target Server Type : SQLite
Target Server Version : 30714
File Encoding : 65001
Date: 2021-03-01 14:49:38
*/

PRAGMA foreign_keys = OFF;

-- ----------------------------
-- Table structure for miners
-- ----------------------------
DROP TABLE IF EXISTS "main"."miners";
CREATE TABLE miners(
id INT PRIMARY KEY NOT NULL,
addr VARCHAR(30) NOT NULL,
listen_api VARCHAR(50) NOT NULL,
token VARCHAR(255) NOT NULL
);

-- ----------------------------
-- Records of miners
-- ----------------------------

-- ----------------------------
-- Table structure for venus_api
-- ----------------------------
DROP TABLE IF EXISTS "main"."venus_api";
CREATE TABLE venus_api(
id INT PRIMARY KEY NOT NULL,
api VARCHAR(50) NOT NULL,
token VARCHAR(255) NOT NULL
);

-- ----------------------------
-- Records of venus_api
-- ----------------------------
2 changes: 1 addition & 1 deletion chain/types/electionproof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestPoissonFunction(t *testing.T) {
b.WriteString(p.next().String())
b.WriteRune('\n')
}
golden.Assert(t, []byte(b.String()))
golden.Assert(t, b.Bytes())
})
}
}
Expand Down
47 changes: 0 additions & 47 deletions chain/types/vmcontext.go

This file was deleted.

11 changes: 0 additions & 11 deletions cli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ func flagForRepo(t repo.RepoType) string {
}
}

func envForRepo(t repo.RepoType) string {
switch t {
case repo.FullNode:
return "FULLNODE_API_INFO"
case repo.Miner:
return "MINER_API_INFO"
default:
panic(fmt.Sprintf("Unknown repo type: %v", t))
}
}

func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (cliutil.APIInfo, error) {
// Check if there was a flag passed with the listen address of the API
// server (only used by the tests)
Expand Down
2 changes: 1 addition & 1 deletion cli/util/apiinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var log = logging.Logger("cliutil")

var (
infoWithToken = regexp.MustCompile("^[a-zA-Z0-9\\-_]+?\\.[a-zA-Z0-9\\-_]+?\\.([a-zA-Z0-9\\-_]+)?:.+$")
infoWithToken = regexp.MustCompile(`^[a-zA-Z0-9\\-_]+?\\.[a-zA-Z0-9\\-_]+?\\.([a-zA-Z0-9\\-_]+)?:.+$`)
)

type APIInfo struct {
Expand Down
17 changes: 8 additions & 9 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ var initCmd = &cli.Command{
Usage: "specify the address of an already created miner actor",
},
&cli.StringFlag{
Name: "listen-api",
Usage: "rpc api",
Value: "",
Name: "listen-api",
Usage: "rpc api",
Value: "",
},
&cli.StringFlag{
Name: "token",
Usage: "rpc token",
Value: "",
Name: "token",
Usage: "rpc token",
Value: "",
},
&cli.StringFlag{
Name: "sector-size",
Expand All @@ -62,7 +62,6 @@ var initCmd = &cli.Command{
}
ssize := abi.SectorSize(sectorSizeInt)


log.Info("Checking proof parameters")

ctx := lcli.ReqContext(cctx)
Expand Down Expand Up @@ -188,15 +187,15 @@ func storageMinerInit(cctx *cli.Context, r repo.Repo) error {
if err := mds.Put(datastore.NewKey("default-actor"), actor.Bytes()); err != nil {
return err
}
}else {
} else {
return xerrors.New("the actor's Protocol is not ID")
}
}

return nil
}

func makeHostKey(lr repo.LockedRepo) (crypto.PrivKey, error) {
func makeHostKey(lr repo.LockedRepo) (crypto.PrivKey, error) { //nolint
pk, _, err := crypto.GenerateEd25519Key(rand.Reader)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func main() {
Name: FlagMinerRepo,
Aliases: []string{FlagMinerRepoDeprecation},
EnvVars: []string{"VENUS_MINER_PATH"},
Value: "~/.venusmining", // TODO: Consider XDG_DATA_HOME
Value: "~/.venusminer", // TODO: Consider XDG_DATA_HOME
Usage: fmt.Sprintf("Specify miner repo path. flag(%s) and env(VENUS_MINER_PATH) are DEPRECATION, will REMOVE SOON", FlagMinerRepoDeprecation),
},
},
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ require (
github.com/filecoin-project/specs-actors v0.9.13
github.com/filecoin-project/specs-actors/v2 v2.3.4
github.com/filecoin-project/specs-actors/v3 v3.0.3
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/google/gopacket v1.1.18 // indirect
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.7.4
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/golang-lru v0.5.4
github.com/ipfs/go-bitswap v0.3.2 // indirect
github.com/ipfs/go-block-format v0.0.3
Expand All @@ -44,6 +41,7 @@ require (
github.com/ipfs/go-ds-badger2 v0.1.1-0.20200708190120-187fc06f714e
github.com/ipfs/go-ds-leveldb v0.4.2
github.com/ipfs/go-ds-measure v0.1.0
github.com/ipfs/go-fs-lock v0.0.6
github.com/ipfs/go-ipfs-blockstore v1.0.3
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-cbor v0.0.5
Expand Down Expand Up @@ -84,4 +82,8 @@ require (
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)

replace github.com/filecoin-project/venus-miner => ./

replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v1.18.0

replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ github.com/filecoin-project/specs-actors/v2 v2.3.4 h1:NZK2oMCcA71wNsUzDBmLQyRMzc
github.com/filecoin-project/specs-actors/v2 v2.3.4/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y=
github.com/filecoin-project/specs-actors/v3 v3.0.3 h1:bq9B1Jnq+Z0A+Yj3KnYhN3kcTpUyP6Umo3MZgai0BRE=
github.com/filecoin-project/specs-actors/v3 v3.0.3/go.mod h1:oMcmEed6B7H/wHabM3RQphTIhq0ibAKsbpYs+bQ/uxQ=
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw=
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as=
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
Expand Down Expand Up @@ -407,6 +405,8 @@ github.com/ipfs/go-ds-measure v0.1.0 h1:vE4TyY4aeLeVgnnPBC5QzKIjKrqzha0NCujTfgvV
github.com/ipfs/go-ds-measure v0.1.0/go.mod h1:1nDiFrhLlwArTME1Ees2XaBOl49OoCgd2A3f8EchMSY=
github.com/ipfs/go-filestore v1.0.0 h1:QR7ekKH+q2AGiWDc7W2Q0qHuYSRZGUJqUn0GsegEPb0=
github.com/ipfs/go-filestore v1.0.0/go.mod h1:/XOCuNtIe2f1YPbiXdYvD0BKLA0JR1MgPiFOdcuu9SM=
github.com/ipfs/go-fs-lock v0.0.6 h1:sn3TWwNVQqSeNjlWy6zQ1uUGAZrV3hPOyEA6y1/N2a0=
github.com/ipfs/go-fs-lock v0.0.6/go.mod h1:OTR+Rj9sHiRubJh3dRhD15Juhd/+w6VPOY28L7zESmM=
github.com/ipfs/go-graphsync v0.1.0/go.mod h1:jMXfqIEDFukLPZHqDPp8tJMbHO9Rmeb9CEGevngQbmE=
github.com/ipfs/go-graphsync v0.4.2/go.mod h1:/VmbZTUdUMTbNkgzAiCEucIIAU3BkLE2cZrDCVUhyi0=
github.com/ipfs/go-graphsync v0.4.3/go.mod h1:mPOwDYv128gf8gxPFgXnz4fNrSYPsWyqisJ7ych+XDY=
Expand Down
2 changes: 1 addition & 1 deletion miner/warmup.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ out:
return xerrors.Errorf("failed to compute proof: %w", err)
}

log.Infow("winning PoSt warmup successful", "took", time.Now().Sub(start))
log.Infow("winning PoSt warmup successful", "took", time.Since(start))
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var log = logging.Logger("builder")

// special is a type used to give keys to modules which
// can't really be identified by the returned type
type special struct{ id int }
type special struct{ id int } //nolint

type invoke int

Expand Down
51 changes: 0 additions & 51 deletions node/config/storage.go

This file was deleted.

Loading

0 comments on commit 3971a3e

Please sign in to comment.