Documentation
¶
Overview ¶
Package place puts each gathered PR and change on the capabilities that own most of its files. Placement is a fact of the footprints the walk stored and never a judgment: code weighs the files, with no agent call and no session, and the placements stay in init's record, never the map.
Index ¶
Constants ¶
const ( NoFiles = "no files known from the gather" NoOwner = "none of its files belongs to a capability" )
The reasons a PR or change is placed nowhere.
const Broad = 40
Broad is the most files a footprint's test, doc or other entry may name and still place: an entry naming more, such as a whole test folder, says nothing about one capability.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BroadEntry ¶
type BroadEntry struct {
Capability string `json:"capability"`
Kind string `json:"kind"`
Entry string `json:"entry"`
Files int `json:"files"`
}
BroadEntry is a footprint entry naming more than Broad files: kept in the footprint, not used to place.
type CapabilityPlaced ¶
type CapabilityPlaced struct {
Capability string `json:"capability"`
Area string `json:"area"`
Parent string `json:"parent"`
PRs []int `json:"prs"`
Changes []string `json:"changes"`
}
CapabilityPlaced is a capability, with its area and, when that area is a part, the area it was split from, and what is placed on it.
type ChangeNowhere ¶
type ChangeNowhere struct {
ID string `json:"id"`
PR int `json:"pr,omitempty"`
Reason string `json:"reason"`
}
ChangeNowhere is a gathered change placed nowhere. PR is the gathered PR whose reason it carries, 0 when the reason is its own.
type ChangePlaced ¶
type ChangePlaced struct {
ID string `json:"id"`
PR int `json:"pr,omitempty"`
Placements []Placement `json:"placements"`
}
ChangePlaced is a gathered change with the capabilities it is placed on. PR is the gathered PR it follows, 0 when it is placed on its own.
type Nowhere ¶
type Nowhere struct {
PRs []PRNowhere `json:"prs"`
Changes []ChangeNowhere `json:"changes"`
}
Nowhere is the PRs and changes placed on no capability, with the reason.
type Placement ¶
Placement is one capability an item is placed on: the weight of the item's files there, and that weight's share of the item's whole weight.
type ReasonCount ¶
ReasonCount is how many items are placed nowhere for one reason.
type Record ¶
type Record struct {
// PRs and Changes are the placed ones, in gather order.
PRs []PRPlaced `json:"prs"`
Changes []ChangePlaced `json:"changes"`
Nowhere Nowhere `json:"nowhere"`
// ByCapability is every capability of the walk, in walk order, with the
// PRs placed on it and the changes placed there on their own.
ByCapability []CapabilityPlaced `json:"by_capability"`
Broad []BroadEntry `json:"broad_entries"`
// WalkEntries is false when the walk was stored without its footprints'
// entries, so each stored file placed as itself and none could be broad.
WalkEntries bool `json:"walk_entries"`
FilesWeighed int `json:"files_weighed"`
}
Record is the body init's record keeps for the placement, read back with Load. Its file paths are init's own and never reach the map.
type Result ¶
type Result struct {
Capabilities int `json:"capabilities"`
PRsPlaced int `json:"prs_placed"`
// PRsNowhere and ChangesNowhere count each reason, both always listed.
PRsNowhere []ReasonCount `json:"prs_nowhere"`
// ChangesPlaced are the changes no gathered PR holds, placed on their
// own; ChangesWithPR are those placed where their PR is.
ChangesPlaced int `json:"changes_placed"`
ChangesWithPR int `json:"changes_placed_with_pr"`
ChangesNowhere []ReasonCount `json:"changes_nowhere"`
// Without are the capabilities no PR or change is placed on.
Without Without `json:"capabilities_without"`
Broad []BroadEntry `json:"broad_entries"`
WalkEntries bool `json:"walk_entries"`
FilesWeighed int `json:"files_weighed"`
}
Result is what placement did, in counts.
type Store ¶
type Store interface {
Gathered(ctx context.Context) (store.Gather, bool, error)
Areas(ctx context.Context) (initrecord.Areas, bool, error)
Walk(ctx context.Context) (initrecord.Walk, bool, error)
PutPlace(context.Context, initrecord.Place) error
}
Store is init's record as Run reads and writes it.