Skip to content

Commit 74e3ac8

Browse files
authored
Merge pull request #790 from sapcc/missing_docs_findings
fix missing documentation lints
2 parents 6e66ffa + 4d4482d commit 74e3ac8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+460
-422
lines changed

internal/api/api_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,14 @@ func Test_ScrapeErrorOperations(t *testing.T) {
309309
ExpectBody: assert.JSONObject{"scrape_errors": []assert.JSONObject{}},
310310
}.Check(t, s.Handler)
311311

312-
// Add a scrape error to one specific service with type 'unshared'.
312+
// add a scrape error to one specific service with type 'unshared'.
313313
s.MustDBExec(
314314
`UPDATE project_services SET scrape_error_message = $1 WHERE project_id = 1 AND service_id = $2`,
315315
"could not scrape this specific unshared service",
316316
s.GetServiceID("unshared"),
317317
)
318318

319-
// Add the same scrape error to all services with type 'shared'. This will ensure that
319+
// add the same scrape error to all services with type 'shared'. This will ensure that
320320
// they get grouped under a dummy project.
321321
s.MustDBExec(
322322
`UPDATE project_services SET scrape_error_message = $1 WHERE service_id = $2`,

internal/api/commitment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ func (p *v1Provider) TransferCommitment(w http.ResponseWriter, r *http.Request)
17331733
respondwith.JSON(w, http.StatusAccepted, map[string]any{"commitment": c})
17341734
}
17351735

