Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit75def32

Browse files
committed
elaborate documentation
1 parent293d310 commit75def32

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎agent/unit.go‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@ import (
99
)
1010

1111
// A Unit (named to represent its resemblance to the systemd concept) is a kind of lock that encodes metadata
12-
// about the state of a resource. Units are primarily meant tobe sections of processes such as coder scripts
13-
//that encapsulatea contended resource, such as a database lock or a socket.
12+
// about the state of a resource. Units are primarily meant toencapsulate sections of processes such as coder scripts
13+
//to coordinate access toa contended resource, such as a database lock or a socket that is used or provided by the script.
1414
//
15-
// In most cases, `coder_script` resources will create and manage units by invocations of
15+
// In most cases, `coder_script` resources will create and manage units by invocations of:
1616
// * `coder agent unit start <unit> [--wants <unit>]`
1717
// * `coder agent unit complete <unit>`
1818
// * `coder agent unit fail <unit>`
19-
//Units may be acquired with no intention of releasing them as a signal to other scripts that
20-
// a contended resource has been provided and is available. For example, a script that installs curl
21-
//might acquire a unit called "curl-install" to signal to other scripts that curl has been installed
22-
//and is available. In this case, the unit will becompleted when theagent is stopped.
19+
//* `coder agent unit lock <unit>`
20+
//
21+
//Those CLI command examples are implemented elsewhere and are only shown here as a convenient example of the functionality
22+
//provided by Units. This file contains analogous methods to beused by theCLI implementations.
2323
typeUnitstruct {
2424
Namestring
2525
history []Event
2626
Wants []*Unit
2727
}
2828

29+
// Events provide a coarse grained record of the lifecycle and history of a unit.
2930
typeEventstruct {
3031
TypeUnitEventType
3132
Timestamp time.Time

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp