storj/satellite/overlay
Márton Elek 98921f9faa satellite/overlay: fix placement selection config parsing
When we do `satellite run api --placement '...'`, the placement rules are not parsed well.

The problem is based on `viper.AllSettings()`, and the main logic is sg. like this (from a new unit test):

```
		r := ConfigurablePlacementRule{}
		err := r.Set(p)
		require.NoError(t, err)
		serialized := r.String()

		r2 := ConfigurablePlacementRule{}
		err = r2.Set(serialized)
		require.NoError(t, err)

		require.Equal(t, p, r2.String())
```

All settings evaluates the placement rules in `ConfigurablePlacementRules` and stores the string representation.

The problem is that we don't have proper `String()` implementation (it prints out the structs instead of the original definition.

There are two main solutions for this problem:

 1. We can fix the `String()`. When we parse a placement rule, the `String()` method should print out the original definition
 2. We can switch to use pure string as configuration parameter, and parse the rules only when required.

I feel that 1 is error prone, we can do it (and in this patch I added a lot of `String()` implementations, but it's hard to be sure that our `String()` logic is inline with the parsing logic.

Therefore I decided to make the configuration value of the placements a string (or a wrapper around string).

That's the main reason why this patch seems to be big, as I updated all the usages.

But the main part is in beginning of the `placement.go` (configuration parsing is not a pflag.Value implementation any more, but a separated step).

And `filter.go`, (a few more String implementation for filters.

https://github.com/storj/storj/issues/6248

Change-Id: I47c762d3514342b76a2e85683b1c891502a0756a
2023-09-21 14:31:41 +00:00
..
offlinenodes satellite/overlay/offlinenodes: insert offline nodes into node events 2022-11-18 12:10:06 -05:00
straynodes satellite/overlay: insert DQ node events for stray nodes 2022-11-04 15:48:17 +00:00
benchmark_test.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
checkin_test.go mod: bump common to fetch latest placement type changes 2021-11-16 12:42:25 +00:00
config.go satellite/overlay: configurable meaning of last_net 2023-03-09 02:20:12 +00:00
db_test.go storj: upgrade to use latest storj/common NodeAddress 2023-01-25 01:37:26 +00:00
downloadselection_test.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
downloadselection.go satellite/nodeselection: rename (NodeFilter).MatchInclude to Match 2023-08-31 16:17:52 +02:00
peeridentities_test.go satellite/satellitedb/satellitedbtest: pass ctx as an argument 2020-01-20 16:35:42 +02:00
peeridentities.go all: golangci-lint v1.33.0 fixes (#3985) 2020-12-05 17:01:42 +01:00
piececount_test.go storj: upgrade to use latest storj/common NodeAddress 2023-01-25 01:37:26 +00:00
placement_test.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
placement.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
selection_test.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
service_test.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
service.go satellite/overlay: change Reliable and KnownReliable 2023-09-02 23:34:50 +00:00
statdb_test.go satellite/overlay: change Reliable and KnownReliable 2023-09-02 23:34:50 +00:00
uploadselection_test.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
uploadselection.go satellite/overlay: remove/deprecate NodeSelectionCache.Disabled 2023-08-31 09:46:29 +00:00