Skip to content

Commit ca5fbf0

Browse files
toumorokoshinoahdietzalin04
authored
feat(AIP-148): introduce purge_time (#1169)
expire_time for both soft resource purge time and resource expire time (when it will not be useful) could cause user confusion as to whether the resource is soft-deletable or has an expiration. splitting the fields resolves the issue. --------- Co-authored-by: Noah Dietz <noahdietz@users.noreply.github.com> Co-authored-by: Angie Lin <angielin@google.com>
1 parent 8705d5c commit ca5fbf0

3 files changed

Lines changed: 34 additions & 19 deletions

File tree

aip/general/0148.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,23 @@ Resources that support soft delete (AIP-164) **should** provide this field.
100100

101101
#### expire_time
102102

103-
The `google.protobuf.Timestamp expire_time` field **should** usually represent
104-
the time when a soft deleted resource will be purged from the system. It
105-
**may** be used for similar forms of expiration as described in AIP-214.
106-
Resources that support soft delete **should** include this field.
103+
The `google.protobuf.Timestamp expire_time` field **should** represent the time
104+
that a given resource or resource attribute is no longer useful or valid (e.g. a
105+
rotating security key). It **may** be used for similar forms of expiration as
106+
described in AIP-214.
107107

108-
In some situations, it can be difficult to provide an exact `expire_time`
109-
value, because of implementation dependencies. Services **may** provide an
110-
`expire_time` value that is inexact, but the resource **must not** be expired
111-
from the system before that time.
108+
Services **may** provide an `expire_time` value that is inexact, but the
109+
resource **must not** expire before that time.
112110

113-
Resources that support soft delete (AIP-164) **should** provide this field.
111+
#### purge_time
112+
113+
The `google.protobuf.Timestamp purge_time` field **should** represent the time
114+
when a soft deleted resource will be purged from the system (see AIP-164).
115+
It **may** be used for similar forms of expiration as described in AIP-214.
116+
Resources that support soft delete **should** include this field.
117+
118+
Services **may** provide a `purge_time` value that is inexact, but the resource
119+
**must not** be purged from the system before that time.
114120

115121
## Further reading
116122

@@ -122,8 +128,14 @@ Resources that support soft delete (AIP-164) **should** provide this field.
122128
- For the `validate_only` field, see AIP-163.
123129
- For fields related to soft delete and undelete, see AIP-164.
124130

131+
## History
132+
133+
Before 2023-07, `purge_time` for soft-deleted resources was also called
134+
`expire_time`. `purge_time` was introduced to reduce user confusion.
135+
125136
## Changelog
126137

138+
- **2023-07-13**: Introduce the term `purge_time`.
127139
- **2021-04-06**: Require output only field behavior for `uid` and `delete_time`
128140
fields.
129141

aip/general/0164.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mark the resource as having been deleted, but not completely remove it from the
2424
system. If the method behaves this way, it **should** return the updated
2525
resource instead of `google.protobuf.Empty`.
2626

27-
Resources that support soft delete **should** have an `expire_time` field as
27+
Resources that support soft delete **should** have a `purge_time` field as
2828
described in AIP-148. Additionally, resources **should** include a `DELETED`
2929
state value if the resource includes a `state` field (AIP-216).
3030

@@ -160,6 +160,7 @@ resource is not deleted, the service **must** respond with `ALREADY_EXISTS`
160160

161161
## Changelog
162162

163+
- **2023-07-13**: Renamed overloaded `expire_time` to `purge_time`.
163164
- **2021-07-12**: Added error behavior when soft deleting a deleted resource.
164165
- **2021-07-12**: Clarified that `ALREADY_EXISTS` errors apply to `Undelete`.
165166
- **2021-07-12**: Changed the `expire_time` field to "should" for consistency

aip/general/0214.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ placement:
99

1010
# Resource expiration
1111

12-
Customers often want to provide the time that a given resource or attribute of
13-
a resource is no longer useful or should be deleted. Currently we recommend
14-
that customers do this by specifying an exact "expiration time" into a
15-
`google.protobuf.Timestamp expire_time` field; however, this adds additional
16-
strain on the user when they want to specify a relative time offset until
17-
expiration rather than a specific time until expiration.
12+
Customers often want to provide the time that a given resource or resource
13+
attribute is no longer useful or valid (e.g. a rotating security key). Currently
14+
we recommend that customers do this by specifying an exact "expiration time"
15+
into a `google.protobuf.Timestamp expire_time` field; however, this adds
16+
additional strain on the user when they want to specify a relative time offset
17+
until expiration rather than a specific time until expiration.
1818

1919
Furthermore, the world understands the concept of a "time-to-live", often
2020
abbreviated to TTL, but the typical format of this field (an integer, measured
@@ -55,9 +55,11 @@ message ExpiringResource {
5555
}
5656
```
5757

58-
## Alternatives considered
58+
## Rationale
5959

60-
### A new standard field called `ttl`
60+
### Alternatives considered
61+
62+
#### A new standard field called `ttl`
6163

6264
We considered allowing a standard field called `ttl` as an alternative way of
6365
defining the expiration, however doing so would require that API services
@@ -66,7 +68,7 @@ potentially cause problems with the read-modify-write lifecycle where a
6668
resource is being processed for some time, and effectively has its life
6769
extended as a result of that processing time.
6870

69-
### Always use `expire_time`
71+
#### Always use `expire_time`
7072

7173
This is the current state of the world with a few exceptions. In this scenario,
7274
we could potentially push the computation of `now + ttl = expire_time` into

0 commit comments

Comments
 (0)