Skip to content

container: update confusing GoDoc for Container and State#48726

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:container_update_comment
Oct 25, 2024
Merged

container: update confusing GoDoc for Container and State#48726
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:container_update_comment

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

relates to:

container: update confusing GoDoc for Container and State

This comment was added in f49c3f2, following 517ba44, which embedded the State, which caused the JSON presentation to change.

Referring to a very old (and now removed) API version made this confusing; while it was added to preserve the pre-v1.11 API format, it still applies to current API versions (i.e., we cannot change this unless an explicit API change).

This patch;

  • removes the confusing comment
  • touches up the comment describing the reason for embedding the State
  • also mentions the State's sync.Mutex, which acts as a lock not only for the state itself, but for the container as a whole (which was the motivation for 517ba44).
  • Update GoDoc for the State struct to clarify the purpose of the Mutex.

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added status/2-code-review area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code labels Oct 22, 2024
@thaJeztah thaJeztah added this to the 28.0.0 milestone Oct 22, 2024
@thaJeztah thaJeztah self-assigned this Oct 22, 2024
@thaJeztah
Copy link
Copy Markdown
Member Author

@laurazard @vvoland PTAL 🤗

Comment thread container/container.go Outdated
Root string `json:"-"` // Path to the "home" of the container, including metadata.
BaseFS string `json:"-"` // Path to the graphdriver mountpoint
RWLayer layer.RWLayer `json:"-"`
// We embed [State] here for so that Container supports states directly,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, dang; typo here ("for so that"🙃☺️)

This comment was added in f49c3f2, following
517ba44, which embedded the State, which
caused the JSON presentation to change.

Referring to a very old (and now removed) API version made this confusing;
while it was added to preserve the pre-v1.11 API format, it still applies
to current API versions (i.e., we cannot change this unless an explicit
API change).

This patch;

- removes the confusing comment
- touches up the comment describing the reason for embedding the State
- also mentions the State's sync.Mutex, which acts as a lock not only
  for the state itself, but for the container as a whole (which was the
  motivation for 517ba44).
- Update GoDoc for the State struct to clarify the purpose of the Mutex.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the container_update_comment branch from ffb78d7 to 8e0bf25 Compare October 25, 2024 12:46
@thaJeztah thaJeztah merged commit d96020b into moby:master Oct 25, 2024
@thaJeztah thaJeztah deleted the container_update_comment branch October 25, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code status/4-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants