Documentation ¶
Overview ¶
Package gapi defines the interface that graph API generators must meet.
Index ¶
Constants ¶
const Umask = 0666
Umask is the default to use when none has been specified. TODO: apparently using 0666 is equivalent to respecting the current umask
Variables ¶
var RegisteredGAPIs = make(map[string]func() GAPI) // must initialize this map
RegisteredGAPIs is a global map of all possible GAPIs which can be used. You should never touch this map directly. Use methods like Register instead.
Functions ¶
func CopyDirToFs ¶
CopyDirToFs copies a dir from src path on the local fs to a dst path on fs.
func CopyFileToFs ¶
CopyFileToFs copies a file from src path on the local fs to a dst path on fs.
func CopyStringToFs ¶
CopyStringToFs copies a file from src path on the local fs to a dst path on fs.
Types ¶
type Data ¶
type Data struct { Program string // name of the originating program Hostname string // uuid for the host, required for GAPI World resources.World Noop bool NoConfigWatch bool NoStreamWatch bool Debug bool Logf func(format string, v ...interface{}) }
Data is the set of input values passed into the GAPI structs via Init.
type Deploy ¶
type Deploy struct { Name string // lang, hcl, puppet, yaml, yaml2, etc... //Sync bool // wait for everyone to close previous GAPI before switching Noop bool Sema int // sema override GAPI GAPI }
Deploy represents a deploy action, include the type of GAPI to deploy, the payload of that GAPI, and any deploy specific parameters that were chosen. TODO: add staged rollout functionality to this struct TODO: add proper authentication with gpg key signing
func NewDeployFromB64 ¶
NewDeployFromB64 decodes a deploy struct from a base64 encoded string.
type GAPI ¶
type GAPI interface { Cli(c *cli.Context, fs resources.Fs) (*Deploy, error) CliFlags() []cli.Flag Init(Data) error // initializes the GAPI and passes in useful data Graph() (*pgraph.Graph, error) // returns the most recent pgraph Next() chan Next // returns a stream of switch events Close() error // shutdown the GAPI }
GAPI is a Graph API that represents incoming graphs and change streams.
type Next ¶
type Next struct { // FIXME: the Fast pause parameter should eventually get replaced with a // "SwitchMethod" parameter or similar that instead lets the implementer // choose between fast pause, slow pause, and interrupt. Interrupt could // be a future extension to the Resource API that lets an Interrupt() be // called if we want to exit immediately from the CheckApply part of the // resource for some reason. For now we'll keep this simple with a bool. Fast bool // run a fast pause to switch? Exit bool // should we cause the program to exit? (specify err or not) Err error // if something goes wrong (use with or without exit!) }
Next describes the particular response the GAPI implementer wishes to emit.