Split the stages of work with the Client #65

Open
opened 2025-12-28 18:12:25 +00:00 by sami · 3 comments
Owner

Originally created by @cthulhu-rider on GitHub (Mar 7, 2022).

In current Client implementation connection is opened once during first Init call. I propose to highlight the working method:

func (x *Client) Dial(PrmDial) error

The method should be called before the work. This method is going to be called during the application start-up stage.

Originally created by @cthulhu-rider on GitHub (Mar 7, 2022). In current [Client](https://github.com/nspcc-dev/neofs-api-go/blob/d065453bd0a7a22b4efd724b11ecec6a50c275bc/rpc/client/client.go#L11) implementation connection is opened once during first `Init` call. I propose to highlight the working method: ``` func (x *Client) Dial(PrmDial) error ``` The method should be called before the work. This method is going to be called during the application start-up stage.
Author
Owner

@fyrchik commented on GitHub (Mar 23, 2022):

Init already opens the connection, is this task just about changing the name and signature?

@fyrchik commented on GitHub (Mar 23, 2022): `Init` already opens the connection, is this task just about changing the name and signature?
Author
Owner

@carpawell commented on GitHub (Jul 6, 2022):

Init already opens the connection

In the current implementation Init requires specifying a service name and an RPC name to open a stream, so it could not be used as "general initialization". I think that issue requires more deep refactoring.

BTW, I think that issue is quite actual. Currently, SDK client does a really strange thing to open the connection:

  1. It does nothing on dialing errors (are just ignored);
  2. i forget about that call and spent some time figuring out why i am facing strange requests on the server-side with zero version and empty request body.
@carpawell commented on GitHub (Jul 6, 2022): > Init already opens the connection In the current implementation `Init` [requires](https://github.com/nspcc-dev/neofs-api-go/blob/cdce7edc39997c58c70ad651d560ee8f95af1d06/rpc/client/init.go#L41) specifying a service name and an RPC name to open a [stream](https://github.com/nspcc-dev/neofs-api-go/blob/cdce7edc39997c58c70ad651d560ee8f95af1d06/rpc/grpc/init.go#L81), so it could not be used as "general initialization". I think that issue requires more deep refactoring. BTW, I think that issue is quite actual. Currently, SDK client [does](https://github.com/nspcc-dev/neofs-sdk-go/blob/0d862d8568a43243d6a51fdeb229715b203b79c3/client/client.go#L89) a really strange thing to open the connection: 1. It does nothing on dialing errors (are just ignored); 2. i forget about that call and spent some time figuring out why i am facing strange requests on the server-side with zero version and empty request body.
Author
Owner

@roman-khimov commented on GitHub (Jun 21, 2023):

It's basically about making createGRPCClient() a Dial(). Which would be a nice enhancement. Luckily current SDK code hides this, so it's not a priority.

@roman-khimov commented on GitHub (Jun 21, 2023): It's basically about making `createGRPCClient()` a `Dial()`. Which would be a nice enhancement. Luckily current SDK code hides this, so it's not a priority.
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
nspcc-dev/neofs-api-go#65
No description provided.