Decoupling LRO from core-client#1043
Conversation
src/lro/azureAsyncPolling.ts
Outdated
|
|
||
| export function processAzureAsyncOperationResult<TResult>( | ||
| restrieveResource: (path?: string) => Promise<LROResult<TResult>>, | ||
| lro: LRO<TResult>, |
There was a problem hiding this comment.
passing the whole object is needed so retrieveAzureAsyncResource can access this internaly.
src/coreClientLRO.ts
Outdated
| } | ||
| } | ||
|
|
||
| export class CoreClientLRO<T> implements LRO<T> { |
There was a problem hiding this comment.
this class is the main contribution of this PR
src/generators/operationGenerator.ts
Outdated
| `const lro = new CoreClientLRO(sendOperation,${operationParamsName}, | ||
| ${operationSpecName},${finalStateStr})`, | ||
| `return new LROPoller({intervalInMs: options?.updateIntervalInMs}, | ||
| ${operationParamsName}, | ||
| ${operationSpecName}, | ||
| sendOperation, | ||
| ${finalStateStr} | ||
| lro |
There was a problem hiding this comment.
this is where CoreClientLRO is instantiated.
src/lro/models.ts
Outdated
| /** | ||
| * Description of a long running operation | ||
| */ | ||
| export interface LRO<T> { |
There was a problem hiding this comment.
this is the abstract interface to be instantiated by any client
| export function extractHttpDetails({ | ||
| path, | ||
| method | ||
| }: OperationRequestDetails): { | ||
| path: string; | ||
| httpMethod: HttpMethods; | ||
| } { |
There was a problem hiding this comment.
for some reason the compiler did not like leaving the return type implicit so I had to add it.
2fd5c28 to
122773b
Compare
122773b to
b66e52d
Compare
|
The changes look fine. But, in our last conversation, Jose was telling me that the plan was to move LROEngine to core-lro. This PR does not seem to do that. Or is it some intermediate step? Can you clarify? |
|
@sarangan12 sorry about the confusion! Yes it is an intermediate step. I updated the PR description. |
This PR refactors the LRO files so that all files in
src/lrodo not use anything fromcore-client. These files are being instantiated withcore-clientthings insrc/coreClientLro.ts. A similar file forcore-httpis provided,src/coreHttpLro.tswhich restores the LRO support for core-http clients. This PR is a step toward moving everything insrc/lroto@azure/core-lro. See Azure/azure-sdk-for-js#15949 for details.