After recent changes `client.Client` accepts dial context. There is a
need to forward the context passed into `Pool.Dial` to the underlying
`Client` instances.
Define type aliases of different client constructors: context-based and
non-context. Use context-based constructor in `Pool`. Pass `ctx`
parameter of `Pool.Dial` method to the client builder.
Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
Rename `LimitByObject` method of the `session.Object` type to
`LimitByObjects` and make it to accept variadic parameter.
Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
In previous implementation `pool` package provided access to resulting
values as pointers to them. This caused clients to handle nil
cases even when the field presence in the response is required.
Avoid returning pointers to values in result getters. This also reduces
reference counter load and allows values from `client.Client` to be
forwarded directly without additional assignment.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In previous implementation `client` package provided access to nested
response fields as pointers to them. This caused clients to handle nil
cases even when the field presence in the response is required.
Avoid returning pointers to required fields in response getters. This
also reduces reference counter load and allows fields to be decoded
directly without additional assignment.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
It is a helper function that uses a `Pool` to fetch network information and
apply it to the container (change the container if it does not fit the
network). Currently, only applies the homomorphic hashing parameter.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Session token and signature isn't presented in `Container` and
`EACLTable` messages of NeoFS API V2 protocol. These entities are needed
for access control and doesn't carry payload of these messages.
Remove `SetSessionToken` / `SessionToken` methods of
`container.Container` and `eacl.Table` types. Provide methods to specify
these components in corresponding `Client` operations.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Merge `address` package into `oid` one. Bring `session.Object`
implementation into conformity with the NeoFS API protocol.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `createSessionTokenForDuration` to accept a pointer to
`session.Object` and write the response on session creation request
through the pointer. Rename function to `initSessionForDuration`. As a
consequence, problem in `openDefaultSession` with uncached sessions is
fixed.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
`owner.ID` parameter of `createSessionTokenForDuration` function is no
longer used since session owner is set automatically during the sign
operation. As a consequence, remove `Pool.sessionOwner` field and its
getter.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Connection pool package should not define `Pool` type as an interface
since it provides single particular implementation.
Make `pool.Pool` type a struct instead of interface. Also remove
`Object`, `Container` and `Accounting` interfaces.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Get rid of `Option` pattern. Define `Init`, `Dial` and `Close` methods
for the corresponding stages of use.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In previous implementation we wrote up to 4KB payload chunk per-call.
This led to sending a large number of messages with a large
amount of payload.
Increase buffer length limit to 3MB.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Use call private key parameterized in `HeadObject` / `DeleteObject`
methods of `Pool` as corresponding key for `ObjectHead` / `ObjectDelete`
methods of `Client`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
From now session token for `SetEACL` operation should be written into
eACL table structure (similar to `PutContainer`).
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Call `createSessionTokenForDuration` function for session opening in
`pool.openDefaultSession` method in order to limit session lifetime
according to pool configuration (`SessionExpirationDuration`).
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Based on the applications that use pool, most of them simply
set session token duration to MaxUint64 value. It is completely
understandable, because epochs are incrementing and expiration
value will be surpassed sooner or later, unless it is MaxUint64.
As an alternative I suggest specifying duration instead of
absolute epoch values. Now apps can set duration of 100-200
epochs and pool automatically calculated expiration epoch
base on the network info.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
PutContainer method takes `container.Container` structure
as an argument. This structure already contains session
token field, so there is no need in `prmSession` because it
duplicates session token definition.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This is done to prevent import cycles when `object` package needs any other
that requires `object.ID` or `object.Address`.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>