Documentation
¶
Overview ¶
Package fakeengine is a lightweight engine for operator tests (0004 §9): it speaks the bundle protocol, verifies each bundle's signature and acknowledges it, without inspecting any traffic. Many fit in one test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
ID string
// Addr is the operator's distribution server, host:port.
Addr string
// TLS verifies the operator's certificate.
TLS *tls.Config
// Token is the ServiceAccount token sent as a bearer token.
Token string
// PublicKeys verify bundles, chosen by their key ID; SetPublicKeys
// changes them while the engine runs, as a reloaded key file does.
PublicKeys []ed25519.PublicKey
// Reject, if set, decides whether to refuse a bundle (Nack).
Reject func(*bundlev1.Bundle) error
// EngineVersion is the release the engine reports; empty: "fake",
// which no field's requirement counts as too old.
EngineVersion string
// Heartbeat is the interval of heartbeats; 0 means 1s.
Heartbeat time.Duration
// OnApply, if set, is called with each bundle the engine applies,
// before its Ack.
OnApply func(*bundlev1.Bundle)
// KeepVersionOnly keeps only the version of the applied bundle, not
// its policies: hundreds of engines with a large bundle each would
// take gigabytes (the scale test, operator/test/scale).
KeepVersionOnly bool
// given the very bundle another one verified, byte for byte with the
// same key, takes that one's result instead of decoding it again. The
// bundle passed to Reject and OnApply, and kept, is then shared: read
// only. Real engines each decode on their own CPU, at once; hundreds
// of fake engines in one process decoding a 2 MB bundle at once took
// gigabytes, and on a busy machine stalled long enough for the
// operator to close their connections (the scale test, #296).
Shared *Shared
// PodNamespace and PodName name the engine's pod in its Hello;
// default "test" and ID.
PodNamespace, PodName string
// ProbeReceipts, if set, returns the probe receipts each heartbeat
// reports (#475).
ProbeReceipts func() []string
// GeoTables takes country tables (design 0011 §4.4): the Hello
// advertises geo-table, a table whose bytes match its hash is held,
// and heartbeats report it. OnGeoTable, if set, is called with each.
GeoTables bool
OnGeoTable func(hash []byte)
// contains filtered or unexported fields
}
Engine is a fake engine.
func (*Engine) SetPublicKeys ¶ added in v0.1.1
SetPublicKeys replaces the trusted keys; heartbeats report them.
func (*Engine) TrustedKeys ¶ added in v0.1.1
TrustedKeys returns the IDs of the trusted keys.