Documentation
¶
Overview ¶
Package wittymodule is what a WittyMediaServer plugin needs to be a project of its own: the manifest, the rules for version ranges, the protocol a helper process speaks, and the names of a release's files. It has no dependencies, so a plugin that uses it still has none of its own.
Index ¶
- Constants
- Variables
- func ArchiveName(id, ver, goos, goarch string) string
- func Compare(a, b string) int
- func Main(manifest []byte, h Handler)
- func ManifestName(id, ver string) string
- func Prerelease(s string) bool
- func Serve(in io.Reader, out io.Writer, hello Hello, h Handler) error
- func SumsName(id, ver string) string
- func TopFolder(id, ver, goos, goarch string) string
- func Valid(s string) bool
- type CallError
- type Conn
- type Handler
- type Hello
- type Manifest
- type Target
Constants ¶
const ( API = 1 MinAPI = 1 )
The module API: the contract between the server and its plugins. A plugin names the version it was built for, and a server takes MinAPI to API. Adding to the contract raises API only; breaking it raises MinAPI too, which disables older plugins, so that is done rarely.
const ( DeliveryHelper = "helper" // a program for each platform, run as a separate process DeliveryWeb = "web" // a bundle the browser loads DeliveryBuiltin = "builtin" // not converted yet: it updates with the server )
How a release of a plugin reaches the server.
const ( MaxLine = 1 << 20 MaxBlob = 128 << 20 )
The helper protocol (module API 1): one line of JSON per message over stdin and stdout, optionally followed by a binary blob of the announced size. Sizes are checked before anything is read, because the two sides don't trust each other.
const HelperFlag = "--wms-helper"
HelperFlag is what the server starts a helper with.
const ManifestFile = "module.json"
ManifestFile is the manifest's name in a plugin's folder and in a release.
Variables ¶
var Targets = []Target{{"windows", "amd64"}, {"windows", "arm64"}, {"darwin", "amd64"}, {"darwin", "arm64"},
{"linux", "amd64"}, {"linux", "arm64"}, {"linux", "arm"}, {"linux", "386"}, {"freebsd", "amd64"}, {"freebsd", "arm64"}}
Targets are the platforms the server ships to, as in scripts/build-release.sh.
Functions ¶
func ArchiveName ¶
ArchiveName is the release archive for a platform.
func Compare ¶
Compare orders two versions: -1 if a is older than b, 0 if equal, 1 if newer. A pre-release (0.4.0-alpha) comes before its release (0.4.0). Versions that cannot be read sort before everything else.
func Main ¶
Main runs a helper program from its manifest. Started by hand, it explains itself instead of waiting silently.
func ManifestName ¶
ManifestName is the copy of the manifest attached to a release, so it can be judged before anything large is downloaded.
func Prerelease ¶
Prerelease reports whether s is a pre-release such as 0.4.0-alpha.
Types ¶
type CallError ¶
CallError is an answer from a working helper that says no, such as a file it can't read. It says nothing about the helper's health; any other error from Call means the helper itself failed.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is the server's end of the protocol. It makes one call at a time.
type Handler ¶
Handler answers one call with a result to send as JSON, an optional blob, and an error (a *CallError keeps its code).
type Hello ¶
type Hello struct {
Module string `json:"module"`
Version string `json:"version"`
API int `json:"api"`
}
Hello is the first thing a helper says.
type Manifest ¶
type Manifest struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Repo string `json:"repo"` // owner/name on GitHub, where its releases are
Delivery string `json:"delivery"`
Entry string `json:"entry,omitempty"` // the helper program, without .exe
API int `json:"api"`
MinServer string `json:"minServer"`
MaxServer string `json:"maxServer"`
// Capabilities are facts the server needs without starting the helper, such
// as "rawExtensions". Signed along with everything else.
Capabilities map[string][]string `json:"capabilities,omitempty"`
}
Manifest describes one version of a plugin.
func ParseManifest ¶
ParseManifest reads and checks a manifest.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
wittymodule
command
Command wittymodule checks, builds and signs a release of a WittyMediaServer plugin, from the plugin's own folder.
|
Command wittymodule checks, builds and signs a release of a WittyMediaServer plugin, from the plugin's own folder. |