Skip to content

Commit

Permalink
Miner filter (#185)
Browse files Browse the repository at this point in the history
* update peer record

* update config file and env

* update track

* add trackerv2

* add trackerv2
  • Loading branch information
AstaFrode authored Sep 4, 2024
1 parent 4e539c0 commit 233e57c
Show file tree
Hide file tree
Showing 9 changed files with 766 additions and 86 deletions.
4 changes: 2 additions & 2 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ ttl=""
refresh=""


# give priority to storing files to miners with these peerids, multiple separated by spaces
peerid=""
# specify the storage miner account you want to store, multiple separated by spaces
specify_miner=""
7 changes: 2 additions & 5 deletions cmd/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ func cmd_run_func(cmd *cobra.Command, args []string) {
}
defer n.PeerNode.Close()

n.LoadPeer(filepath.Join(n.GetBasespace(), "peer_record"))

go node.Subscribe(
ctx, n.PeerNode.GetHost(),
n.PeerNode.GetBootnode(),
Expand Down Expand Up @@ -298,9 +296,8 @@ func readEnv() (*confile.Config, error) {
refresh, _ := strconv.Atoi(os.Getenv("refresh"))
c.Selector.Refresh = uint32(refresh)

// high priority peerid
peerids := strings.Split(os.Getenv("peerid"), " ")
c.Peerid = peerids
// specify storage miner account
c.Shunt.Account = strings.Split(os.Getenv("specify_miner"), " ")
return c, nil
}

Expand Down
4 changes: 2 additions & 2 deletions common/confile/conf_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ selector:
refresh: 4

shunt:
# give priority to storing files to miners with these peerids
peerid:
# specify the storage miner account you want to store
account:
6 changes: 3 additions & 3 deletions common/confile/confile.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ selector:
refresh: 4
shunt:
# give priority to storing files to miners with these peerids
peerid:`
# specify the storage miner account you want to store
account:`
)

type Application struct {
Expand Down Expand Up @@ -134,7 +134,7 @@ type Selector struct {
}

type Shunt struct {
Peerid []string `name:"peerid" toml:"peerid" yaml:"peerid"`
Account []string `name:"account" toml:"account" yaml:"account"`
}

type Config struct {
Expand Down
Loading

0 comments on commit 233e57c

Please sign in to comment.