storj/satellite
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
..
abtesting console/abTesting: add support for AB testing 2022-10-27 10:57:12 +00:00
accounting satellite/accounting/live: ensure we don't panic when we get nil 2023-08-10 19:41:57 +03:00
admin satellite/admin: update README 2023-09-13 17:50:28 +00:00
analytics {satellite/console, web/satellite}: send analytics if invitee signs up 2023-09-19 14:50:44 +00:00
attribution satellite/{db, admin}: added endpoints to update user's and project's user_agent 2023-06-16 19:41:05 +00:00
audit satellite/metainfo: remove ServerSideCopyDuplicateMetadata 2023-08-08 12:15:10 +00:00
buckets satellite/buckets: handle bucket exists better 2023-08-23 14:40:31 +00:00
compensation payments: don't redefine compensation rates twice 2023-06-10 12:40:43 +00:00
console satellite/console: add more cross-user api tests 2023-09-19 16:50:31 +00:00
contact go.mod: bump lang to 1.19 and common 2023-08-10 18:41:15 +03:00
gc satellite/metainfo: remove ServerSideCopyDuplicateMetadata 2023-08-08 12:15:10 +00:00
geoip satellite/geoip: exclude nodes with represented_contry from geofencing 2023-08-14 12:36:33 +00:00
gracefulexit satellite: don't use fmt.Print in tests 2023-09-12 15:11:02 +03:00
internalpb satellite/metabase: adjust BeginObjectNextVersion to use pending_objects 2023-08-02 14:42:26 +00:00
mailservice satellite/consoleweb: fix flaky TestAuth tests 2022-08-04 19:06:07 +00:00
metabase satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
metainfo satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
metrics satellite/metabase/rangedloop: move Segment definition 2023-05-16 12:37:17 +00:00
nodeapiversion satellite/nodeapiversion: new table for tracking node api usage 2020-07-09 15:02:25 +00:00
nodeevents satellite/satellitedb/dbx: document node tables 2023-02-24 14:05:55 +00:00
nodeselection satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
nodestats payments: don't redefine compensation rates twice 2023-06-10 12:40:43 +00:00
oidc satellite/console: prefix oidc paths with /api/v0/ 2023-09-11 18:12:39 +00:00
orders satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
overlay satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
payments satellite/console: add more cross-user api tests 2023-09-19 16:50:31 +00:00
repair satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
reputation satellite/audit: remove pieces when audits fail 2023-06-22 14:19:00 +00:00
revocation satellite/satellitedb: move tests to their domains 2021-02-19 17:29:15 +02:00
satellitedb satellite/{projectaccounting, web}: merge settled and allocated lines for bandwidth graph 2023-09-14 15:39:56 +03:00
snopayouts all: fix error naming 2021-04-29 15:38:21 +03:00
admin.go satellite/payments: Remove expired package credits 2023-05-22 11:58:37 +00:00
api_test.go satellite/api: configuration option to set additional node tag authorities 2023-08-03 08:34:02 +00:00
api.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
auditor.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
configlock_test.go all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
core.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
gc-bf_test.go satellite/gc/bloomfilter: remove segments loop parts 2023-05-15 11:46:26 +00:00
gc-bf.go satellite/metabase: remove segmentsloop package 2023-05-18 19:08:29 +00:00
gc.go gc: remove segment loop dependency 2023-02-03 10:31:16 +00:00
peer.go satellite/api: configuration option to set additional node tag authorities 2023-08-03 08:34:02 +00:00
rangedloop.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
repairer.go satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
ui.go satellite/console: optional separate web app server 2023-07-11 12:17:35 -04:00