storj/satellite/metabase
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
..
metabasetest satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
rangedloop satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
zombiedeletion satellite/zombiedeletion: remove inactive uploads from pending_objects 2023-09-07 18:47:29 +00:00
alias_test.go ci: fix lint errors 2021-05-17 13:37:31 +00:00
alias.go satellite/metabase,cmd/tools/segment-verify: simplify interface 2022-10-06 13:42:00 +00:00
aliascache_test.go satellite/metabase: expose ConvertNodesToAliases and ConvertAliasesToNodes 2022-09-15 13:56:10 +00:00
aliascache.go satellite/metabase: reuse Pieces while looping segments 2023-07-12 09:29:34 +00:00
aliaspiece_test.go satellite/metabase: move package one level higher 2021-04-21 15:54:22 +03:00
aliaspiece.go satellite/metabase: move package one level higher 2021-04-21 15:54:22 +03:00
bench_expired_test.go all: fix nolint directives 2022-10-11 18:31:20 +00:00
bench_test.go all: fix nolint directives 2022-10-11 18:31:20 +00:00
commit_object_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
commit_object.go all: fix golangci failures 2023-08-09 11:44:44 +03:00
commit_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
commit.go satellite/metabase: custom error for commit object 2023-09-15 09:52:42 +00:00
common_test.go satellite/metabase: add piece size calculation to segment 2023-02-22 11:04:02 +00:00
common.go satellite/metabase: use constant for pending version 2023-09-12 18:01:12 +00:00
consts_test.go satellite/metabase: move package one level higher 2021-04-21 15:54:22 +03:00
copy_object_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
copy_object.go satellite/metainfo: remove ServerSideCopyDuplicateMetadata 2023-08-08 12:15:10 +00:00
db_internal_test.go satellite/metabase/segmentloop: limit max interval 2021-06-10 17:06:33 +00:00
db_test.go satellite/metabase: drop alias migration code 2021-05-07 12:13:28 +03:00
db.go satellite/metabase: add pending_objects table 2023-07-26 20:00:58 +00:00
delete_bucket_test.go satellite/metabase: use constant for pending version 2023-09-12 18:01:12 +00:00
delete_bucket.go satellite/metabase: delete bucket deletes also from pending_objects 2023-08-21 14:05:13 +00:00
delete_objects_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
delete_objects.go satellite/zombiedeletion: remove inactive uploads from pending_objects 2023-09-07 18:47:29 +00:00
delete_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
delete.go satellite/{metainfo,metabase}: delete from pending_objects table 2023-08-21 08:06:23 +00:00
encoding.go satellite/metabase: deletion query as explicit transaction 2022-03-31 11:40:36 +00:00
get_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
get.go satellite/metabase: adjust BucketEmpty to use pending_objects table 2023-08-21 15:01:59 +00:00
iterator_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
iterator_util_test.go satellite/metabase: fix listing prefixes with cursor set 2021-07-07 14:30:46 +00:00
iterator.go satellite/metabase: make UploadID stable for different options 2022-11-10 17:35:36 +00:00
list_objects_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
list_objects.go satellite/metabase: convert bucket name to bytes for queries 2023-06-29 10:43:35 +00:00
list_segments_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
list_segments.go satellite/metainfo: remove ServerSideCopyDuplicateMetadata 2023-08-08 12:15:10 +00:00
list_verify_segments_test.go satellite/metabase: add logic for verifying segments in given buckets 2022-12-08 09:45:15 +00:00
list_verify_segments.go satellite/metabase: convert bucket name to bytes for queries 2023-06-29 10:43:35 +00:00
list.go satellite/metabase: add IteratePendingObjectsByKeyNew method 2023-08-21 08:08:03 +00:00
loop_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
loop.go satellite/metabase: reuse Pieces while looping segments 2023-07-12 09:29:34 +00:00
metadata_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
metadata.go satellite/metabase: define a local ErrObjectNotFound 2023-04-19 12:03:01 +00:00
migrate_test.go metabase: use predefined snapshot for unit tests avoid migration 2022-06-01 12:07:00 +00:00
move_object_test.go satellite/metabase: define a local ErrObjectNotFound 2023-04-19 12:03:01 +00:00
move_object.go satellite/metabase: define a local ErrObjectNotFound 2023-04-19 12:03:01 +00:00
pending_objects_iterator_test.go satellite/metabase: use constant for pending version 2023-09-12 18:01:12 +00:00
pending_objects_iterator.go satellite/metabase: add IteratePendingObjectsByKeyNew method 2023-08-21 08:08:03 +00:00
raw.go satellite/metainfo: remove ServerSideCopyDuplicateMetadata 2023-08-08 12:15:10 +00:00
stats_test.go satellite/metabase: use table stats if are up to date 2023-03-13 14:54:13 +00:00
stats.go satellite/metabase: sort stats by creation time not number of entries 2023-03-30 12:31:45 +00:00
streamstat_test.go satellite/metabase: simplify BeginExactObject 2023-09-18 19:26:49 +00:00
streamstat.go satellite/metainfo: remove ServerSideCopyDuplicateMetadata 2023-08-08 12:15:10 +00:00
update_test.go storage: move errors to better locations 2023-04-06 17:26:29 +03:00
update.go storage: move errors to better locations 2023-04-06 17:26:29 +03:00
util.go satellite/metabase: add intLimitRange 2021-07-19 07:51:16 +00:00