1736-
// GetCommitmentConversion handles GET /v1/commitment-conversion/{service_type}/{resource_name}
1736+
// GetCommitmentConversions handles GET /v1/commitment-conversion/{service_type}/{resource_name}
17371737
func (p *v1Provider) GetCommitmentConversions(w http.ResponseWriter, r *http.Request) {
17381738
httpapi.IdentifyEndpoint(r, "/v1/commitment-conversion/:service_type/:resource_name")
17391739
token := p.CheckToken(r)
@@ -2113,7 +2113,7 @@ func (p *v1Provider) ConvertCommitment(w http.ResponseWriter, r *http.Request) {
21132113
respondwith.JSON(w, http.StatusAccepted, map[string]any{"commitment": c})
21142114
}
21152115

2116-
// ExtendCommitmentDuration handles POST /v1/domains/{domain_id}/projects/{project_id}/commitments/{commitment_id}/update-duration
2116+
// UpdateCommitmentDuration handles POST /v1/domains/{domain_id}/projects/{project_id}/commitments/{commitment_id}/update-duration
21172117
func (p *v1Provider) UpdateCommitmentDuration(w http.ResponseWriter, r *http.Request) {
21182118
httpapi.IdentifyEndpoint(r, "/v1/domains/:domain_id/projects/:project_id/commitments/:commitment_id/update-duration")
21192119
token := p.CheckToken(r)

internal/api/core.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ func NewTokenValidator(provider *gophercloud.ProviderClient, eo gophercloud.Endp
101101
return &tv, err
102102
}
103103

104-
func (p *v1Provider) OverrideGenerateTransferToken(generateTransferToken func() string) *v1Provider {
105-
p.generateTransferToken = generateTransferToken
106-
return p
107-
}
108-
109104
// AddTo implements the httpapi.API interface.
110105
func (p *v1Provider) AddTo(r *mux.Router) {
111106
r.Methods("HEAD", "GET").Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

internal/api/liquid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (p *v1Provider) GetServiceCapacityRequest(w http.ResponseWriter, r *http.Re
5252
respondwith.JSON(w, http.StatusOK, serviceCapacityRequest)
5353
}
5454

55-
// p.GetServiceUsageRequest handles GET /admin/liquid/service-usage-request?service_type=:type&project_id=:id.
55+
// GetServiceUsageRequest handles GET /admin/liquid/service-usage-request?service_type=:type&project_id=:id.
5656
func (p *v1Provider) GetServiceUsageRequest(w http.ResponseWriter, r *http.Request) {
5757
httpapi.IdentifyEndpoint(r, "/admin/liquid/service-usage-request")
5858
token := p.CheckToken(r)

internal/api/stream.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type JSONListStream[T any] struct {
3737
w *bufio.Writer
3838
}
3939

40+
// NewJSONListStream creates a new JSONListStream instance.
4041
func NewJSONListStream[T any](w http.ResponseWriter, r *http.Request, outerFieldName string) *JSONListStream[T] {
4142
return &JSONListStream[T]{
4243
OuterFieldName: outerFieldName,

internal/api/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func fromUnixEncodedTime(t limes.UnixEncodedTime) time.Time {
2222
return t.Time
2323
}
2424

25-
// Generates a token that is used to transfer a commitment from a source to a target project.
25+
// GenerateTransferToken generates a token that is used to transfer a commitment from a source to a target project.
2626
// The token will be attached to the commitment that will be transferred and stored in the database until the transfer is concluded.
2727
func GenerateTransferToken() string {
2828
tokenBytes := make([]byte, 24)

internal/collector/consistency.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import (
2020
"github.com/sapcc/limes/internal/db"
2121
)
2222

23+
// CheckConsistencyJob returns a jobloop.Job that periodically ensures that all
24+
// services which exist in the configuration exist in the database and that
25+
// project_services are fully populated in the database.
2326
func (c *Collector) CheckConsistencyJob(registerer prometheus.Registerer) jobloop.Job {
2427
return (&jobloop.CronJob{
2528
Metadata: jobloop.JobMetadata{

internal/collector/mail_delivery.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/sapcc/limes/internal/db"
1818
)
1919

20+
// MailRequest is an interface for posting to the mail API.
2021
type MailRequest struct {
2122
ProjectID string `json:"project_id"`
2223
Subject string `json:"subject"`

internal/collector/metrics.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ type DataMetricsReporter struct {
340340
ReportZeroes bool
341341
}
342342

343-
// This is the same Content-Type that promhttp's GET /metrics implementation reports.
343+
// ContentTypeForPrometheusMetrics is the same Content-Type that promhttp's GET /metrics implementation reports.
344344
// If this changes because of a prometheus/client-go upgrade, we will know because our
345345
// test verifies that promhttp yields this Content-Type. In the case of a change,
346346
// the output format of promhttp should be carefully reviewed for changes, and then
@@ -841,6 +841,7 @@ func newResourceAndRateBehaviorCache(cluster *core.Cluster) resourceAndRateBehav
841841
return resourceAndRateBehaviorCache{cluster, cache, rateCache, cbCache}
842842
}
843843

844+
// Get returns the cached ResourceBehavior for the given service type and resource name.
844845
func (c resourceAndRateBehaviorCache) Get(srvType db.ServiceType, resName liquid.ResourceName) core.ResourceBehavior {
845846
if c.cache[srvType] == nil {
846847
c.cache[srvType] = make(map[liquid.ResourceName]core.ResourceBehavior)
@@ -853,6 +854,7 @@ func (c resourceAndRateBehaviorCache) Get(srvType db.ServiceType, resName liquid
853854
return behavior
854855
}
855856

857+
// GetForRate returns the cached RateBehavior for the given service type and rate name.
856858
func (c resourceAndRateBehaviorCache) GetForRate(srvType db.ServiceType, rateName liquid.RateName) core.RateBehavior {
857859
if c.rateCache[srvType] == nil {
858860
c.rateCache[srvType] = make(map[liquid.RateName]core.RateBehavior)
@@ -865,6 +867,7 @@ func (c resourceAndRateBehaviorCache) GetForRate(srvType db.ServiceType, rateNam
865867
return behavior
866868
}
867869

870+
// GetCommitmentBehavior returns the cached ScopedCommitmentBehavior for the given service type and resource name.
868871
func (c resourceAndRateBehaviorCache) GetCommitmentBehavior(srvType db.ServiceType, resName liquid.ResourceName) core.ScopedCommitmentBehavior {
869872
if c.cbCache[srvType] == nil {
870873
c.cbCache[srvType] = make(map[liquid.ResourceName]core.ScopedCommitmentBehavior)

internal/datamodel/allocation_stats.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ func (c clusterAZAllocationStats) allowsQuotaOvercommit(cfg core.AutogrowQuotaDi
5656
}
5757
}
5858

59+
// CanAcceptCommitmentChanges determines whether the given commitment additions
60+
// and subtractions can be accepted in this resources AZ capacity, which already
61+
// considers the overcommit factor for the resource.
5962
func (c clusterAZAllocationStats) CanAcceptCommitmentChanges(additions, subtractions map[db.ProjectID]uint64, behavior core.CommitmentBehavior) bool {
6063
// calculate `sum_over_projects(max(committed, usage))` before and after the requested changes
6164
var (

0 commit comments

Comments
 (0)