[#121] client: Make client parameter fields public #127

Merged
fyrchik merged 2 commits from aarifullin/frostfs-sdk-go:feature/121-prm_public_fields into master 2023-08-01 09:59:58 +00:00
Member

Signed-off-by: Airat Arifullin a.arifullin@yadro.com

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
aarifullin force-pushed feature/121-prm_public_fields from 4c397c407f to 3e012baa61 2023-07-24 12:38:18 +00:00 Compare
aarifullin reviewed 2023-07-24 12:46:05 +00:00
@ -36,0 +33,4 @@
// Session is optional, if it is set the following requirements apply:
// - session operation MUST be session.VerbContainerPut (ForVerb)
// - token MUST be signed using private key of the owner of the container to be saved
Session *session.Container
Author
Member

I used pointer type for both Container and Session to avoid cnrSet, sessionSet flags because this may cause errors

I used pointer type for both `Container` and `Session` to avoid `cnrSet`, `sessionSet` flags because this may cause errors
aarifullin reviewed 2023-07-24 12:51:23 +00:00
@ -46,3 +39,1 @@
func (x *PrmContainerPut) WithinSession(s session.Container) {
x.session = s
x.sessionSet = true
func AsPointer[T container.Container | session.Container](t T) *T {
Author
Member

I have introduced pointer types above.

It's more convinient to create PrmContainerPut like that:

prm := PrmContainerPut: client.PrmContainerPut{
	Container: client.AsPointer(container.New(...)), // if container.New(...) -> container.Container
	Session:   tok,
},

and so on. But probably this convertation is unnecessary and will be removed

I have introduced pointer types above. It's more convinient to create `PrmContainerPut` like that: ```golang prm := PrmContainerPut: client.PrmContainerPut{ Container: client.AsPointer(container.New(...)), // if container.New(...) -> container.Container Session: tok, }, ``` and so on. But probably this convertation is unnecessary and will be removed
Owner

This helper is pretty trivial, do we want to (1) have it and (2) have it public?

This helper is pretty trivial, do we want to (1) have it and (2) have it public?
fyrchik marked this conversation as resolved
aarifullin requested review from storage-core-committers 2023-07-24 13:12:58 +00:00
aarifullin requested review from storage-core-developers 2023-07-24 13:12:58 +00:00
aarifullin requested review from alexvanin 2023-07-24 13:13:06 +00:00
aarifullin force-pushed feature/121-prm_public_fields from 3e012baa61 to b619735b3f 2023-07-24 13:25:55 +00:00 Compare
dstepanov-yadro approved these changes 2023-07-24 13:38:08 +00:00
fyrchik reviewed 2023-07-25 09:16:05 +00:00
client/common.go Outdated
@ -53,6 +53,13 @@ func (x *prmCommonMeta) WithXHeaders(hs ...string) {
x.xHeaders = hs
}
func NewXHeaders(hs ...string) []string {
Owner

Quite a strange function IMO: it returns an argument, and panics if it is "wrong" without any comment.

Can we instead return error from the ContainerPut if the length is invalid? (in a separate commit).

Quite a strange function IMO: it returns an argument, and panics if it is "wrong" without any comment. Can we instead return `error` from the `ContainerPut` if the length is invalid? (in a separate commit).
Author
Member

Good point. I made it copy-pasted from previous implementation. Alright. I'll fix it

Good point. I made it copy-pasted from previous implementation. Alright. I'll fix it
Author
Member

Removed this method at all. I've introduced new error type and put the check within buildRequest method - I think this is proper place

Removed this method at all. I've introduced new error type and put the check within `buildRequest` method - I think this is proper place
aarifullin force-pushed feature/121-prm_public_fields from b619735b3f to 738ba6cc1e 2023-07-25 13:48:14 +00:00 Compare
aarifullin requested review from dstepanov-yadro 2023-07-25 13:49:26 +00:00
aarifullin force-pushed feature/121-prm_public_fields from 738ba6cc1e to b7bbaefe13 2023-07-25 13:53:46 +00:00 Compare
fyrchik approved these changes 2023-07-26 07:52:49 +00:00
dstepanov-yadro approved these changes 2023-07-26 14:07:08 +00:00
alexvanin approved these changes 2023-07-27 20:48:54 +00:00
fyrchik changed title from [#121] client: Make client parameter fields public to WIP: [#121] client: Make client parameter fields public 2023-07-28 07:35:30 +00:00
Owner

WIP because waiting for some tests from @aarifullin

WIP because waiting for some tests from @aarifullin
aarifullin force-pushed feature/121-prm_public_fields from b7bbaefe13 to f58a8c04f7 2023-07-31 07:49:14 +00:00 Compare
aarifullin changed title from WIP: [#121] client: Make client parameter fields public to [#121] client: Make client parameter fields public 2023-07-31 07:54:10 +00:00
aarifullin requested review from dstepanov-yadro 2023-07-31 07:54:21 +00:00
aarifullin requested review from fyrchik 2023-07-31 07:54:23 +00:00
aarifullin requested review from alexvanin 2023-07-31 07:54:24 +00:00
Author
Member

Rebased on master

Rebased on master
alexvanin approved these changes 2023-07-31 10:27:48 +00:00
aarifullin force-pushed feature/121-prm_public_fields from f58a8c04f7 to 90ebfa228c 2023-07-31 11:09:57 +00:00 Compare
dkirillov reviewed 2023-07-31 11:16:35 +00:00
pool/pool.go Outdated
@ -1221,6 +1221,13 @@ func (x *WaitParams) setDefaults() {
x.pollInterval = 5 * time.Second
}
func DefaultWaitParams() *WaitParams {
Member

Do we need this function to be exported?

Do we need this function to be exported?
Author
Member

Good point

Good point
dkirillov marked this conversation as resolved
dkirillov reviewed 2023-07-31 11:18:03 +00:00
pool/pool.go Outdated
@ -1401,3 +1408,3 @@
// PrmContainerPut groups parameters of PutContainer operation.
type PrmContainerPut struct {
prmClient sdkClient.PrmContainerPut
Prm sdkClient.PrmContainerPut
Member

Maybe it's better to name it ClientPrm or ClientParams?

Maybe it's better to name it `ClientPrm` or `ClientParams`?
Author
Member

Fixed

Fixed
dkirillov marked this conversation as resolved
dkirillov approved these changes 2023-07-31 11:18:13 +00:00
dstepanov-yadro approved these changes 2023-07-31 12:18:12 +00:00
acid-ant approved these changes 2023-07-31 12:58:49 +00:00
aarifullin force-pushed feature/121-prm_public_fields from 90ebfa228c to c02f4c8dca 2023-07-31 15:19:36 +00:00 Compare
aarifullin requested review from acid-ant 2023-07-31 15:19:58 +00:00
aarifullin requested review from dstepanov-yadro 2023-07-31 15:20:00 +00:00
aarifullin force-pushed feature/121-prm_public_fields from c02f4c8dca to 9529f67c17 2023-08-01 07:12:01 +00:00 Compare
fyrchik reviewed 2023-08-01 07:28:17 +00:00
@ -44,2 +44,4 @@
// - session operation MUST be session.VerbContainerPut (ForVerb)
// - token MUST be signed using private key of the owner of the container to be saved
//
// NOTE: method is deprecated. Use public field for initialization instead.
Owner

We already have somewhat common syntax: // Deprecated: use XXX instead. (see .pb.go files for example). I am not sure this^ pattern will be picked by staticcheck.

We already have somewhat common syntax: `// Deprecated: use XXX instead.` (see `.pb.go` files for example). I am not sure this^ pattern will be picked by `staticcheck`.
Author
Member

Good! Thank you

Good! Thank you
fyrchik marked this conversation as resolved
fyrchik approved these changes 2023-08-01 07:28:47 +00:00
aarifullin force-pushed feature/121-prm_public_fields from 9529f67c17 to 25e0842513 2023-08-01 07:47:05 +00:00 Compare
aarifullin requested review from fyrchik 2023-08-01 07:47:35 +00:00
fyrchik approved these changes 2023-08-01 08:52:33 +00:00
fyrchik merged commit 13d0b170d2 into master 2023-08-01 09:59:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
6 participants
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-sdk-go#127
No description provided.