Skip to content

Commit 83cceca

Browse files
committed
Incorporate waiters PR feedback
1 parent f7c7d11 commit 83cceca

File tree

7 files changed

+30
-33
lines changed

7 files changed

+30
-33
lines changed

docs/source/1.0/spec/waiters.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@ following client pseudocode:
3131
``smithy.waiters#waitable`` trait
3232
=================================
3333

34-
Waiters are defined on :ref:`operations <operation>` using the
35-
``smithy.waiters#waitable`` trait.
36-
37-
Trait summary
34+
Summary
3835
Indicates that an operation has various named "waiters" that can be used
3936
to poll a resource until it enters a desired state.
4037
Trait selector
4138
``operation :not(-[input, output]-> structure > member > union[trait|streaming])``
4239

4340
(Operations that do not use :ref:`event streams <event-streams>` in their input or output)
44-
Trait value
41+
Value type
4542
A ``map`` of :ref:`waiter names <waiter-names>` to
4643
:ref:`Waiter structures <waiter-structure>`.
4744

@@ -53,6 +50,8 @@ exists:
5350
5451
namespace com.amazonaws.s3
5552
53+
use smithy.waiters#waitable
54+
5655
@waitable(
5756
BucketExists: {
5857
documentation: "Wait until a bucket exists",
@@ -139,7 +138,7 @@ waiter implementations perform the following steps:
139138
3. Stop waiting if the acceptor transitions the waiter to the ``success``
140139
or ``failure`` state.
141140

142-
4. If none of the acceptors are matched and an error was encountered while
141+
4. If none of the acceptors are matched *and* an error was encountered while
143142
calling the operation, then transition to the ``failure`` state and stop
144143
waiting.
145144
5. Transition the waiter to the ``retry`` state, follow the process
@@ -155,7 +154,7 @@ Waiter implementations MUST delay for a period of time before attempting a
155154
retry. The amount of time a waiter delays between retries is computed using
156155
`exponential backoff`_ through the following algorithm:
157156

158-
* Let ``attempt`` be the number retry attempts.
157+
* Let ``attempt`` be the number of retry attempts.
159158
* Let ``minDelay`` be the minimum amount of time to delay between retries in
160159
seconds, specified by the ``minDelay`` property of a
161160
:ref:`waiter <waiter-structure>` with a default of 2.
@@ -182,8 +181,8 @@ or equal to ``minDelay``, then set ``delay`` to ``remainingTime`` minus
182181
needlessly only to exceed ``maxWaitTime`` before issuing a final request.
183182

184183
Using the default ``minDelay`` of 2, ``maxDelay`` of 120, a ``maxWaitTime``
185-
of 300 (or 5 minutes), and assuming that requests complete in 0 seconds
186-
(for example purposes only), delays are computed as followed:
184+
of 300 (5 minutes), and assuming that requests complete in 0 seconds
185+
(for example purposes only), delays are computed as follows:
187186

188187
.. list-table::
189188
:header-rows: 1
@@ -335,8 +334,8 @@ members MUST be set:
335334
- Matches on both the input and output of an operation using a JMESPath_
336335
expression. Input parameters are available through the top-level
337336
``input`` field, and output data is available through the top-level
338-
``output`` field. This matcher can only be used on operations that
339-
define both input and output. This matcher is checked only if an
337+
``output`` field. This matcher MUST NOT be used on operations that
338+
do not define input or output. This matcher is checked only if an
340339
operation completes successfully.
341340
* - success
342341
- ``boolean``
@@ -488,9 +487,10 @@ comparator can be set to any of the following values:
488487
that is equal to an expected string.
489488
- ``string``
490489
* - booleanEquals
491-
- Matches if the return value of a JMESPath expression is a boolean.
492-
The ``expected`` value of a ``PathMatcher`` MUST be set to "true"
493-
or "false" to match the corresponding boolean value.
490+
- Matches if the return value of a JMESPath expression is a boolean
491+
that is equal to an expected boolean. The ``expected`` value of a
492+
``PathMatcher`` MUST be set to "true" or "false" to match the
493+
corresponding boolean value.
494494
- ``boolean``
495495
* - allStringEquals
496496
- Matches if the return value of a JMESPath expression is an array and
@@ -650,7 +650,7 @@ Implicit acceptors are unnecessary and can quickly become incomplete as new
650650
resource states and errors are added. Waiters have 2 implicit
651651
:ref:`acceptors <waiter-acceptor>`:
652652

653-
* (Step 4) - If none of the acceptors are matched and an error was
653+
* (Step 4) - If none of the acceptors are matched *and* an error was
654654
encountered while calling the operation, then transition to the
655655
``failure`` state and stop waiting.
656656
* (Step 5) - Transition the waiter to the ``retry`` state, follow the

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
extensions = ['sphinx_tabs.tabs',
2929
# We use redirects to be able to change page names.
3030
'sphinxcontrib.redirects',
31-
'sphinx.ext.imgmath',
3231
'smithy']
3332

3433
# Add any paths that contain templates here, relative to this directory.

smithy-waiters/src/main/java/software/amazon/smithy/waiters/AcceptorState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public enum AcceptorState implements ToNode {
3232
/** Transition to a final failure state. */
3333
FAILURE,
3434

35-
/** Transition to a final retry state. */
35+
/** Transition to an intermediate retry state. */
3636
RETRY;
3737

3838
@Override

smithy-waiters/src/main/java/software/amazon/smithy/waiters/ModelRuntimeTypeGenerator.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,10 @@ private Object createListOrSet(Shape shape, MemberShape member) {
152152
});
153153
}
154154

155-
// Visits members and mutates a copy of the current set of
156-
// visited shapes rather than a shared set. This a shape to
157-
// be used multiple times in the closure of a single shape
158-
// without causing the reuse of the shape to always be
159-
// assume to be a recursive type.
155+
// Visits members and mutates a copy of the current set of visited
156+
// shapes rather than a shared set. This allows a shape to be used
157+
// multiple times in the closure of a single shape without causing the
158+
// reuse of the shape to always be assumed to be a recursive type.
160159
private Object withCopiedVisitors(Supplier<Object> supplier) {
161160
// Account for recursive shapes at the current
162161
Set<MemberShape> visitedCopy = new HashSet<>(visited);
@@ -253,7 +252,7 @@ private int computeLength(Shape shape) {
253252
}
254253

255254
private double computeRange(Shape shape) {
256-
// Create a random string that does not exceed or go under the length trait.
255+
// Create a random string that does not exceed or go under the range trait.
257256
double i = 8;
258257

259258
if (shape.hasTrait(RangeTrait.class)) {

smithy-waiters/src/main/java/software/amazon/smithy/waiters/PathComparator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import software.amazon.smithy.model.node.ToNode;
2121

2222
/**
23-
* Defines a comparison to perform in a ListPathMatcher.
23+
* Defines a comparison to perform in a PathMatcher.
2424
*/
2525
public enum PathComparator implements ToNode {
2626

@@ -43,9 +43,9 @@ public enum PathComparator implements ToNode {
4343
}
4444

4545
/**
46-
* Creates a {@code ListPathComparator} from a {@link Node}.
47-
* @param node Node to create the {@code ListPathComparator} from.
48-
* @return Returns the created {@code ListPathComparator}.
46+
* Creates a {@code PathComparator} from a {@link Node}.
47+
* @param node Node to create the {@code PathComparator} from.
48+
* @return Returns the created {@code PathComparator}.
4949
* @throws ExpectationNotMetException if the given {@code node} is invalid.
5050
*/
5151
public static PathComparator fromNode(Node node) {

smithy-waiters/src/main/java/software/amazon/smithy/waiters/PathMatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public PathComparator getComparator() {
8080
/**
8181
* Creates a new instance from a {@link Node}.
8282
*
83-
* @param node Node tom create the ListPathMatcher from.
84-
* @return Returns the created ListPathMatcher.
83+
* @param node Node tom create the PathMatcher from.
84+
* @return Returns the created PathMatcher.
8585
* @throws ExpectationNotMetException if the given Node is invalid.
8686
*/
8787
public static PathMatcher fromNode(Node node) {

smithy-waiters/src/main/resources/META-INF/smithy/waiters.smithy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ structure Waiter {
2929
minDelay: WaiterDelay,
3030

3131
/// The maximum amount of time in seconds to delay between each retry.
32-
/// This value defaults to 256 if not specified (or, 4 minutes and 16
33-
/// seconds). If specified, this value MUST be greater than or equal
34-
/// to 1.
32+
/// This value defaults to 120 if not specified (or, 2 minutes). If
33+
/// specified, this value MUST be greater than or equal to 1.
3534
maxDelay: WaiterDelay,
3635
}
3736

@@ -126,7 +125,7 @@ structure PathMatcher {
126125
comparator: PathComparator,
127126
}
128127

129-
/// Defines a comparison to perform in a ListPathMatcher.
128+
/// Defines a comparison to perform in a PathMatcher.
130129
@enum([
131130
{
132131
"name": "STRING_EQUALS",

0 commit comments

Comments
 (0)