2868
}
2869
2870
>
func (e *matchingEngineImpl) ListNexusEndpoints(ctx context.Context, request *matchingservice.ListNexusEndpointsRequest) (*matchingservice.ListNexusEndpointsResponse, error) {
matching_engine.go
2871
>
lastKnownVersion := request.LastKnownTableVersion
2872
>
// Read API, verify table ownership via membership.
2873
>
isOwner, ownershipLostCh, err := e.checkNexusEndpointsOwnership()
2874
>
if err != nil {
2875
e.logger.Error("Failed to check Nexus endpoints ownership", tag.Error(err))
2876
return nil, serviceerror.NewAbortedf("cannot verify ownership of Nexus endpoints table: %v", err)
2877
}
2879
e.logger.Error("Matching node doesn't think it's the Nexus endpoints table owner", tag.Error(err))
2880
return nil, serviceerror.NewAborted("matching node doesn't think it's the Nexus endpoints table owner")
2881
}
2882
2884
>
if request.NextPageToken != nil {
2885
return nil, serviceerror.NewInvalidArgument("request Wait=true and NextPageToken!=nil on ListNexusEndpoints request. waiting is only allowed on first page")
2886
}
2887
2888
// if waiting, send request with unknown table version so we get the newest view of the table
2890
>
2891
>
var cancel context.CancelFunc
2892
>
ctx, cancel = contextutil.WithDeadlineBuffer(ctx, e.config.ListNexusEndpointsLongPollTimeout(), returnEmptyTaskTimeBudget)
2893
>
defer cancel()
2894
}
2895
2897
>
resp, tableVersionChanged, err := e.nexusEndpointClient.ListNexusEndpoints(ctx, request)
2898
>
if err != nil {
2899
return resp, err
2900
}
2901
2903
>
// long-poll: wait for data to change/appear
2904
>
select {
2905
case <-ownershipLostCh:
2906
return nil, serviceerror.NewAborted("Nexus endpoints table ownership lost")