Documentation
¶
Overview ¶
Package instance assembles and runs one emulator instance: state store, gateway, admin API and the selected services.
Index ¶
- Constants
- Variables
- type ContainerInfo
- type Factory
- type Instance
- func (in *Instance) AdvanceClock(ctx context.Context, d time.Duration) error
- func (in *Instance) ApplySeed(ctx context.Context, path string) error
- func (in *Instance) Containers(ctx context.Context) ([]ContainerInfo, error)
- func (in *Instance) Done() <-chan struct{}
- func (in *Instance) EnvVars() map[string]string
- func (in *Instance) Faults() *fault.Set
- func (in *Instance) FrontendHosts() []string
- func (in *Instance) HoldReady(name, reason string) (release func())
- func (in *Instance) HostMode() hostmode.Status
- func (in *Instance) Readiness() map[string]error
- func (in *Instance) Ready() bool
- func (in *Instance) RequestShutdown()
- func (in *Instance) Reset(ctx context.Context) error
- func (in *Instance) Services() []emu.Service
- func (in *Instance) Shutdown(ctx context.Context) error
- func (in *Instance) Start(ctx context.Context) error
- func (in *Instance) WaitReady(ctx context.Context) error
- func (in *Instance) WriteCABundle() (string, error)
Constants ¶
const ( EndpointsFile = "endpoints.json" PIDFile = "gcpemu.pid" LogFile = "gcpemu.log" StateFile = "state.db" IDFile = "instance-id" )
Files written in the instance directory.
Variables ¶
var Version = "dev"
Version is set at build time.
Functions ¶
This section is empty.
Types ¶
type ContainerInfo ¶
type ContainerInfo struct {
Name string `json:"name"`
Service string `json:"service,omitempty"`
Resource string `json:"resource,omitempty"`
Role string `json:"role,omitempty"`
Image string `json:"image"`
State string `json:"state"`
}
ContainerInfo describes one container the instance owns (admin API, `gcpemu status`).
type Instance ¶
type Instance struct {
Config *config.Config
Env *emu.Env
Log *reqlog.Log
ID string
Dir string
// contains filtered or unexported fields
}
Instance is a running emulator.
func (*Instance) AdvanceClock ¶
AdvanceClock moves the emulator clock forward (FR-GCS-008).
func (*Instance) ApplySeed ¶
ApplySeed applies a seed file (FR-CORE-011). Top-level keys are service names; each section is handed to that service's Seeder.
func (*Instance) Containers ¶
func (in *Instance) Containers(ctx context.Context) ([]ContainerInfo, error)
Containers lists the instance's containers (see containers.list).
func (*Instance) Done ¶
func (in *Instance) Done() <-chan struct{}
Done is closed when Shutdown completes.
func (*Instance) FrontendHosts ¶
FrontendHosts returns the real hostnames the Google frontend serves.
func (*Instance) HoldReady ¶
HoldReady keeps the instance not ready, with name and reason reported by Readiness, until release is called. The CLI holds it while the startup seed is applied, so that "ready" means seeded (FR-CI-001).
func (*Instance) Readiness ¶
Readiness reports each service's readiness, and any readiness holds: nil error means ready.
func (*Instance) RequestShutdown ¶
func (in *Instance) RequestShutdown()
RequestShutdown triggers Shutdown asynchronously (used by the admin API).
func (*Instance) Shutdown ¶
Shutdown stops services in reverse order, closes the store and removes runtime files (FR-CORE-006).
func (*Instance) Start ¶
Start registers routes, starts the gateway and every service, and writes endpoints.json. A failing service is reported not-ready rather than stopping the others (NFR-REL-003).
func (*Instance) WriteCABundle ¶
WriteCABundle (re)writes <instance-dir>/ca-bundle.pem: the host's system roots plus the instance CA, for SSL_CERT_FILE.