A trunk build reserving while its series is reserved by an older build never released drops the older reservation's bound and finding and says so in the journal. builder_reserve_done (a hand act, reasks mode reserve-done) reserves the series' next version for a done trunk build that reserved none, with the done key's digests, and queues its publish as builder_publish_again does. Builds: design 47 G A-455, §369, §588
55 lines
2.5 KiB
Go
55 lines
2.5 KiB
Go
package versions
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
// The tools' descriptions.
|
|
const (
|
|
FloorAgainDescription = "Ask the floor of one name again now, by hand (design 51 *The floor*): the seat's versions, the seat git's " +
|
|
"git.tags and the indexer's indexer_requirements, as the builder asks them by itself when a silent source says something. " +
|
|
"Answers which sources were silent and whether the floor is now known. A name the builder's versions already hold needs no floor: " +
|
|
"refused, saying so. A hand act."
|
|
)
|
|
|
|
// Acts are the builder's hand acts on its versions, answered by its program (the tools bundle writes them to reasks).
|
|
type Acts struct {
|
|
Numberer *Numberer
|
|
// Reconsider looks at every module again, so a claim asks a name's floor.
|
|
Reconsider func(ctx context.Context)
|
|
// Republish queues the reserved versions builder_publish_again names (design 47 G §588): the versions it queued.
|
|
Republish func(ctx context.Context, module, version string) ([]string, error)
|
|
// DropOldForm drops a retired node from the old form's count by hand (builder_old_form): its answer, or why not.
|
|
DropOldForm func(ctx context.Context, node, by, why string, at time.Time) (string, error)
|
|
// ReserveDone reserves the next version for a done trunk build that reserved none and queues its publish (builder_reserve_done):
|
|
// its answer, or why not.
|
|
ReserveDone func(ctx context.Context, module, fp, by, why string, at time.Time) (string, error)
|
|
// DropReserved drops a module's reservation of one MAJOR.MINOR by hand (builder_reserved_drop): its answer, or why not.
|
|
DropReserved func(ctx context.Context, module, series, by, why string, at time.Time) (string, error)
|
|
}
|
|
|
|
// FloorAgain is builder_floor_again of name: the floor counts only for a name the versions hold nothing of.
|
|
func (a Acts) FloorAgain(ctx context.Context, name string) (string, error) {
|
|
entries, err := a.Numberer.Versions.Of(ctx, name)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if len(entries) > 0 {
|
|
return "", fmt.Errorf("%s holds %d versions: its floor counts only for its first number, so nothing is asked", name, len(entries))
|
|
}
|
|
answer := name + " waits on no floor in this builder: the floor is asked at its next claim"
|
|
if a.Numberer.Waits != nil {
|
|
for _, w := range a.Numberer.Waits.Waiting() {
|
|
if w.Name == name {
|
|
answer = fmt.Sprintf("the floor of %s is asked again (%s were silent)", name, strings.Join(w.Silent, ", "))
|
|
}
|
|
}
|
|
a.Numberer.Waits.Wake(WakeByHand, "", "", name)
|
|
}
|
|
a.Reconsider(ctx)
|
|
return answer + "; builder_versions shows its version once numbered", nil
|
|
}
|