xref: /aosp_15_r20/external/googleapis/google/longrunning/README.md (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker## Long-running Operations API
2*d5c09012SAndroid Build Coastguard Worker
3*d5c09012SAndroid Build Coastguard WorkerThis package contains the definition of an abstract interface that
4*d5c09012SAndroid Build Coastguard Workermanages long running operations with API services.
5*d5c09012SAndroid Build Coastguard Worker
6*d5c09012SAndroid Build Coastguard Worker### Operation
7*d5c09012SAndroid Build Coastguard Worker
8*d5c09012SAndroid Build Coastguard WorkerThe primary message to understand within LRO is the `Operation` message.
9*d5c09012SAndroid Build Coastguard WorkerOperations have a unique name (in the context of a particular endpoint).
10*d5c09012SAndroid Build Coastguard WorkerAdditionally, a service (called `Operations` -- plural) defines the interface
11*d5c09012SAndroid Build Coastguard Workerfor querying the state of any given operation.
12*d5c09012SAndroid Build Coastguard Worker
13*d5c09012SAndroid Build Coastguard WorkerAPIs that implement a concept of long-running operations are encouraged
14*d5c09012SAndroid Build Coastguard Workerto follow this pattern: When a caller invokes an API backend to start a job...
15*d5c09012SAndroid Build Coastguard Worker
16*d5c09012SAndroid Build Coastguard Worker  * The API backend starts asychronous work to fulfill the caller's
17*d5c09012SAndroid Build Coastguard Worker    request, and generates a unique name (the `Operation` name) to refer
18*d5c09012SAndroid Build Coastguard Worker    to the ongoing asychronous work.
19*d5c09012SAndroid Build Coastguard Worker  * The API backend immediately returns the `Operation` back to the caller.
20*d5c09012SAndroid Build Coastguard Worker  * The caller can invoke the API methods defined in the `Operations` service
21*d5c09012SAndroid Build Coastguard Worker    to get the current status of the asychronous work, and also to
22*d5c09012SAndroid Build Coastguard Worker    discover the final result (success or error).
23*d5c09012SAndroid Build Coastguard Worker
24*d5c09012SAndroid Build Coastguard WorkerFor Google APIs, the implementation of this pattern and the use of this
25*d5c09012SAndroid Build Coastguard Workerproto are part of our [design rules][operations-rules]. Additionally, our
26*d5c09012SAndroid Build Coastguard Worker[API client tooling][gapic-generator] seeks to be intelligent about these, to
27*d5c09012SAndroid Build Coastguard Workerimprove the client API consumption experience. Therefore, APIs outside of
28*d5c09012SAndroid Build Coastguard WorkerGoogle can also benefit by following this same pattern.
29*d5c09012SAndroid Build Coastguard Worker
30*d5c09012SAndroid Build Coastguard Worker  [operations-rules]: https://cloud.google.com/apis/design/design_patterns#long_running_operations
31*d5c09012SAndroid Build Coastguard Worker  [gapic-generator]: https://github.com/googleapis/gapic-generator
32