Skip to content

Commit

Permalink
feat: implement Version api
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Aug 2, 2022
1 parent 95ce885 commit 3a51dc9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ all: build
# git modules that need to be loaded
MODULES:=

ldflags=-X=github.com/ipfs-force-community/venus-gateway/version.GitCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ldflags=-X=github.com/ipfs-force-community/venus-gateway/version.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
Expand Down
7 changes: 7 additions & 0 deletions api/rpc_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import (
"github.com/filecoin-project/specs-storage/storage"

"github.com/filecoin-project/venus/venus-shared/actors/builtin"
v1API "github.com/filecoin-project/venus/venus-shared/api/gateway/v1"
sharedTypes "github.com/filecoin-project/venus/venus-shared/types"

types "github.com/filecoin-project/venus/venus-shared/types/gateway"
"github.com/ipfs-force-community/venus-gateway/marketevent"
"github.com/ipfs-force-community/venus-gateway/proofevent"
"github.com/ipfs-force-community/venus-gateway/version"
"github.com/ipfs-force-community/venus-gateway/walletevent"
)

Expand All @@ -31,6 +33,7 @@ type IGatewayAPI interface {
IGatewayPushAPI
}

var _ v1API.IGateway = (*GatewayAPIImpl)(nil)
var _ IGatewayAPI = (*GatewayAPIImpl)(nil)

type GatewayAPIImpl struct {
Expand Down Expand Up @@ -94,3 +97,7 @@ func (g *GatewayAPIImpl) SectorsUnsealPiece(ctx context.Context, miner address.A
func (g *GatewayAPIImpl) ListMarketConnectionsState(ctx context.Context) ([]types.MarketConnectionState, error) {
return g.me.ListMarketConnectionsState(ctx)
}

func (g *GatewayAPIImpl) Version(ctx context.Context) (sharedTypes.Version, error) {
return sharedTypes.Version{Version: version.UserVersion}, nil
}
14 changes: 13 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/filecoin-project/go-jsonrpc v0.1.5
github.com/filecoin-project/go-state-types v0.1.10
github.com/filecoin-project/specs-storage v0.4.1
github.com/filecoin-project/venus v1.6.1
github.com/filecoin-project/venus v1.6.1-0.20220802052518-79b2da19fce8
github.com/filecoin-project/venus-auth v1.6.0
github.com/gbrlsnchs/jwt/v3 v3.0.1
github.com/google/uuid v1.3.0
Expand All @@ -33,14 +33,17 @@ require (
github.com/awnumar/memcall v0.0.0-20191004114545-73db50fd9f80 // indirect
github.com/awnumar/memguard v0.22.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deepmap/oapi-codegen v1.3.13 // indirect
github.com/dgraph-io/badger/v2 v2.2007.3 // indirect
github.com/dgraph-io/badger/v3 v3.2011.1 // indirect
github.com/dgraph-io/ristretto v0.0.4-0.20210122082011-bb5d392ed82d // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f // indirect
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect
Expand Down Expand Up @@ -84,14 +87,22 @@ require (
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-block-format v0.0.3 // indirect
github.com/ipfs/go-blockservice v0.3.0 // indirect
github.com/ipfs/go-datastore v0.5.1 // indirect
github.com/ipfs/go-ipfs-blockstore v1.2.0 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.1.0 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipfs/go-ipld-cbor v0.0.6 // indirect
github.com/ipfs/go-ipld-format v0.4.0 // indirect
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-merkledag v0.6.0 // indirect
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/ipfs/go-verifcid v0.0.1 // indirect
github.com/ipld/go-car v0.3.3 // indirect
github.com/ipld/go-codec-dagpb v1.3.2 // indirect
github.com/ipld/go-ipld-prime v0.16.0 // indirect
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
Expand All @@ -118,6 +129,7 @@ require (
github.com/multiformats/go-multihash v0.1.0 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect
Expand Down
Loading

0 comments on commit 3a51dc9

Please sign in to comment.