@@ -20,7 +20,7 @@ import (
2020 grpcStatus "google.golang.org/grpc/status"
2121
2222 "github.com/ydb-platform/ydb-go-sdk/v3/internal/closer"
23- "github.com/ydb-platform/ydb-go-sdk/v3/internal/operation "
23+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint "
2424 "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack"
2525 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext"
2626 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
@@ -146,7 +146,7 @@ func caller() string {
146146}
147147
148148func mustGetItem [PT ItemConstraint [T ], T any ](t testing.TB , p * Pool [PT , T ], nodeID uint32 ) PT {
149- s , err := p .getItem (operation . WithPreferredNodeID (context .Background (), nodeID ))
149+ s , err := p .getItem (endpoint . WithNodeID (context .Background (), nodeID ))
150150 if err != nil {
151151 t .Helper ()
152152 t .Fatalf ("%s: %v" , caller (), err )
@@ -184,12 +184,11 @@ func TestPool(t *testing.T) { //nolint:gocyclo
184184 require .NoError (t , err )
185185 })
186186 t .Run ("RequireNodeIdFromPool" , func (t * testing.T ) {
187- var nextNodeID uint32
188- nextNodeID = 0
187+ nextNodeID := uint32 (0 )
189188 var newSessionCalled uint32
190189 p := New [* testItem , testItem ](rootCtx ,
191190 WithTrace [* testItem , testItem ](defaultTrace ),
192- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
191+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
193192 newSessionCalled ++
194193 var (
195194 nodeID = nextNodeID
@@ -260,11 +259,13 @@ func TestPool(t *testing.T) { //nolint:gocyclo
260259 var newSessionCalled uint32
261260 p := New [* testItem , testItem ](rootCtx ,
262261 WithTrace [* testItem , testItem ](defaultTrace ),
263- WithCreateItemFunc (func (_ context.Context , nodeID uint32 ) (* testItem , error ) {
262+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
264263 newSessionCalled ++
265264 v := testItem {
266265 v : 0 ,
267266 onNodeID : func () uint32 {
267+ nodeID , _ := endpoint .ContextNodeID (ctx )
268+
268269 return nodeID
269270 },
270271 }
@@ -297,7 +298,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
297298 WithItemUsageLimit [* testItem , testItem ](5 ),
298299 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
299300 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
300- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
301+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
301302 atomic .AddInt64 (& newCounter , 1 )
302303
303304 var v testItem
@@ -321,7 +322,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
321322 var newCounter int64
322323 p := New (rootCtx ,
323324 WithLimit [* testItem , testItem ](1 ),
324- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
325+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
325326 atomic .AddInt64 (& newCounter , 1 )
326327 var v testItem
327328
@@ -355,7 +356,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
355356 WithLimit [* testItem , testItem ](3 ),
356357 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
357358 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
358- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
359+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
359360 var (
360361 idx = created .Add (1 ) - 1
361362 v = testItem {
@@ -518,7 +519,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
518519 p := New [* testItem , testItem ](rootCtx ,
519520 WithLimit [* testItem , testItem ](2 ),
520521 WithCreateItemTimeout [* testItem , testItem ](0 ),
521- WithCreateItemFunc [* testItem , testItem ](func (ctx context.Context , _ uint32 ) (* testItem , error ) {
522+ WithCreateItemFunc [* testItem , testItem ](func (ctx context.Context ) (* testItem , error ) {
522523 v := testItem {
523524 v : 0 ,
524525 onClose : func () error {
@@ -598,7 +599,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
598599 p := New (rootCtx ,
599600 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
600601 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
601- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
602+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
602603 atomic .AddInt64 (& counter , 1 )
603604
604605 if atomic .LoadInt64 (& counter ) < 10 {
@@ -621,7 +622,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
621622 p := New (rootCtx ,
622623 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
623624 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
624- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
625+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
625626 atomic .AddInt64 (& counter , 1 )
626627
627628 if atomic .LoadInt64 (& counter ) < 10 {
@@ -645,7 +646,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
645646 p := New (rootCtx ,
646647 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
647648 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
648- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
649+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
649650 atomic .AddInt64 (& counter , 1 )
650651
651652 if atomic .LoadInt64 (& counter ) < 10 {
@@ -668,7 +669,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
668669 p := New (rootCtx ,
669670 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
670671 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
671- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
672+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
672673 atomic .AddInt64 (& counter , 1 )
673674
674675 if atomic .LoadInt64 (& counter ) < 10 {
@@ -816,7 +817,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
816817 )
817818 p := New (rootCtx ,
818819 WithLimit [* testItem , testItem ](1 ),
819- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
820+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
820821 atomic .AddInt64 (& createCounter , 1 )
821822
822823 v := & testItem {
@@ -853,7 +854,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
853854 WithLimit [* testItem , testItem ](1 ),
854855 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
855856 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
856- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
857+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
857858 newItems .Add (1 )
858859
859860 v := & testItem {
@@ -914,7 +915,7 @@ func TestPool(t *testing.T) { //nolint:gocyclo
914915 WithLimit [* testItem , testItem ](1 ),
915916 WithCreateItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
916917 WithCloseItemTimeout [* testItem , testItem ](50 * time .Millisecond ),
917- WithCreateItemFunc (func (context.Context , uint32 ) (* testItem , error ) {
918+ WithCreateItemFunc (func (ctx context.Context ) (* testItem , error ) {
918919 created .Add (1 )
919920 v := testItem {
920921 v : 0 ,
0 commit comments