chore: types: remove more items forgotten after markets (#12095)
* chore: cleanup: remove more items forgotten after markets * .gz somehow reappeared after https://github.com/filecoin-project/lotus/pull/11625
This commit is contained in:
parent
496ea6d617
commit
610c984dc2
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@ -15,7 +15,7 @@ Before you mark the PR ready for review, please make sure that:
|
||||
- [ ] PR title is in the form of of `<PR type>: <area>: <change being made>`
|
||||
- example: ` fix: mempool: Introduce a cache for valid signatures`
|
||||
- `PR type`: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
|
||||
- `area`, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
|
||||
- `area`, e.g. api, chain, state, mempool, multisig, networking, paych, proving, sealing, wallet, deps
|
||||
- [ ] If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
|
||||
- [ ] New features have usage guidelines and / or documentation updates in
|
||||
- [ ] [Lotus Documentation](https://lotus.filecoin.io)
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
blocks "github.com/ipfs/go-block-format"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
@ -1052,8 +1051,6 @@ type MarketDeal struct {
|
||||
State MarketDealState
|
||||
}
|
||||
|
||||
type RemoteStoreID = uuid.UUID
|
||||
|
||||
type InvocResult struct {
|
||||
MsgCid cid.Cid
|
||||
Msg *types.Message
|
||||
@ -1064,11 +1061,6 @@ type InvocResult struct {
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
type MethodCall struct {
|
||||
types.MessageReceipt
|
||||
Error string
|
||||
}
|
||||
|
||||
type IpldObject struct {
|
||||
Cid cid.Cid
|
||||
Obj interface{}
|
||||
@ -1180,21 +1172,6 @@ type BlockTemplate struct {
|
||||
WinningPoStProof []builtin.PoStProof
|
||||
}
|
||||
|
||||
type DataSize struct {
|
||||
PayloadSize int64
|
||||
PieceSize abi.PaddedPieceSize
|
||||
}
|
||||
|
||||
type DataCIDSize struct {
|
||||
PayloadSize int64
|
||||
PieceSize abi.PaddedPieceSize
|
||||
PieceCID cid.Cid
|
||||
}
|
||||
|
||||
type CommPRet struct {
|
||||
Root cid.Cid
|
||||
Size abi.UnpaddedPieceSize
|
||||
}
|
||||
type HeadChange struct {
|
||||
Type string
|
||||
Val *types.TipSet
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
"github.com/google/uuid"
|
||||
blocks "github.com/ipfs/go-block-format"
|
||||
"github.com/ipfs/go-cid"
|
||||
textselector "github.com/ipld/go-ipld-selector-text-lite"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
"github.com/libp2p/go-libp2p/core/metrics"
|
||||
"github.com/libp2p/go-libp2p/core/network"
|
||||
@ -91,9 +90,6 @@ func init() {
|
||||
addExample(pid)
|
||||
addExample(&pid)
|
||||
|
||||
textSelExample := textselector.Expression("Links/21/Hash/Links/42/Hash")
|
||||
apiSelExample := api.Selector("Links/21/Hash/Links/42/Hash")
|
||||
|
||||
block := blocks.Block(&blocks.BasicBlock{})
|
||||
ExampleValues[reflect.TypeOf(&block).Elem()] = block
|
||||
|
||||
@ -124,8 +120,6 @@ func init() {
|
||||
addExample(api.PCHInbound)
|
||||
addExample(time.Minute)
|
||||
|
||||
addExample(&textSelExample)
|
||||
addExample(&apiSelExample)
|
||||
addExample(network.ReachabilityPublic)
|
||||
addExample(build.TestNetworkVersion)
|
||||
allocationId := verifreg.AllocationId(0)
|
||||
|
30
api/types.go
30
api/types.go
@ -1,7 +1,6 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@ -9,7 +8,6 @@ import (
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
"github.com/libp2p/go-libp2p/core/network"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
@ -19,27 +17,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
type MultiaddrSlice []ma.Multiaddr
|
||||
|
||||
func (m *MultiaddrSlice) UnmarshalJSON(raw []byte) (err error) {
|
||||
var temp []string
|
||||
if err := json.Unmarshal(raw, &temp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
res := make([]ma.Multiaddr, len(temp))
|
||||
for i, str := range temp {
|
||||
res[i], err = ma.NewMultiaddr(str)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Unmarshaler = new(MultiaddrSlice)
|
||||
|
||||
type ObjStat struct {
|
||||
Size uint64
|
||||
Links uint64
|
||||
@ -158,13 +135,6 @@ type MessagePrototype struct {
|
||||
ValidNonce bool
|
||||
}
|
||||
|
||||
// Selector specifies ipld selector string
|
||||
// - if the string starts with '{', it's interpreted as json selector string
|
||||
// see https://ipld.io/specs/selectors/ and https://ipld.io/specs/selectors/fixtures/selector-fixtures-1/
|
||||
// - otherwise the string is interpreted as ipld-selector-text-lite (simple ipld path)
|
||||
// see https://github.com/ipld/go-ipld-selector-text-lite
|
||||
type Selector string
|
||||
|
||||
type MinerInfo struct {
|
||||
Owner address.Address // Must be an ID-address.
|
||||
Worker address.Address // Must be an ID-address.
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -23,8 +23,7 @@ import (
|
||||
var log = logging.Logger("main")
|
||||
|
||||
const (
|
||||
FlagMinerRepo = "miner-repo"
|
||||
FlagMarketsRepo = "markets-repo"
|
||||
FlagMinerRepo = "miner-repo"
|
||||
)
|
||||
|
||||
// TODO remove after deprecation period
|
||||
@ -77,21 +76,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// adapt the Net* commands to always hit the node running the markets
|
||||
// subsystem, as that is the only one that runs a libp2p node.
|
||||
netCmd := *lcli.NetCmd // make a copy.
|
||||
netCmd.Hidden = true
|
||||
prev := netCmd.Before
|
||||
netCmd.Before = func(c *cli.Context) error {
|
||||
if prev != nil {
|
||||
if err := prev(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
c.App.Metadata["repoType"] = repo.Markets
|
||||
return nil
|
||||
}
|
||||
|
||||
app := &cli.App{
|
||||
Name: "lotus-miner",
|
||||
Usage: "Filecoin decentralized storage network miner",
|
||||
@ -129,27 +113,9 @@ func main() {
|
||||
Value: "~/.lotusminer", // TODO: Consider XDG_DATA_HOME
|
||||
Usage: fmt.Sprintf("Specify miner repo path. flag(%s) and env(LOTUS_STORAGE_PATH) are DEPRECATION, will REMOVE SOON", FlagMinerRepoDeprecation),
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: FlagMarketsRepo,
|
||||
EnvVars: []string{"LOTUS_MARKETS_PATH"},
|
||||
Hidden: true,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "call-on-markets",
|
||||
Usage: "(experimental; may be removed) call this command against a markets node; use only with common commands like net, auth, pprof, etc. whose target may be ambiguous",
|
||||
Hidden: true,
|
||||
},
|
||||
cliutil.FlagVeryVerbose,
|
||||
},
|
||||
Commands: append(local, append(lcli.CommonCommands, &netCmd)...),
|
||||
Before: func(c *cli.Context) error {
|
||||
// this command is explicitly called on markets, inform
|
||||
// common commands by overriding the repoType.
|
||||
if c.Bool("call-on-markets") {
|
||||
c.App.Metadata["repoType"] = repo.Markets
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Commands: append(local, lcli.CommonCommands...),
|
||||
After: func(c *cli.Context) error {
|
||||
if r := recover(); r != nil {
|
||||
// Generate report in LOTUS_PATH and re-raise panic
|
||||
|
1
go.mod
1
go.mod
@ -96,7 +96,6 @@ require (
|
||||
github.com/ipld/go-car v0.6.2
|
||||
github.com/ipld/go-car/v2 v2.13.1
|
||||
github.com/ipld/go-ipld-prime v0.21.0
|
||||
github.com/ipld/go-ipld-selector-text-lite v0.0.1
|
||||
github.com/ipni/go-libipni v0.0.8
|
||||
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438
|
||||
github.com/kelseyhightower/envconfig v1.4.0
|
||||
|
12
go.sum
12
go.sum
@ -328,7 +328,6 @@ github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg=
|
||||
github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
|
||||
github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk=
|
||||
github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
|
||||
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
||||
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
@ -581,7 +580,6 @@ github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUP
|
||||
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
||||
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
||||
github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10/go.mod h1:/BYOuUoxkE+0f6tGzlzMvycuN+5l35VOR4Bpg2sCmds=
|
||||
github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M=
|
||||
github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
|
||||
github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
|
||||
github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
|
||||
@ -594,9 +592,7 @@ github.com/ipfs/go-cidutil v0.1.0 h1:RW5hO7Vcf16dplUU60Hs0AKDkQAVPVplr7lk97CFL+Q
|
||||
github.com/ipfs/go-cidutil v0.1.0/go.mod h1:e7OEVBMIv9JaOxt9zaGEmAoSlXW9jdFZ5lP/0PwcfpA=
|
||||
github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
|
||||
github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
|
||||
github.com/ipfs/go-datastore v0.1.0/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
|
||||
github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw=
|
||||
github.com/ipfs/go-datastore v0.3.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw=
|
||||
github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk=
|
||||
github.com/ipfs/go-datastore v0.5.1/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk=
|
||||
github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk=
|
||||
@ -617,7 +613,6 @@ github.com/ipfs/go-fs-lock v0.0.6/go.mod h1:OTR+Rj9sHiRubJh3dRhD15Juhd/+w6VPOY28
|
||||
github.com/ipfs/go-fs-lock v0.0.7 h1:6BR3dajORFrFTkb5EpCUFIAypsoxpGpDSVUdFwzgL9U=
|
||||
github.com/ipfs/go-fs-lock v0.0.7/go.mod h1:Js8ka+FNYmgQRLrRXzU3CB/+Csr1BwrRilEcvYrHhhc=
|
||||
github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08=
|
||||
github.com/ipfs/go-ipfs-blockstore v0.1.0/go.mod h1:5aD0AvHPi7mZc6Ci1WCAhiBQu2IsfTduLl+422H6Rqw=
|
||||
github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxpB1PFuA5E1m/7exE=
|
||||
github.com/ipfs/go-ipfs-blockstore v1.3.1 h1:cEI9ci7V0sRNivqaOr0elDsamxXFxJMMMy7PTTDQNsQ=
|
||||
github.com/ipfs/go-ipfs-blockstore v1.3.1/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE=
|
||||
@ -662,7 +657,6 @@ github.com/ipfs/go-ipld-cbor v0.1.0 h1:dx0nS0kILVivGhfWuB6dUpMa/LAwElHPw1yOGYopo
|
||||
github.com/ipfs/go-ipld-cbor v0.1.0/go.mod h1:U2aYlmVrJr2wsUBU67K4KgepApSZddGRDWBYR0H4sCk=
|
||||
github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms=
|
||||
github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k=
|
||||
github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs=
|
||||
github.com/ipfs/go-ipld-format v0.3.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM=
|
||||
github.com/ipfs/go-ipld-format v0.4.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM=
|
||||
github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U=
|
||||
@ -685,7 +679,6 @@ github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY=
|
||||
github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI=
|
||||
github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
|
||||
github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
|
||||
github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M=
|
||||
github.com/ipfs/go-merkledag v0.11.0 h1:DgzwK5hprESOzS4O1t/wi6JDpyVQdvm9Bs59N/jqfBY=
|
||||
github.com/ipfs/go-merkledag v0.11.0/go.mod h1:Q4f/1ezvBiJV0YCIXvt51W/9/kqJGH4I1LsA7+djsM4=
|
||||
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
|
||||
@ -706,20 +699,15 @@ github.com/ipld/go-car v0.6.2 h1:Hlnl3Awgnq8icK+ze3iRghk805lu8YNq3wlREDTF2qc=
|
||||
github.com/ipld/go-car v0.6.2/go.mod h1:oEGXdwp6bmxJCZ+rARSkDliTeYnVzv3++eXajZ+Bmr8=
|
||||
github.com/ipld/go-car/v2 v2.13.1 h1:KnlrKvEPEzr5IZHKTXLAEub+tPrzeAFQVRlSQvuxBO4=
|
||||
github.com/ipld/go-car/v2 v2.13.1/go.mod h1:QkdjjFNGit2GIkpQ953KBwowuoukoM75nP/JI1iDJdo=
|
||||
github.com/ipld/go-codec-dagpb v1.2.0/go.mod h1:6nBN7X7h8EOsEejZGqC7tej5drsdBAXbMHyBT+Fne5s=
|
||||
github.com/ipld/go-codec-dagpb v1.6.0 h1:9nYazfyu9B1p3NAgfVdpRco3Fs2nFC72DqVsMj6rOcc=
|
||||
github.com/ipld/go-codec-dagpb v1.6.0/go.mod h1:ANzFhfP2uMJxRBr8CE+WQWs5UsNa0pYtmKZ+agnUw9s=
|
||||
github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w=
|
||||
github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
|
||||
github.com/ipld/go-ipld-prime v0.10.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
|
||||
github.com/ipld/go-ipld-prime v0.19.0/go.mod h1:Q9j3BaVXwaA3o5JUDNvptDDr/x8+F7FG6XJ8WI3ILg4=
|
||||
github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E=
|
||||
github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ=
|
||||
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU=
|
||||
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20230102063945-1a409dc236dd h1:gMlw/MhNr2Wtp5RwGdsW23cs+yCuj9k2ON7i9MiJlRo=
|
||||
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20230102063945-1a409dc236dd/go.mod h1:wZ8hH8UxeryOs4kJEJaiui/s00hDSbE37OKsL47g+Sw=
|
||||
github.com/ipld/go-ipld-selector-text-lite v0.0.1 h1:lNqFsQpBHc3p5xHob2KvEg/iM5dIFn6iw4L/Hh+kS1Y=
|
||||
github.com/ipld/go-ipld-selector-text-lite v0.0.1/go.mod h1:U2CQmFb+uWzfIEF3I1arrDa5rwtj00PrpiwwCO+k1RM=
|
||||
github.com/ipni/go-libipni v0.0.8 h1:0wLfZRSBG84swmZwmaLKul/iB/FlBkkl9ZcR1ub+Z+w=
|
||||
github.com/ipni/go-libipni v0.0.8/go.mod h1:paYP9U4N3/vOzGCuN9kU972vtvw9JUcQjOKyiCFGwRk=
|
||||
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c=
|
||||
|
@ -43,7 +43,6 @@ type nodeOpts struct {
|
||||
disableLibp2p bool
|
||||
optBuilders []OptBuilder
|
||||
sectorSize abi.SectorSize
|
||||
maxStagingDealsBytes int64
|
||||
minerNoLocalSealing bool // use worker
|
||||
minerAssigner string
|
||||
disallowRemoteFinalize bool
|
||||
@ -107,14 +106,6 @@ func WithSubsystems(systems ...MinerSubsystem) NodeOpt {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithMaxStagingDealsBytes(size int64) NodeOpt {
|
||||
return func(opts *nodeOpts) error {
|
||||
opts.maxStagingDealsBytes = size
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithNoLocalSealing(nope bool) NodeOpt {
|
||||
return func(opts *nodeOpts) error {
|
||||
opts.minerNoLocalSealing = nope
|
||||
|
@ -1,53 +0,0 @@
|
||||
package promise
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Promise[T any] struct {
|
||||
val T
|
||||
done chan struct{}
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (p *Promise[T]) Set(val T) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
// Set value
|
||||
p.val = val
|
||||
|
||||
// Initialize the done channel if it hasn't been initialized
|
||||
if p.done == nil {
|
||||
p.done = make(chan struct{})
|
||||
}
|
||||
|
||||
// Signal that the value is set
|
||||
close(p.done)
|
||||
}
|
||||
|
||||
func (p *Promise[T]) Val(ctx context.Context) T {
|
||||
p.mu.Lock()
|
||||
// Initialize the done channel if it hasn't been initialized
|
||||
if p.done == nil {
|
||||
p.done = make(chan struct{})
|
||||
}
|
||||
p.mu.Unlock()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return *new(T)
|
||||
case <-p.done:
|
||||
p.mu.Lock()
|
||||
val := p.val
|
||||
p.mu.Unlock()
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Promise[T]) IsSet() bool {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
return p.done != nil
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package promise
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestPromiseSet(t *testing.T) {
|
||||
p := &Promise[int]{}
|
||||
|
||||
p.Set(42)
|
||||
if p.val != 42 {
|
||||
t.Fatalf("expected 42, got %v", p.val)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromiseVal(t *testing.T) {
|
||||
p := &Promise[int]{}
|
||||
|
||||
p.Set(42)
|
||||
|
||||
ctx := context.Background()
|
||||
val := p.Val(ctx)
|
||||
|
||||
if val != 42 {
|
||||
t.Fatalf("expected 42, got %v", val)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromiseValWaitsForSet(t *testing.T) {
|
||||
p := &Promise[int]{}
|
||||
var val int
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
ctx := context.Background()
|
||||
val = p.Val(ctx)
|
||||
}()
|
||||
|
||||
time.Sleep(100 * time.Millisecond) // Give some time for the above goroutine to execute
|
||||
p.Set(42)
|
||||
wg.Wait()
|
||||
|
||||
if val != 42 {
|
||||
t.Fatalf("expected 42, got %v", val)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromiseValContextCancel(t *testing.T) {
|
||||
p := &Promise[int]{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel() // Cancel the context
|
||||
|
||||
val := p.Val(ctx)
|
||||
|
||||
var zeroValue int
|
||||
if val != zeroValue {
|
||||
t.Fatalf("expected zero-value, got %v", val)
|
||||
}
|
||||
}
|
@ -44,10 +44,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/storage/wdpost"
|
||||
)
|
||||
|
||||
var (
|
||||
StagingAreaDirName = "deal-staging"
|
||||
)
|
||||
|
||||
type UuidWrapper struct {
|
||||
v1api.FullNode
|
||||
}
|
||||
|
@ -74,11 +74,6 @@ type RepoType interface {
|
||||
APIInfoEnvVars() (string, []string, []string)
|
||||
}
|
||||
|
||||
// SupportsStagingDeals is a trait for services that support staging deals
|
||||
type SupportsStagingDeals interface {
|
||||
SupportsStagingDeals()
|
||||
}
|
||||
|
||||
var FullNode fullNode
|
||||
|
||||
type fullNode struct {
|
||||
@ -108,8 +103,6 @@ var StorageMiner storageMiner
|
||||
|
||||
type storageMiner struct{}
|
||||
|
||||
func (storageMiner) SupportsStagingDeals() {}
|
||||
|
||||
func (storageMiner) Type() string {
|
||||
return "StorageMiner"
|
||||
}
|
||||
@ -131,35 +124,6 @@ func (storageMiner) APIInfoEnvVars() (primary string, fallbacks []string, deprec
|
||||
return "MINER_API_INFO", nil, []string{"STORAGE_API_INFO"}
|
||||
}
|
||||
|
||||
var Markets markets
|
||||
|
||||
type markets struct{}
|
||||
|
||||
func (markets) SupportsStagingDeals() {}
|
||||
|
||||
func (markets) Type() string {
|
||||
return "Markets"
|
||||
}
|
||||
|
||||
func (markets) Config() interface{} {
|
||||
return config.DefaultStorageMiner()
|
||||
}
|
||||
|
||||
func (markets) APIFlags() []string {
|
||||
// support split markets-miner and monolith deployments.
|
||||
return []string{"markets-api-url", "miner-api-url"}
|
||||
}
|
||||
|
||||
func (markets) RepoFlags() []string {
|
||||
// support split markets-miner and monolith deployments.
|
||||
return []string{"markets-repo", "miner-repo"}
|
||||
}
|
||||
|
||||
func (markets) APIInfoEnvVars() (primary string, fallbacks []string, deprecated []string) {
|
||||
// support split markets-miner and monolith deployments.
|
||||
return "MARKETS_API_INFO", []string{"MINER_API_INFO"}, nil
|
||||
}
|
||||
|
||||
type worker struct {
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
dgbadger "github.com/dgraph-io/badger/v2"
|
||||
"github.com/ipfs/go-datastore"
|
||||
badger "github.com/ipfs/go-ds-badger2"
|
||||
levelds "github.com/ipfs/go-ds-leveldb"
|
||||
measure "github.com/ipfs/go-ds-measure"
|
||||
ldbopts "github.com/syndtr/goleveldb/leveldb/opt"
|
||||
@ -18,13 +16,16 @@ type dsCtor func(path string, readonly bool) (datastore.Batching, error)
|
||||
|
||||
var fsDatastores = map[string]dsCtor{
|
||||
"metadata": levelDs,
|
||||
|
||||
// Those need to be fast for large writes... but also need a really good GC :c
|
||||
"staging": badgerDs, // miner specific
|
||||
|
||||
"client": badgerDs, // client specific
|
||||
}
|
||||
|
||||
// Helper badgerDs() and its imports are unused
|
||||
// Leaving here for completeness
|
||||
//
|
||||
/*
|
||||
|
||||
dgbadger "github.com/dgraph-io/badger/v2"
|
||||
badger "github.com/ipfs/go-ds-badger2"
|
||||
|
||||
func badgerDs(path string, readonly bool) (datastore.Batching, error) {
|
||||
opts := badger.DefaultOptions
|
||||
opts.ReadOnly = readonly
|
||||
@ -34,6 +35,8 @@ func badgerDs(path string, readonly bool) (datastore.Batching, error) {
|
||||
return badger.NewDatastore(path, &opts)
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
func levelDs(path string, readonly bool) (datastore.Batching, error) {
|
||||
return levelds.NewDatastore(path, &levelds.Options{
|
||||
Compression: ldbopts.NoCompression,
|
||||
|
@ -107,14 +107,6 @@ func (lmem *lockedMemRepo) Path() string {
|
||||
panic(err) // only used in tests, probably fine
|
||||
}
|
||||
|
||||
if _, ok := lmem.t.(SupportsStagingDeals); ok {
|
||||
// this is required due to the method makeDealStaging from cmd/lotus-storage-miner/init.go
|
||||
// deal-staging is the directory deal files are staged in before being sealed into sectors
|
||||
// for offline deal flow.
|
||||
if err := os.MkdirAll(filepath.Join(t, "deal-staging"), 0755); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
if lmem.t == StorageMiner || lmem.t == Worker {
|
||||
lmem.initSectorStore(t)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ if __name__ == "__main__":
|
||||
# When --help is generated one needs to make sure none of the
|
||||
# urfave-cli `EnvVars:` defaults get triggered
|
||||
# Unset everything we can find via: grep -ho 'EnvVars:.*' -r * | sort -u
|
||||
for e in [ "LOTUS_PATH", "LOTUS_MARKETS_PATH", "LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH", "LOTUS_WORKER_PATH", "WORKER_PATH", "LOTUS_PANIC_REPORT_PATH", "WALLET_PATH" ]:
|
||||
for e in [ "LOTUS_PATH", "LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH", "LOTUS_WORKER_PATH", "WORKER_PATH", "LOTUS_PANIC_REPORT_PATH", "WALLET_PATH" ]:
|
||||
os.environ.pop(e, None)
|
||||
|
||||
# Set env var telling the binaries that we're generating docs
|
||||
|
Loading…
Reference in New Issue
Block a user