Documentation
¶
Overview ¶
Package fake is a backend of the dev UI in memory, for the tests of its pages.
Index ¶
- type Backend
- func (b *Backend) Calls(methods ...string) []Call
- func (b *Backend) Change()
- func (b *Backend) Changed() <-chan struct{}
- func (b *Backend) Logs(_ context.Context, q devapi.LogQuery) ([]devapi.LogEntry, error)
- func (b *Backend) Mail(_ context.Context, app string) ([]devapi.MailSummary, error)
- func (b *Backend) MailGet(_ context.Context, app, id string) (devapi.Mail, error)
- func (b *Backend) MailReceive(_ context.Context, app string, m devapi.InboundMail) (string, error)
- func (b *Backend) Personas() []devconfig.Persona
- func (b *Backend) Restart(_ context.Context, app string) (devapi.App, error)
- func (b *Backend) SetManual(app string, on bool) error
- func (b *Backend) Start(app string) error
- func (b *Backend) Status(context.Context) (devapi.Status, error)
- func (b *Backend) Stop(app string) error
- func (b *Backend) Trace(_ context.Context, id string) (devapi.Trace, error)
- func (b *Backend) Traces(_ context.Context, q devapi.TraceQuery) ([]devapi.TraceSummary, error)
- func (b *Backend) Update(f func(*Data))
- func (b *Backend) WhatBroke(_ context.Context, app string) (devapi.Broken, error)
- type Call
- type Data
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
Data Data
// contains filtered or unexported fields
}
Backend is a deps.Backend that answers from Data and records every call but those of Personas and Changed. A method fails with the error Data.Errors holds for it, and with E-DEV-014 for an app Data.Status does not list. Set Data before the Backend is shared and change it only through Update after. A Backend is safe for concurrent use.
func (*Backend) Calls ¶
Calls returns the calls to the methods named, or every call when none is named, in order.
func (*Backend) Change ¶
func (b *Backend) Change()
Change closes the channel Changed returned, as the workspace does at every change.
func (*Backend) Changed ¶
func (b *Backend) Changed() <-chan struct{}
Changed returns a channel that Change closes.
func (*Backend) MailReceive ¶
MailReceive adds m to the end of the messages of app, in the folder "inbox", and calls Change.
func (*Backend) Traces ¶
func (b *Backend) Traces(_ context.Context, q devapi.TraceQuery) ([]devapi.TraceSummary, error)
Traces returns Data.Traces.
type Call ¶
type Call struct {
Method string
App string
// Arg is the call's other argument: the query of Logs and Traces, the id of Trace and
// MailGet, the message of MailReceive and the switch of SetManual.
Arg any
}
Call is one call a Backend got.
type Data ¶
type Data struct {
Status devapi.Status
// Logs answers every query of Logs, and Traces every query of Traces; Calls holds the
// queries.
Logs []devapi.LogEntry
Traces []devapi.TraceSummary
// Spans holds the spans Trace finds by trace id.
Spans []devapi.Span
// Mail holds the messages of each app, in the order Mail lists them.
Mail map[string][]devapi.Mail
Broken devapi.Broken
Personas []devconfig.Persona
// Errors holds the error each method, by name, fails with.
Errors map[string]error
}
Data is what a Backend answers.