Repository navigation
gateway: switch and stop an engine through the keyed API - #141
Merged
Merged
Conversation
POST /v1/berth/switch starts an engine under a lease without a prompt, and POST /v1/berth/stop asks berthd to give its card back, the same drain as berth stop. A stop from the network never touches a pinned lease. The /gui/ board's Launch now calls the same switch, so the board, scripts and the harbor's coming switchboard all switch the card one way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 2 of the switchboard plan: the actions a phone board will call, on the gateway's keyed API.
Change
POST /v1/berth/switch {"engine":"NAME"}starts the engine under a lease, the way a request for one of its models does. It answers202once the start is under way. Engines without astartcommand get a404.POST /v1/berth/stop {"engine":"NAME"}sends berthd'sOpStop, the same request-boundary drain asberth stop, and answers202with the lease IDs.berth hold) gets a409; Berth never stops one from the network.berth stopin a terminal is unchanged.409, and berthd not answering gets a503./gui/board's Launch now calls the sameswitchTo, so there is one start path. Its body moved out ofguiWakeunchanged.docs/gateway.mdgets a section, plus a CHANGELOG entry.Proof
TestSwitchThenStop: a switch puts the engine on the card as an active lease, and a stop frees it.TestSwitchStopRefusals: unknown engine, engine with nostart, bad JSON, a stop on a pinned lease (the lease stays active), and a stop on an engine that isn't running.switch = 404) and pass here.-race -count=5passes with the existing GUI tests.go test ./..., Windows build and vet, golangci-lint (0 issues).Not run against the live gateway: it currently holds strata-sc117 on the card, and a second gateway would drain it.