Skip to content

Commit 87ca33d

Browse files
Fix comments.
1 parent 530cf29 commit 87ca33d

File tree

18 files changed

+92
-92
lines changed

18 files changed

+92
-92
lines changed

payload/api/internal/client/unitfacade.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ type facadeCaller interface {
1515
}
1616

1717
// UnitFacadeClient provides methods for interacting with Juju's internal
18-
// RPC API, relative to workloads.
18+
// RPC API, relative to payloads.
1919
type UnitFacadeClient struct {
2020
facadeCaller
2121
}
2222

23-
// NewUnitFacadeClient builds a new workload API client.
23+
// NewUnitFacadeClient builds a new payload API client.
2424
func NewUnitFacadeClient(caller facadeCaller) UnitFacadeClient {
2525
return UnitFacadeClient{caller}
2626
}

payload/api/internal/data.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ type LookUpArgs struct {
2626

2727
// LookUpArg contains all the information necessary to identify a payload.
2828
type LookUpArg struct {
29-
// Name is the workload name.
29+
// Name is the payload name.
3030
Name string
31-
// ID uniquely identifies the workload for the given name.
31+
// ID uniquely identifies the payload for the given name.
3232
ID string
3333
}
3434

@@ -49,7 +49,7 @@ type SetStatusArg struct {
4949
// Untrack uses params.Entities.
5050

5151
// PayloadResults is the result for a call that makes one or more requests
52-
// about workloads.
52+
// about payloads.
5353
type PayloadResults struct {
5454
Results []PayloadResult
5555
}
@@ -59,9 +59,9 @@ type PayloadResults struct {
5959
// PayloadResult contains the result for a single call.
6060
type PayloadResult struct {
6161
params.Entity
62-
// Payload holds the details of the workload, if any.
62+
// Payload holds the details of the payload, if any.
6363
Payload *api.Payload
64-
// NotFound indicates that the workload was not found in state.
64+
// NotFound indicates that the payload was not found in state.
6565
NotFound bool
6666
// Error is the error (if any) for the call referring to ID.
6767
Error *params.Error

payload/api/internal/helpers.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func API2ID(tagStr string) (string, error) {
8989
return tag.Id(), nil
9090
}
9191

92-
// Payloads2TrackArgs converts the provided workload info into arguments
92+
// Payloads2TrackArgs converts the provided payload info into arguments
9393
// for the Track API endpoint.
9494
func Payloads2TrackArgs(payloads []payload.Payload) TrackArgs {
9595
var args TrackArgs
@@ -101,13 +101,13 @@ func Payloads2TrackArgs(payloads []payload.Payload) TrackArgs {
101101
return args
102102
}
103103

104-
// IDs2ListArgs converts the provided workload IDs into arguments
104+
// IDs2ListArgs converts the provided payload IDs into arguments
105105
// for the List API endpoint.
106106
func IDs2ListArgs(ids []string) params.Entities {
107107
return ids2args(ids)
108108
}
109109

110-
// FullIDs2LookUpArgs converts the provided workload "full" IDs into arguments
110+
// FullIDs2LookUpArgs converts the provided payload "full" IDs into arguments
111111
// for the LookUp API endpoint.
112112
func FullIDs2LookUpArgs(fullIDs []string) LookUpArgs {
113113
var args LookUpArgs
@@ -121,7 +121,7 @@ func FullIDs2LookUpArgs(fullIDs []string) LookUpArgs {
121121
return args
122122
}
123123

124-
// IDs2SetStatusArgs converts the provided workload IDs into arguments
124+
// IDs2SetStatusArgs converts the provided payload IDs into arguments
125125
// for the SetStatus API endpoint.
126126
func IDs2SetStatusArgs(ids []string, status string) SetStatusArgs {
127127
var args SetStatusArgs
@@ -135,7 +135,7 @@ func IDs2SetStatusArgs(ids []string, status string) SetStatusArgs {
135135
return args
136136
}
137137

138-
// IDs2UntrackArgs converts the provided workload IDs into arguments
138+
// IDs2UntrackArgs converts the provided payload IDs into arguments
139139
// for the Untrack API endpoint.
140140
func IDs2UntrackArgs(ids []string) params.Entities {
141141
return ids2args(ids)

payload/api/internal/server/unitfacade.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ import (
1414
"github.com/juju/juju/payload/api/internal"
1515
)
1616

17-
// UnitPayloads exposes the State functionality for a unit's workloads.
17+
// UnitPayloads exposes the State functionality for a unit's payloads.
1818
type UnitPayloads interface {
19-
// Track tracks a workload for the unit and info.
19+
// Track tracks a payload for the unit and info.
2020
Track(info payload.Payload) error
21-
// List returns information on the workload with the id on the unit.
21+
// List returns information on the payload with the id on the unit.
2222
List(ids ...string) ([]payload.Result, error)
23-
// Settatus sets the status for the workload with the given id on the unit.
23+
// Settatus sets the status for the payload with the given id on the unit.
2424
SetStatus(id, status string) error
2525
// LookUp returns the payload ID for the given name/rawID pair.
2626
LookUp(name, rawID string) (string, error)
27-
// Untrack removes the information for the workload with the given id.
27+
// Untrack removes the information for the payload with the given id.
2828
Untrack(id string) error
2929
}
3030

31-
// UnitFacade serves workload-specific API methods.
31+
// UnitFacade serves payload-specific API methods.
3232
type UnitFacade struct {
33-
// State exposes the workload aspect of Juju's state.
33+
// State exposes the payload aspect of Juju's state.
3434
State UnitPayloads
3535
}
3636

@@ -39,7 +39,7 @@ func NewUnitFacade(st UnitPayloads) *UnitFacade {
3939
return &UnitFacade{State: st}
4040
}
4141

42-
// Track stores a workload to be tracked in state.
42+
// Track stores a payload to be tracked in state.
4343
func (uf UnitFacade) Track(args internal.TrackArgs) (internal.PayloadResults, error) {
4444
logger.Debugf("tracking %d payloads from API", len(args.Payloads))
4545

@@ -69,9 +69,9 @@ func (uf UnitFacade) track(pl payload.Payload) (string, error) {
6969
return id, nil
7070
}
7171

72-
// List builds the list of workload being tracked for
72+
// List builds the list of payload being tracked for
7373
// the given unit and IDs. If no IDs are provided then all tracked
74-
// workloads for the unit are returned.
74+
// payloads for the unit are returned.
7575
func (uf UnitFacade) List(args params.Entities) (internal.PayloadResults, error) {
7676
if len(args.Entities) == 0 {
7777
return uf.listAll()
@@ -123,7 +123,7 @@ func (uf UnitFacade) listAll() (internal.PayloadResults, error) {
123123
return r, nil
124124
}
125125

126-
// LookUp identifies the workload with the provided name and raw ID.
126+
// LookUp identifies the payload with the provided name and raw ID.
127127
func (uf UnitFacade) LookUp(args internal.LookUpArgs) (internal.PayloadResults, error) {
128128
var r internal.PayloadResults
129129
for _, arg := range args.Args {
@@ -150,7 +150,7 @@ func (uf UnitFacade) SetStatus(args internal.SetStatusArgs) (internal.PayloadRes
150150
return r, nil
151151
}
152152

153-
// Untrack marks the identified workload as no longer being tracked.
153+
// Untrack marks the identified payload as no longer being tracked.
154154
func (uf UnitFacade) Untrack(args params.Entities) (internal.PayloadResults, error) {
155155
var r internal.PayloadResults
156156
for _, entity := range args.Entities {

payload/api/server/public.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import (
1212

1313
// EnvPayloads exposes the State functionality for payloads in an env.
1414
type EnvPayloads interface {
15-
// ListAll returns information on the workload with the id on the unit.
15+
// ListAll returns information on the payload with the id on the unit.
1616
ListAll() ([]payload.FullPayloadInfo, error)
1717
}
1818

1919
// PublicAPI serves payload-specific API methods.
2020
type PublicAPI struct {
21-
// State exposes the workload aspect of Juju's state.
21+
// State exposes the payload aspect of Juju's state.
2222
State EnvPayloads
2323
}
2424

@@ -29,7 +29,7 @@ func NewPublicAPI(st EnvPayloads) *PublicAPI {
2929

3030
// List builds the list of payloads being tracked for
3131
// the given unit and IDs. If no IDs are provided then all tracked
32-
// workloads for the unit are returned.
32+
// payloads for the unit are returned.
3333
func (a PublicAPI) List(args api.EnvListArgs) (api.EnvListResults, error) {
3434
var r api.EnvListResults
3535

payload/component.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright 2015 Canonical Ltd.
22
// Licensed under the AGPLv3, see LICENCE file for details.
33

4-
// The workload package (and subpackages) contain the implementation of
5-
// the charm workload feature component. The various pieces are
4+
// The payload package (and subpackages) contain the implementation of
5+
// the charm payload feature component. The various pieces are
66
// connected to the Juju machinery in component/all/payload.go.
77
package payload
88

9-
// ComponentName is the name of the Juju component for workload management.
9+
// ComponentName is the name of the Juju component for payload management.
1010
const ComponentName = "payloads"

payload/context/context.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ var logger = loggo.GetLogger("juju.payload.context")
1616

1717
// APIClient represents the API needs of a Context.
1818
type APIClient interface {
19-
// List requests the workload info for the given IDs.
19+
// List requests the payload info for the given IDs.
2020
List(fullIDs ...string) ([]payload.Result, error)
21-
// Track sends a request to update state with the provided workloads.
21+
// Track sends a request to update state with the provided payloads.
2222
Track(payloads ...payload.Payload) ([]payload.Result, error)
23-
// Untrack removes the workloads from our list track.
23+
// Untrack removes the payloads from our list track.
2424
Untrack(fullIDs ...string) ([]payload.Result, error)
2525
// SetStatus sets the status for the given IDs.
2626
SetStatus(status string, fullIDs ...string) ([]payload.Result, error)
@@ -29,25 +29,25 @@ type APIClient interface {
2929
// TODO(ericsnow) Rename Get and Set to more specifically describe what
3030
// they are for.
3131

32-
// Component provides the hook context data specific to workloads.
32+
// Component provides the hook context data specific to payloads.
3333
type Component interface {
34-
// Get returns the workload info corresponding to the given ID.
34+
// Get returns the payload info corresponding to the given ID.
3535
Get(class, id string) (*payload.Payload, error)
36-
// Track records the workload info in the hook context.
36+
// Track records the payload info in the hook context.
3737
Track(payload payload.Payload) error
38-
// Untrack removes the workload from our list of workloads to track.
38+
// Untrack removes the payload from our list of payloads to track.
3939
Untrack(class, id string) error
4040
// SetStatus sets the status of the payload.
4141
SetStatus(class, id, status string) error
42-
// List returns the list of registered workload IDs.
42+
// List returns the list of registered payload IDs.
4343
List() ([]string, error)
4444
// Flush pushes the hook context data out to state.
4545
Flush() error
4646
}
4747

4848
var _ Component = (*Context)(nil)
4949

50-
// Context is the workload portion of the hook context.
50+
// Context is the payload portion of the hook context.
5151
type Context struct {
5252
api APIClient
5353
dataDir string
@@ -56,7 +56,7 @@ type Context struct {
5656
updates map[string]payload.Payload
5757
}
5858

59-
// NewContext returns a new jujuc.ContextComponent for workloads.
59+
// NewContext returns a new jujuc.ContextComponent for payloads.
6060
func NewContext(api APIClient, dataDir string) *Context {
6161
return &Context{
6262
api: api,
@@ -66,7 +66,7 @@ func NewContext(api APIClient, dataDir string) *Context {
6666
}
6767
}
6868

69-
// NewContextAPI returns a new jujuc.ContextComponent for workloads.
69+
// NewContextAPI returns a new jujuc.ContextComponent for payloads.
7070
func NewContextAPI(api APIClient, dataDir string) (*Context, error) {
7171
results, err := api.List()
7272
if err != nil {
@@ -88,8 +88,8 @@ type HookContext interface {
8888
Component(string) (Component, error)
8989
}
9090

91-
// ContextComponent returns the hook context for the workload
92-
// workload component.
91+
// ContextComponent returns the hook context for the payload
92+
// payload component.
9393
func ContextComponent(ctx HookContext) (Component, error) {
9494
compCtx, err := ctx.Component(payload.ComponentName)
9595
if errors.IsNotFound(err) {
@@ -106,7 +106,7 @@ func ContextComponent(ctx HookContext) (Component, error) {
106106

107107
// TODO(ericsnow) Should we build in refreshes in all the methods?
108108

109-
// Payloads returns the workloads known to the context.
109+
// Payloads returns the payloads known to the context.
110110
func (c *Context) Payloads() ([]payload.Payload, error) {
111111
payloads := mergePayloadMaps(c.payloads, c.updates)
112112
var newPayloads []payload.Payload
@@ -118,7 +118,7 @@ func (c *Context) Payloads() ([]payload.Payload, error) {
118118
}
119119

120120
func mergePayloadMaps(payloads, updates map[string]payload.Payload) map[string]payload.Payload {
121-
// At this point workloads and updates have already been checked for
121+
// At this point payloads and updates have already been checked for
122122
// nil values so we won't see any here.
123123
result := make(map[string]payload.Payload)
124124
for k, v := range payloads {
@@ -130,7 +130,7 @@ func mergePayloadMaps(payloads, updates map[string]payload.Payload) map[string]p
130130
return result
131131
}
132132

133-
// Get returns the workload info corresponding to the given ID.
133+
// Get returns the payload info corresponding to the given ID.
134134
func (c *Context) Get(class, id string) (*payload.Payload, error) {
135135
fullID := payload.BuildID(class, id)
136136
logger.Tracef("getting %q from hook context", fullID)
@@ -145,7 +145,7 @@ func (c *Context) Get(class, id string) (*payload.Payload, error) {
145145
return &actual, nil
146146
}
147147

148-
// List returns the sorted names of all registered workloads.
148+
// List returns the sorted names of all registered payloads.
149149
func (c *Context) List() ([]string, error) {
150150
logger.Tracef("listing all payloads in hook context")
151151

@@ -164,7 +164,7 @@ func (c *Context) List() ([]string, error) {
164164
return ids, nil
165165
}
166166

167-
// Track records the workload info in the hook context.
167+
// Track records the payload info in the hook context.
168168
func (c *Context) Track(pl payload.Payload) error {
169169
logger.Tracef("adding %q to hook context: %#v", pl.FullID(), pl)
170170

payload/context/register.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (c *RegisterCmd) Run(ctx *cmd.Context) error {
8686
}
8787

8888
// We flush to state immedeiately so that status reflects the
89-
// workload correctly.
89+
// payload correctly.
9090
if err := c.api.Flush(); err != nil {
9191
return errors.Trace(err)
9292
}

payload/context/status-set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (c *StatusSetCmd) Run(ctx *cmd.Context) error {
7272
// TODO(ericsnow) Is the flush really necessary?
7373

7474
// We flush to state immedeiately so that status reflects the
75-
// workload correctly.
75+
// payload correctly.
7676
if err := c.api.Flush(); err != nil {
7777
return errors.Trace(err)
7878
}

payload/context/unregister.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (c *UnregisterCmd) Run(ctx *cmd.Context) error {
7979
// TODO(ericsnow) Is the flush really necessary?
8080

8181
// We flush to state immedeiately so that status reflects the
82-
// workload correctly.
82+
// payload correctly.
8383
if err := c.api.Flush(); err != nil {
8484
return errors.Trace(err)
8585
}

payload/id.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func BuildID(class, id string) string {
2121
return class + "/" + id
2222
}
2323

24-
// ParseID extracts the workload name and details ID from the provided string.
24+
// ParseID extracts the payload name and details ID from the provided string.
2525
// The format is expected to be name/pluginID. If no separator is found, the
2626
// whole string is assumed to be the name.
2727
func ParseID(id string) (name, pluginID string) {

payload/payload.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ type FullPayloadInfo struct {
6464
Machine string
6565
}
6666

67-
// Result is a struct that ties an error to a workload ID.
67+
// Result is a struct that ties an error to a payload ID.
6868
type Result struct {
69-
// ID is the ID of the workload that this result applies to.
69+
// ID is the ID of the payload that this result applies to.
7070
ID string
71-
// Payload holds the info about the workload, if available.
71+
// Payload holds the info about the payload, if available.
7272
Payload *FullPayloadInfo
73-
// NotFound indicates that the workload was not found in Juju.
73+
// NotFound indicates that the payload was not found in Juju.
7474
NotFound bool
7575
// Error is the error associated with this result (if any).
7676
Error error

payload/persistence/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type EnvPersistenceBase interface {
2626
// unitPersistence describes the per-unit functionality needed
2727
// for env persistence.
2828
type unitPersistence interface {
29-
// ListAll returns all workloads associated with the unit.
29+
// ListAll returns all payloads associated with the unit.
3030
ListAll() ([]payload.Payload, error)
3131
}
3232

0 commit comments

Comments
 (0)