Skip to content

Commit d5285d3

Browse files
committed
created_at documentation
1 parent 3ac27e9 commit d5285d3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/tracked_struct.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,13 @@ where
264264
/// create this struct with different values.
265265
durability: Durability,
266266

267-
/// The revisiono in which the tracked struct was first-created.
268-
/// This is different from `updated_at` which gets bumped on every read.
267+
/// The revision in which the tracked struct was first created.
269268
///
270-
/// Tracking `created_at` is important to detect tracked struct ids
271-
/// that are being reused after they've been freed in a previous revision.
269+
/// Unlike `updated_at`, which gets bumped on every read,
270+
/// `created_at` is updated whenever an untracked field is updated.
271+
/// This is necessary to detect reused tracked struct ids _after_
272+
/// they've been freed in a prior revision or tracked structs that have been updated
273+
/// in-place because of a bad `Hash` implementation.
272274
created_at: Revision,
273275

274276
/// The revision when this tracked struct was last updated.
@@ -472,11 +474,11 @@ where
472474

473475
// The protocol is:
474476
//
475-
// * When we begin updating, we store `None` in the `created_at` field
476-
// * When completed, we store `Some(current_revision)` in `created_at`
477+
// * When we begin updating, we store `None` in the `updated_at` field
478+
// * When completed, we store `Some(current_revision)` in `updated_at`
477479
//
478480
// No matter what mischief users get up to, it should be impossible for us to
479-
// observe `None` in `created_at`. The `id` should only be associated with one
481+
// observe `None` in `updated_at`. The `id` should only be associated with one
480482
// query and that query can only be running in one thread at a time.
481483
//
482484
// We *can* observe `Some(current_revision)` however, which means that this

0 commit comments

Comments
 (0)