Skip to content

Commit 20285b5

Browse files
committed
liquid: add links in docstrings
To make it easier to navigate up and down the type hierarchy.
1 parent b2da5d8 commit 20285b5

File tree

9 files changed

+47
-47
lines changed

9 files changed

+47
-47
lines changed

liquid/commitment.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (r CommitmentChangeResponse) Clone() CommitmentChangeResponse {
6262
return r
6363
}
6464

65-
// ProjectCommitmentChangeset appears in type CommitmentChangeRequest.
65+
// ProjectCommitmentChangeset appears in type [CommitmentChangeRequest].
6666
// It contains all commitments that are part of a single atomic changeset that belong to a specific project in a specific AZ.
6767
type ProjectCommitmentChangeset struct {
6868
// Metadata about the project from Keystone.
@@ -83,7 +83,7 @@ func (c ProjectCommitmentChangeset) Clone() ProjectCommitmentChangeset {
8383
return cloned
8484
}
8585

86-
// ResourceCommitmentChangeset appears in type CommitmentChangeRequest.
86+
// ResourceCommitmentChangeset appears in type [CommitmentChangeRequest].
8787
// It contains all commitments that are part of a single atomic changeset that belong to a given resource within a specific project and AZ.
8888
type ResourceCommitmentChangeset struct {
8989
// The sum of all commitments in CommitmentStatusConfirmed for the given resource, project and AZ before and after applying the proposed commitment changeset.
@@ -111,10 +111,10 @@ func (c ResourceCommitmentChangeset) Clone() ResourceCommitmentChangeset {
111111
return cloned
112112
}
113113

114-
// Commitment appears in type CommitmentChangeRequest.
114+
// Commitment appears in type [CommitmentChangeRequest].
115115
//
116116
// The commitment is located in a certain project and applies to a certain resource within a certain AZ.
117-
// These metadata are implied by where the commitment is found within type CommitmentChangeRequest.
117+
// These metadata are implied by where the commitment is found within type [CommitmentChangeRequest].
118118
type Commitment struct {
119119
// The same UUID may appear multiple times within the same changeset for one specific circumstance:
120120
// If a commitment moves between projects, it will appear as being deleted in the source project and again as being created in the target project.
@@ -151,7 +151,7 @@ func (c Commitment) Clone() Commitment {
151151
return c
152152
}
153153

154-
// CommitmentStatus is an enum containing the various lifecycle states of type Commitment.
154+
// CommitmentStatus is an enum containing the various lifecycle states of type [Commitment].
155155
// The following state transitions are allowed:
156156
//
157157
// start = "planned" -> "pending" -> "confirmed" // normal commitment that takes effect after the ConfirmBy date
@@ -196,7 +196,7 @@ func (s CommitmentStatus) IsValid() bool {
196196
}
197197

198198
// RequiresConfirmation describes if this request requires confirmation from the liquid.
199-
// The RejectionReason in type CommitmentChangeResponse may only be used if this returns true.
199+
// The RejectionReason in type [CommitmentChangeResponse] may only be used if this returns true.
200200
//
201201
// Examples for RequiresConfirmation = true include commitments moving into or spawning in the "guaranteed" or "confirmed" statuses, or conversion of commitments between resources.
202202
// Examples for RequiresConfirmation = false include commitments being split, moving into the "expired" status or being hard deleted.

liquid/doc.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,34 +108,34 @@
108108
// # Endpoint: GET /v1/info
109109
//
110110
// Returns information about the OpenStack service and the resources available within it.
111-
// - On success, the response body payload must be of type ServiceInfo.
111+
// - On success, the response body payload must be of type [ServiceInfo].
112112
//
113113
// # Endpoint: POST /v1/report-capacity
114114
//
115115
// Reports available capacity across all resources of this service.
116-
// - The request body payload must be of type ServiceCapacityRequest.
117-
// - On success, the response body payload must be of type ServiceCapacityReport.
116+
// - The request body payload must be of type [ServiceCapacityRequest].
117+
// - On success, the response body payload must be of type [ServiceCapacityReport].
118118
//
119119
// # Endpoint: POST /v1/projects/:uuid/report-usage
120120
//
121121
// Reports usage data (as well as applicable quotas) within a project across all resources of this service.
122122
// - The ":uuid" parameter in the request path must refer to a project ID known to Keystone.
123-
// - The request body payload must be of type ServiceUsageRequest.
124-
// - On success, the response body payload must be of type ServiceUsageReport.
123+
// - The request body payload must be of type [ServiceUsageRequest].
124+
// - On success, the response body payload must be of type [ServiceUsageReport].
125125
//
126126
// # Endpoint: PUT /v1/projects/:uuid/quota
127127
//
128128
// Updates quota within a project across all resources of this service.
129129
// - The ":uuid" parameter in the request path must refer to a project ID known to Keystone.
130-
// - The request body payload must be of type ServiceQuotaRequest.
130+
// - The request body payload must be of type [ServiceQuotaRequest].
131131
// - On success, the response body shall be empty and status 204 (No Content) shall be returned.
132132
//
133133
// # Endpoint: POST /v1/change-commitments
134134
//
135135
// Notifies the liquid about changes to commitments that it is interested in.
136136
// Commitments for different projects and different resources may be batched together if they are all part of the same atomic change.
137-
// - The request body payload must be of type CommitmentChangeRequest.
138-
// - On success, the response body payload must be of type CommitmentChangeResponse.
137+
// - The request body payload must be of type [CommitmentChangeRequest].
138+
// - On success, the response body payload must be of type [CommitmentChangeResponse].
139139
//
140140
// [Limes]: https://github.com/sapcc/limes
141141
// [OpenMetrics format]: https://github.com/OpenObservability/OpenMetrics/blob/master/specification/OpenMetrics.md

liquid/info.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (i ServiceInfo) Clone() ServiceInfo {
6868
}
6969

7070
// CategoryName is a name of a category that can group resources and rates.
71-
// It appears in type ServiceInfo, ResourceInfo and RateInfo.
71+
// It appears in type [ServiceInfo], [ResourceInfo] and [RateInfo].
7272
type CategoryName string
7373

7474
// IsValid returns whether a CategoryName is valid.
@@ -78,7 +78,7 @@ func (c CategoryName) IsValid() bool {
7878
}
7979

8080
// CategoryInfo describes a category that can group resources and rates of a liquid's service.
81-
// This type appears in type ServiceInfo.
81+
// This type appears in type [ServiceInfo].
8282
type CategoryInfo struct {
8383
DisplayName string `json:"displayName"`
8484
}
@@ -91,7 +91,7 @@ func (c CategoryInfo) Clone() CategoryInfo {
9191
}
9292

9393
// ResourceInfo describes a resource that a liquid's service provides.
94-
// This type appears in type ServiceInfo.
94+
// This type appears in type [ServiceInfo].
9595
type ResourceInfo struct {
9696
// The display name can be used in user-facing messages or interfaces to refer to the resource.
9797
DisplayName string `json:"displayName"`
@@ -141,7 +141,7 @@ func (i ResourceInfo) Clone() ResourceInfo {
141141
}
142142

143143
// Topology describes how capacity and usage reported by a certain resource is structured.
144-
// It appears in type ResourceInfo.
144+
// It appears in type [ResourceInfo].
145145
type Topology string
146146

147147
const (
@@ -218,7 +218,7 @@ func (t Topology) IsValid() bool {
218218
}
219219

220220
// RateInfo describes a rate that a liquid's service provides.
221-
// This type appears in type ServiceInfo.
221+
// This type appears in type [ServiceInfo].
222222
type RateInfo struct {
223223
// The display name can be used in user-facing messages or interfaces to refer to the rate.
224224
DisplayName string `json:"displayName"`
@@ -251,7 +251,7 @@ func (i RateInfo) Clone() RateInfo {
251251

252252
// ProjectMetadata includes metadata about a project from Keystone.
253253
//
254-
// It appears in types ServiceUsageRequest and ServiceQuotaRequest if requested by the ServiceInfo.
254+
// It appears in types [ServiceUsageRequest] and [ServiceQuotaRequest] if requested by the [ServiceInfo].
255255
type ProjectMetadata struct {
256256
UUID string `json:"uuid"`
257257
Name string `json:"name"`
@@ -260,7 +260,7 @@ type ProjectMetadata struct {
260260

261261
// DomainMetadata includes metadata about a domain from Keystone.
262262
//
263-
// It appears in type ProjectMetadata.
263+
// It appears in type [ProjectMetadata].
264264
type DomainMetadata struct {
265265
UUID string `json:"uuid"`
266266
Name string `json:"name"`

liquid/metrics.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const (
2525
)
2626

2727
// MetricFamilyInfo describes a metric family.
28-
// This type appears in type ServiceInfo.
28+
// This type appears in type [ServiceInfo].
2929
// For more information, please refer to the "Metrics" section of the package documentation.
3030
type MetricFamilyInfo struct {
3131
// The metric type.
@@ -48,15 +48,15 @@ func (i MetricFamilyInfo) Clone() MetricFamilyInfo {
4848
}
4949

5050
// Metric is a metric.
51-
// This type appears in type ServiceCapacityReport.
51+
// This type appears in type [ServiceCapacityReport].
5252
// For more information, please refer to the "Metrics" section of the package documentation.
5353
//
5454
// Because reports can include very large numbers of Metric instances, this type uses a compact serialization to improve efficiency.
5555
type Metric struct {
5656
Value float64 `json:"v"`
5757

5858
// This label set does not include keys to avoid redundant encoding.
59-
// The slice must be of the same length as the LabelKeys slice in the respective MetricFamilyInfo instance in type ServiceInfo.
59+
// The slice must be of the same length as the LabelKeys slice in the respective [MetricFamilyInfo] instance in type [ServiceInfo].
6060
// Each label value is implied to belong to the label key with the same slice index.
6161
// For example, LabelKeys = ["name","location"] and LabelValues = ["author","work"] represents the label set {name="author",location="work"}.
6262
LabelValues []string `json:"l"`

liquid/overcommit_factor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package liquid
55

66
// OvercommitFactor is the ratio between raw and effective capacity of a resource.
7-
// It appears in type ResourceDemand.
7+
// It appears in type [ResourceDemand].
88
//
99
// In its methods, the zero value behaves as 1, meaning that no overcommit is taking place.
1010
type OvercommitFactor float64

liquid/quota.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (i ServiceQuotaRequest) Clone() ServiceQuotaRequest {
2626
}
2727

2828
// ResourceQuotaRequest contains new quotas for a single resource.
29-
// It appears in type ServiceQuotaRequest.
29+
// It appears in type [ServiceQuotaRequest].
3030
type ResourceQuotaRequest struct {
3131
// For FlatTopology and AZAwareTopology, this is the only field that is filled, and PerAZ will be nil.
3232
// For AZSeparatedTopology, this contains the sum of the quotas across all AZs (for compatibility purposes).
@@ -44,7 +44,7 @@ func (i ResourceQuotaRequest) Clone() ResourceQuotaRequest {
4444
}
4545

4646
// AZResourceQuotaRequest contains the new quota value for a single resource and AZ.
47-
// It appears in type ResourceQuotaRequest.
47+
// It appears in type [ResourceQuotaRequest].
4848
type AZResourceQuotaRequest struct {
4949
Quota uint64 `json:"quota"`
5050

liquid/report_capacity.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type ServiceCapacityRequest struct {
2020
// Limes provides this list here to reduce the number of places where this information needs to be maintained manually.
2121
AllAZs []AvailabilityZone `json:"allAZs"`
2222

23-
// Must contain an entry for each resource that was declared in type ServiceInfo with "NeedsResourceDemand = true".
23+
// Must contain an entry for each resource that was declared in type [ServiceInfo] with "NeedsResourceDemand = true".
2424
DemandByResource map[ResourceName]ResourceDemand `json:"demandByResource"`
2525
}
2626

@@ -33,7 +33,7 @@ func (r ServiceCapacityRequest) Clone() ServiceCapacityRequest {
3333
}
3434

3535
// ResourceDemand contains demand statistics for a resource.
36-
// It appears in type ServiceCapacityRequest.
36+
// It appears in type [ServiceCapacityRequest].
3737
//
3838
// This is used when a liquid needs to be able to reshuffle capacity between different resources based on actual user demand.
3939
type ResourceDemand struct {
@@ -54,7 +54,7 @@ func (d ResourceDemand) Clone() ResourceDemand {
5454
}
5555

5656
// ResourceDemandInAZ contains demand statistics for a resource in a single AZ.
57-
// It appears in type ResourceDemand.
57+
// It appears in type [ResourceDemand].
5858
//
5959
// The fields are ordered in descending priority.
6060
// All values are in terms of effective capacity, and are sums over all OpenStack projects.
@@ -82,10 +82,10 @@ type ServiceCapacityReport struct {
8282
// This is used to signal to Limes to refetch GET /v1/info after configuration changes.
8383
InfoVersion int64 `json:"infoVersion"`
8484

85-
// Must contain an entry for each resource that was declared in type ServiceInfo with "HasCapacity = true".
85+
// Must contain an entry for each resource that was declared in type [ServiceInfo] with "HasCapacity = true".
8686
Resources map[ResourceName]*ResourceCapacityReport `json:"resources,omitempty"`
8787

88-
// Must contain an entry for each metric family that was declared for capacity metrics in type ServiceInfo.
88+
// Must contain an entry for each metric family that was declared for capacity metrics in type [ServiceInfo].
8989
Metrics map[MetricName][]Metric `json:"metrics,omitempty"`
9090
}
9191

@@ -98,7 +98,7 @@ func (r ServiceCapacityReport) Clone() ServiceCapacityReport {
9898
}
9999

100100
// ResourceCapacityReport contains capacity data for a resource.
101-
// It appears in type ServiceCapacityReport.
101+
// It appears in type [ServiceCapacityReport].
102102
type ResourceCapacityReport struct {
103103
// The keys that are allowed in this map depend on the chosen Topology.
104104
// See documentation on Topology enum variants for details.
@@ -113,7 +113,7 @@ func (r ResourceCapacityReport) Clone() ResourceCapacityReport {
113113
}
114114

115115
// AZResourceCapacityReport contains capacity data for a resource in a single AZ.
116-
// It appears in type ResourceCapacityReport.
116+
// It appears in type [ResourceCapacityReport].
117117
type AZResourceCapacityReport struct {
118118
// How much capacity is available to Limes in this resource and AZ.
119119
//

liquid/report_usage.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type ServiceUsageRequest struct {
2727
ProjectMetadata Option[ProjectMetadata] `json:"projectMetadata,omitzero"`
2828

2929
// The serialized state from the previous ServiceUsageReport received by Limes for this project, if any.
30-
// Refer to the same field on type ServiceUsageReport for details.
30+
// Refer to the same field on type [ServiceUsageReport] for details.
3131
SerializedState json.RawMessage `json:"serializedState,omitempty"`
3232
}
3333

@@ -45,13 +45,13 @@ type ServiceUsageReport struct {
4545
// This is used to signal to Limes to refetch GET /v1/info after configuration changes.
4646
InfoVersion int64 `json:"infoVersion"`
4747

48-
// Must contain an entry for each resource that was declared in type ServiceInfo.
48+
// Must contain an entry for each resource that was declared in type [ServiceInfo].
4949
Resources map[ResourceName]*ResourceUsageReport `json:"resources,omitempty"`
5050

51-
// Must contain an entry for each rate that was declared in type ServiceInfo.
51+
// Must contain an entry for each rate that was declared in type [ServiceInfo].
5252
Rates map[RateName]*RateUsageReport `json:"rates,omitempty"`
5353

54-
// Must contain an entry for each metric family that was declared for usage metrics in type ServiceInfo.
54+
// Must contain an entry for each metric family that was declared for usage metrics in type [ServiceInfo].
5555
Metrics map[MetricName][]Metric `json:"metrics,omitempty"`
5656

5757
// Opaque state for Limes to persist and return to the liquid in the next ServiceUsageRequest for the same project.
@@ -76,7 +76,7 @@ func (r ServiceUsageReport) Clone() ServiceUsageReport {
7676
}
7777

7878
// ResourceUsageReport contains usage data for a resource in a single project.
79-
// It appears in type ServiceUsageReport.
79+
// It appears in type [ServiceUsageReport].
8080
type ResourceUsageReport struct {
8181
// If true, this project is forbidden from accessing this resource.
8282
// This has two consequences:
@@ -103,7 +103,7 @@ func (r ResourceUsageReport) Clone() ResourceUsageReport {
103103
}
104104

105105
// AZResourceUsageReport contains usage data for a resource in a single project and AZ.
106-
// It appears in type ResourceUsageReport.
106+
// It appears in type [ResourceUsageReport].
107107
type AZResourceUsageReport struct {
108108
// The amount of usage for this resource.
109109
Usage uint64 `json:"usage"`
@@ -169,7 +169,7 @@ func (r *ResourceUsageReport) AddLocalizedUsage(az AvailabilityZone, usage uint6
169169
}
170170

171171
// RateUsageReport contains usage data for a rate in a single project.
172-
// It appears in type ServiceUsageReport.
172+
// It appears in type [ServiceUsageReport].
173173
type RateUsageReport struct {
174174
// The keys that are allowed in this map depend on the chosen Topology.
175175
// See documentation on Topology enum variants for details.
@@ -184,14 +184,14 @@ func (r RateUsageReport) Clone() RateUsageReport {
184184
}
185185

186186
// AZRateUsageReport contains usage data for a rate in a single project and AZ.
187-
// It appears in type RateUsageReport.
187+
// It appears in type [RateUsageReport].
188188
type AZRateUsageReport struct {
189189
// The amount of usage for this rate. Must be Some() and non-nil if the rate is declared with HasUsage = true.
190190
// The value Some(nil) is forbidden.
191191
//
192192
// For a given rate, project and AZ, this value must only ever increase monotonically over time.
193193
// If there is the possibility of counter resets or limited retention in the underlying data source, the liquid must add its own logic to guarantee monotonicity.
194-
// A common strategy is to remember previous measurements in the SerializedState field of type ServiceUsageReport.
194+
// A common strategy is to remember previous measurements in the SerializedState field of type [ServiceUsageReport].
195195
//
196196
// This field is modeled as a bigint because network rates like "bytes transferred" may easily exceed the range of uint64 over time.
197197
Usage Option[*big.Int] `json:"usage,omitzero"`

liquid/subdivisions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// Subcapacity describes a distinct chunk of capacity for a resource within an AZ.
14-
// It appears in type AZResourceCapacityReport.
14+
// It appears in type [AZResourceCapacityReport].
1515
//
1616
// A service will only report subcapacities for such resources where there is a useful substructure to report.
1717
// For example:
@@ -49,7 +49,7 @@ func (s Subcapacity) Clone() Subcapacity {
4949
return cloned
5050
}
5151

52-
// SubcapacityBuilder is a helper type for building Subcapacity values.
52+
// SubcapacityBuilder is a helper type for building [Subcapacity] values.
5353
// If the Attributes in a subcapacity are collected over time, it might be more convenient to have them accessible as a structured type.
5454
// Once assembly is complete, the provided methods can be used to obtain the final Subcapacity value.
5555
type SubcapacityBuilder[A any] struct {
@@ -74,7 +74,7 @@ func (b SubcapacityBuilder[A]) Finalize() (Subcapacity, error) {
7474
}
7575

7676
// Subresource describes a distinct chunk of usage for a resource within a project and AZ.
77-
// It appears in type AZResourceUsageReport.
77+
// It appears in type [AZResourceUsageReport].
7878
//
7979
// A service will only report subresources for such resources where there is a useful substructure to report.
8080
// For example, in the Nova resource "instances", each instance is a subresource.
@@ -105,7 +105,7 @@ func (s Subresource) Clone() Subresource {
105105
return cloned
106106
}
107107

108-
// SubresourceBuilder is a helper type for building Subresource values.
108+
// SubresourceBuilder is a helper type for building [Subresource] values.
109109
// If the Attributes in a subresource are collected over time, it might be more convenient to have them accessible as a structured type.
110110
// Once assembly is complete, the provided methods can be used to obtain the final Subresource value.
111111
type SubresourceBuilder[A any] struct {

0 commit comments

Comments
 (0)