Convert handler config to interface #172

Closed
opened 2023-07-18 11:06:30 +00:00 by dkirillov · 0 comments
Member

We have a lot of parameters that should be reloaded by SIGHUP. So currently we have several structs that implements several interfaces. So each struct must have some synchronization primitives (mutex or atomic). It's getting harder to maintain such solution especially because pass config params as struct

Describe the solution you'd like

I suggest convert config to interface and make settings to implement it. We can use only one sync.RWMutex and it will be easy to add new params.

Describe alternatives you've considered

Continue using current approach.

Additional context

no

## Is your feature request related to a problem? Please describe. We have a lot of parameters that should be reloaded by SIGHUP. So currently we have [several](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/cmd/s3-gw/app.go#L84) [structs](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/internal/xml/decoder.go#L11) that implements [several](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/api/handler/api.go#L42) [interfaces](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/api/handler/api.go#L49). So each struct must have some synchronization primitives (mutex or atomic). It's getting harder to maintain such solution especially because pass config params as [struct](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/api/handler/api.go#L32) ## Describe the solution you'd like I suggest convert [config](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/api/handler/api.go#L32) to interface and make [settings](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/14ef9ff091829487882d6f774e8e931399f8b2cb/cmd/s3-gw/app.go#L67) to implement it. We can use only one `sync.RWMutex` and it will be easy to add new params. ## Describe alternatives you've considered Continue using current approach. ## Additional context no
mbiryukova self-assigned this 2023-09-06 12:39:44 +00:00
alexvanin added this to the v0.29.0 milestone 2023-09-08 10:31:44 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#172
No description provided.