repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
flynn/flynn | util/release/types/manifest.go | Add | func (m *EC2Manifest) Add(version string, image *EC2Image) {
versions := make(sortVersions, 0, len(m.Versions)+1)
for _, v := range m.Versions {
if v.version() == version {
images := make([]*EC2Image, len(v.Images))
added := false
for n, i := range v.Images {
if i.Region == image.Region {
// repla... | go | func (m *EC2Manifest) Add(version string, image *EC2Image) {
versions := make(sortVersions, 0, len(m.Versions)+1)
for _, v := range m.Versions {
if v.version() == version {
images := make([]*EC2Image, len(v.Images))
added := false
for n, i := range v.Images {
if i.Region == image.Region {
// repla... | [
"func",
"(",
"m",
"*",
"EC2Manifest",
")",
"Add",
"(",
"version",
"string",
",",
"image",
"*",
"EC2Image",
")",
"{",
"versions",
":=",
"make",
"(",
"sortVersions",
",",
"0",
",",
"len",
"(",
"m",
".",
"Versions",
")",
"+",
"1",
")",
"\n",
"for",
... | // Add adds an image to the manifest.
//
// If the version is already in the manifest, the given image either
// replaces any existing image with the same region, or is appended to
// the existing list of images for that version.
//
// If the version is not already in the manifest a new version is added
// containing t... | [
"Add",
"adds",
"an",
"image",
"to",
"the",
"manifest",
".",
"If",
"the",
"version",
"is",
"already",
"in",
"the",
"manifest",
"the",
"given",
"image",
"either",
"replaces",
"any",
"existing",
"image",
"with",
"the",
"same",
"region",
"or",
"is",
"appended"... | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/util/release/types/manifest.go#L26-L58 | train |
flynn/flynn | util/release/types/manifest.go | Add | func (m *VagrantManifest) Add(version string, provider *VagrantProvider) {
// strip the leading "v" from the version as Vagrant only supports
// versions like X.Y.Z, see https://github.com/flynn/flynn/issues/2230
version = strings.TrimPrefix(version, "v")
versions := make(sortVersions, 0, len(m.Versions)+1)
for _... | go | func (m *VagrantManifest) Add(version string, provider *VagrantProvider) {
// strip the leading "v" from the version as Vagrant only supports
// versions like X.Y.Z, see https://github.com/flynn/flynn/issues/2230
version = strings.TrimPrefix(version, "v")
versions := make(sortVersions, 0, len(m.Versions)+1)
for _... | [
"func",
"(",
"m",
"*",
"VagrantManifest",
")",
"Add",
"(",
"version",
"string",
",",
"provider",
"*",
"VagrantProvider",
")",
"{",
"// strip the leading \"v\" from the version as Vagrant only supports",
"// versions like X.Y.Z, see https://github.com/flynn/flynn/issues/2230",
"ve... | // Add adds a provider to the manifest.
//
// If the version is already in the manifest, the given provider either
// replaces any existing provider with the same name, or is appended to
// the existing list of providers for that version.
//
// If the version is not already in the manifest a new version is added
// con... | [
"Add",
"adds",
"a",
"provider",
"to",
"the",
"manifest",
".",
"If",
"the",
"version",
"is",
"already",
"in",
"the",
"manifest",
"the",
"given",
"provider",
"either",
"replaces",
"any",
"existing",
"provider",
"with",
"the",
"same",
"name",
"or",
"is",
"app... | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/util/release/types/manifest.go#L114-L150 | train |
flynn/flynn | pkg/mux/mux.go | New | func New(ln net.Listener) *Mux {
return &Mux{
ln: ln,
handlers: make(map[byte]*handler),
Timeout: 30 * time.Second,
LogOutput: os.Stderr,
}
} | go | func New(ln net.Listener) *Mux {
return &Mux{
ln: ln,
handlers: make(map[byte]*handler),
Timeout: 30 * time.Second,
LogOutput: os.Stderr,
}
} | [
"func",
"New",
"(",
"ln",
"net",
".",
"Listener",
")",
"*",
"Mux",
"{",
"return",
"&",
"Mux",
"{",
"ln",
":",
"ln",
",",
"handlers",
":",
"make",
"(",
"map",
"[",
"byte",
"]",
"*",
"handler",
")",
",",
"Timeout",
":",
"30",
"*",
"time",
".",
... | // New returns a new instance of Mux. | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"Mux",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L29-L36 | train |
flynn/flynn | pkg/mux/mux.go | Close | func (mux *Mux) Close() (err error) {
mux.once.Do(func() {
// Close underlying listener.
if mux.ln != nil {
err = mux.ln.Close()
}
// Wait for open connections to close and then close handlers.
mux.wg.Wait()
for _, h := range mux.handlers {
h.Close()
}
})
return
} | go | func (mux *Mux) Close() (err error) {
mux.once.Do(func() {
// Close underlying listener.
if mux.ln != nil {
err = mux.ln.Close()
}
// Wait for open connections to close and then close handlers.
mux.wg.Wait()
for _, h := range mux.handlers {
h.Close()
}
})
return
} | [
"func",
"(",
"mux",
"*",
"Mux",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"mux",
".",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"// Close underlying listener.",
"if",
"mux",
".",
"ln",
"!=",
"nil",
"{",
"err",
"=",
"mux",
".",
... | // Close closes the underlying listener. | [
"Close",
"closes",
"the",
"underlying",
"listener",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L39-L53 | train |
flynn/flynn | pkg/mux/mux.go | Serve | func (mux *Mux) Serve() error {
logger := log.New(mux.LogOutput, "", log.LstdFlags)
for {
// Handle incoming connections. Retry temporary errors.
conn, err := mux.ln.Accept()
if err, ok := err.(interface {
Temporary() bool
}); ok && err.Temporary() {
logger.Printf("tcp.Mux: temporary error: %s", err)
... | go | func (mux *Mux) Serve() error {
logger := log.New(mux.LogOutput, "", log.LstdFlags)
for {
// Handle incoming connections. Retry temporary errors.
conn, err := mux.ln.Accept()
if err, ok := err.(interface {
Temporary() bool
}); ok && err.Temporary() {
logger.Printf("tcp.Mux: temporary error: %s", err)
... | [
"func",
"(",
"mux",
"*",
"Mux",
")",
"Serve",
"(",
")",
"error",
"{",
"logger",
":=",
"log",
".",
"New",
"(",
"mux",
".",
"LogOutput",
",",
"\"",
"\"",
",",
"log",
".",
"LstdFlags",
")",
"\n\n",
"for",
"{",
"// Handle incoming connections. Retry temporar... | // Serve handles connections from ln and multiplexes then across registered listener. | [
"Serve",
"handles",
"connections",
"from",
"ln",
"and",
"multiplexes",
"then",
"across",
"registered",
"listener",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L56-L85 | train |
flynn/flynn | pkg/mux/mux.go | Listen | func (mux *Mux) Listen(hdrs []byte) net.Listener {
// Create new handler.
h := mux.handler()
// Register each header byte.
for _, hdr := range hdrs {
// Create a new listener and assign it.
mux.handlers[hdr] = h
}
return h
} | go | func (mux *Mux) Listen(hdrs []byte) net.Listener {
// Create new handler.
h := mux.handler()
// Register each header byte.
for _, hdr := range hdrs {
// Create a new listener and assign it.
mux.handlers[hdr] = h
}
return h
} | [
"func",
"(",
"mux",
"*",
"Mux",
")",
"Listen",
"(",
"hdrs",
"[",
"]",
"byte",
")",
"net",
".",
"Listener",
"{",
"// Create new handler.",
"h",
":=",
"mux",
".",
"handler",
"(",
")",
"\n\n",
"// Register each header byte.",
"for",
"_",
",",
"hdr",
":=",
... | // Listen returns a listener that receives connections from any byte in hdrs.
// Re-registering hdr bytes will overwrite existing handlers. | [
"Listen",
"returns",
"a",
"listener",
"that",
"receives",
"connections",
"from",
"any",
"byte",
"in",
"hdrs",
".",
"Re",
"-",
"registering",
"hdr",
"bytes",
"will",
"overwrite",
"existing",
"handlers",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L122-L133 | train |
flynn/flynn | pkg/mux/mux.go | handler | func (mux *Mux) handler() *handler {
return &handler{
mux: mux,
c: make(chan net.Conn),
}
} | go | func (mux *Mux) handler() *handler {
return &handler{
mux: mux,
c: make(chan net.Conn),
}
} | [
"func",
"(",
"mux",
"*",
"Mux",
")",
"handler",
"(",
")",
"*",
"handler",
"{",
"return",
"&",
"handler",
"{",
"mux",
":",
"mux",
",",
"c",
":",
"make",
"(",
"chan",
"net",
".",
"Conn",
")",
",",
"}",
"\n",
"}"
] | // handler returns a new instance of handler. | [
"handler",
"returns",
"a",
"new",
"instance",
"of",
"handler",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L136-L141 | train |
flynn/flynn | pkg/mux/mux.go | Accept | func (h *handler) Accept() (c net.Conn, err error) {
conn, ok := <-h.c
if !ok {
return nil, errors.New("network connection closed")
}
return conn, nil
} | go | func (h *handler) Accept() (c net.Conn, err error) {
conn, ok := <-h.c
if !ok {
return nil, errors.New("network connection closed")
}
return conn, nil
} | [
"func",
"(",
"h",
"*",
"handler",
")",
"Accept",
"(",
")",
"(",
"c",
"net",
".",
"Conn",
",",
"err",
"error",
")",
"{",
"conn",
",",
"ok",
":=",
"<-",
"h",
".",
"c",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(... | // Accept waits for and returns the next connection. | [
"Accept",
"waits",
"for",
"and",
"returns",
"the",
"next",
"connection",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L151-L157 | train |
flynn/flynn | pkg/mux/mux.go | Close | func (h *handler) Close() error {
h.once.Do(func() { close(h.c) })
return nil
} | go | func (h *handler) Close() error {
h.once.Do(func() { close(h.c) })
return nil
} | [
"func",
"(",
"h",
"*",
"handler",
")",
"Close",
"(",
")",
"error",
"{",
"h",
".",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"close",
"(",
"h",
".",
"c",
")",
"}",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Close closes the original listener. | [
"Close",
"closes",
"the",
"original",
"listener",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L160-L163 | train |
flynn/flynn | pkg/mux/mux.go | newBufConn | func newBufConn(conn net.Conn) *bufConn {
return &bufConn{
conn: conn,
r: bufio.NewReader(conn),
}
} | go | func newBufConn(conn net.Conn) *bufConn {
return &bufConn{
conn: conn,
r: bufio.NewReader(conn),
}
} | [
"func",
"newBufConn",
"(",
"conn",
"net",
".",
"Conn",
")",
"*",
"bufConn",
"{",
"return",
"&",
"bufConn",
"{",
"conn",
":",
"conn",
",",
"r",
":",
"bufio",
".",
"NewReader",
"(",
"conn",
")",
",",
"}",
"\n",
"}"
] | // newBufConn returns a new instance of bufConn. | [
"newBufConn",
"returns",
"a",
"new",
"instance",
"of",
"bufConn",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/mux/mux.go#L175-L180 | train |
flynn/flynn | controller/worker/deployment/discoverd_meta.go | deployDiscoverdMeta | func (d *DeployJob) deployDiscoverdMeta() (err error) {
log := d.logger.New("fn", "deployDiscoverdMeta")
log.Info("starting discoverd-meta deployment")
defer func() {
if err != nil {
// TODO: support rolling back
err = ErrSkipRollback{err.Error()}
}
}()
for typ, count := range d.Processes {
proc := d... | go | func (d *DeployJob) deployDiscoverdMeta() (err error) {
log := d.logger.New("fn", "deployDiscoverdMeta")
log.Info("starting discoverd-meta deployment")
defer func() {
if err != nil {
// TODO: support rolling back
err = ErrSkipRollback{err.Error()}
}
}()
for typ, count := range d.Processes {
proc := d... | [
"func",
"(",
"d",
"*",
"DeployJob",
")",
"deployDiscoverdMeta",
"(",
")",
"(",
"err",
"error",
")",
"{",
"log",
":=",
"d",
".",
"logger",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",... | // deployDiscoverMeta does a one-by-one deployment but uses discoverd.Deployment
// to wait for appropriate service metadata before stopping old jobs. | [
"deployDiscoverMeta",
"does",
"a",
"one",
"-",
"by",
"-",
"one",
"deployment",
"but",
"uses",
"discoverd",
".",
"Deployment",
"to",
"wait",
"for",
"appropriate",
"service",
"metadata",
"before",
"stopping",
"old",
"jobs",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/worker/deployment/discoverd_meta.go#L7-L50 | train |
flynn/flynn | logaggregator/client/client.go | NewWithHTTP | func NewWithHTTP(uri string, httpClient *http.Client) (*Client, error) {
if uri == "" {
uri = "http://logaggregator.discoverd"
}
u, err := url.Parse(uri)
if err != nil {
return nil, err
}
return newClient(u.String(), httpClient), nil
} | go | func NewWithHTTP(uri string, httpClient *http.Client) (*Client, error) {
if uri == "" {
uri = "http://logaggregator.discoverd"
}
u, err := url.Parse(uri)
if err != nil {
return nil, err
}
return newClient(u.String(), httpClient), nil
} | [
"func",
"NewWithHTTP",
"(",
"uri",
"string",
",",
"httpClient",
"*",
"http",
".",
"Client",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"uri",
"==",
"\"",
"\"",
"{",
"uri",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"u",
",",
"err",
":=",
"ur... | // NewClient creates a new Client pointing at uri with the specified http client. | [
"NewClient",
"creates",
"a",
"new",
"Client",
"pointing",
"at",
"uri",
"with",
"the",
"specified",
"http",
"client",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/logaggregator/client/client.go#L42-L51 | train |
flynn/flynn | pkg/rpcplus/jsonrpc/client.go | NewClientCodec | func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec {
return &clientCodec{
dec: json.NewDecoder(conn),
enc: json.NewEncoder(conn),
c: conn,
pending: make(map[uint64]string),
}
} | go | func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec {
return &clientCodec{
dec: json.NewDecoder(conn),
enc: json.NewEncoder(conn),
c: conn,
pending: make(map[uint64]string),
}
} | [
"func",
"NewClientCodec",
"(",
"conn",
"io",
".",
"ReadWriteCloser",
")",
"rpc",
".",
"ClientCodec",
"{",
"return",
"&",
"clientCodec",
"{",
"dec",
":",
"json",
".",
"NewDecoder",
"(",
"conn",
")",
",",
"enc",
":",
"json",
".",
"NewEncoder",
"(",
"conn",... | // NewClientCodec returns a new rpc.ClientCodec using JSON-RPC on conn. | [
"NewClientCodec",
"returns",
"a",
"new",
"rpc",
".",
"ClientCodec",
"using",
"JSON",
"-",
"RPC",
"on",
"conn",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/rpcplus/jsonrpc/client.go#L37-L44 | train |
flynn/flynn | pkg/rpcplus/jsonrpc/client.go | NewClient | func NewClient(conn io.ReadWriteCloser) *rpc.Client {
return rpc.NewClientWithCodec(NewClientCodec(conn))
} | go | func NewClient(conn io.ReadWriteCloser) *rpc.Client {
return rpc.NewClientWithCodec(NewClientCodec(conn))
} | [
"func",
"NewClient",
"(",
"conn",
"io",
".",
"ReadWriteCloser",
")",
"*",
"rpc",
".",
"Client",
"{",
"return",
"rpc",
".",
"NewClientWithCodec",
"(",
"NewClientCodec",
"(",
"conn",
")",
")",
"\n",
"}"
] | // NewClient returns a new rpc.Client to handle requests to the
// set of services at the other end of the connection. | [
"NewClient",
"returns",
"a",
"new",
"rpc",
".",
"Client",
"to",
"handle",
"requests",
"to",
"the",
"set",
"of",
"services",
"at",
"the",
"other",
"end",
"of",
"the",
"connection",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/rpcplus/jsonrpc/client.go#L113-L115 | train |
flynn/flynn | controller/types/types.go | Critical | func (a *App) Critical() bool {
v, ok := a.Meta["flynn-system-critical"]
return ok && v == "true"
} | go | func (a *App) Critical() bool {
v, ok := a.Meta["flynn-system-critical"]
return ok && v == "true"
} | [
"func",
"(",
"a",
"*",
"App",
")",
"Critical",
"(",
")",
"bool",
"{",
"v",
",",
"ok",
":=",
"a",
".",
"Meta",
"[",
"\"",
"\"",
"]",
"\n",
"return",
"ok",
"&&",
"v",
"==",
"\"",
"\"",
"\n",
"}"
] | // Critical apps cannot be completely scaled down by the scheduler | [
"Critical",
"apps",
"cannot",
"be",
"completely",
"scaled",
"down",
"by",
"the",
"scheduler"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/types/types.go#L74-L77 | train |
flynn/flynn | pkg/syslog/rfc5424/message.go | NewMessage | func NewMessage(hdr *Header, msg []byte) *Message {
var h Header
if hdr != nil {
h = *hdr
}
if h.Timestamp.IsZero() {
h.Timestamp = time.Now().UTC()
}
if h.Version == 0 {
h.Version = 1
}
if msg != nil {
m := make([]byte, len(msg))
copy(m, msg)
msg = m
}
return &Message{Header: h, Msg: msg}
} | go | func NewMessage(hdr *Header, msg []byte) *Message {
var h Header
if hdr != nil {
h = *hdr
}
if h.Timestamp.IsZero() {
h.Timestamp = time.Now().UTC()
}
if h.Version == 0 {
h.Version = 1
}
if msg != nil {
m := make([]byte, len(msg))
copy(m, msg)
msg = m
}
return &Message{Header: h, Msg: msg}
} | [
"func",
"NewMessage",
"(",
"hdr",
"*",
"Header",
",",
"msg",
"[",
"]",
"byte",
")",
"*",
"Message",
"{",
"var",
"h",
"Header",
"\n",
"if",
"hdr",
"!=",
"nil",
"{",
"h",
"=",
"*",
"hdr",
"\n",
"}",
"\n\n",
"if",
"h",
".",
"Timestamp",
".",
"IsZe... | // NewMessage builds a new message from a copy of the header and message. | [
"NewMessage",
"builds",
"a",
"new",
"message",
"from",
"a",
"copy",
"of",
"the",
"header",
"and",
"message",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/pkg/syslog/rfc5424/message.go#L23-L44 | train |
flynn/flynn | controller/scheduler/host.go | StreamJobEventsTo | func (h *Host) StreamJobEventsTo(ch chan *host.Event) (map[string]host.ActiveJob, error) {
log := h.logger.New("fn", "StreamJobEventsTo", "host.id", h.ID)
var events chan *host.Event
var stream stream.Stream
connect := func() (err error) {
log.Info("connecting job event stream")
events = make(chan *host.Event)
... | go | func (h *Host) StreamJobEventsTo(ch chan *host.Event) (map[string]host.ActiveJob, error) {
log := h.logger.New("fn", "StreamJobEventsTo", "host.id", h.ID)
var events chan *host.Event
var stream stream.Stream
connect := func() (err error) {
log.Info("connecting job event stream")
events = make(chan *host.Event)
... | [
"func",
"(",
"h",
"*",
"Host",
")",
"StreamJobEventsTo",
"(",
"ch",
"chan",
"*",
"host",
".",
"Event",
")",
"(",
"map",
"[",
"string",
"]",
"host",
".",
"ActiveJob",
",",
"error",
")",
"{",
"log",
":=",
"h",
".",
"logger",
".",
"New",
"(",
"\"",
... | // StreamJobEventsTo streams all job events from the host to the given channel
// in a goroutine, returning the current list of active jobs. | [
"StreamJobEventsTo",
"streams",
"all",
"job",
"events",
"from",
"the",
"host",
"to",
"the",
"given",
"channel",
"in",
"a",
"goroutine",
"returning",
"the",
"current",
"list",
"of",
"active",
"jobs",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/scheduler/host.go#L153-L219 | train |
flynn/flynn | logaggregator/snapshot/snapshot.go | WriteTo | func WriteTo(buffers [][]*rfc5424.Message, w io.Writer) error {
enc := gob.NewEncoder(w)
return writeTo(buffers, enc)
} | go | func WriteTo(buffers [][]*rfc5424.Message, w io.Writer) error {
enc := gob.NewEncoder(w)
return writeTo(buffers, enc)
} | [
"func",
"WriteTo",
"(",
"buffers",
"[",
"]",
"[",
"]",
"*",
"rfc5424",
".",
"Message",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"enc",
":=",
"gob",
".",
"NewEncoder",
"(",
"w",
")",
"\n",
"return",
"writeTo",
"(",
"buffers",
",",
"enc",
... | // WriteTo writes a snapshot of the buffers to the writer. The partitioning of
// messages is not retained. The writer is left open. | [
"WriteTo",
"writes",
"a",
"snapshot",
"of",
"the",
"buffers",
"to",
"the",
"writer",
".",
"The",
"partitioning",
"of",
"messages",
"is",
"not",
"retained",
".",
"The",
"writer",
"is",
"left",
"open",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/logaggregator/snapshot/snapshot.go#L12-L15 | train |
flynn/flynn | logaggregator/snapshot/snapshot.go | StreamTo | func StreamTo(buffers [][]*rfc5424.Message, msgc <-chan *rfc5424.Message, w io.Writer) error {
enc := gob.NewEncoder(w)
if err := writeTo(buffers, enc); err != nil {
return err
}
for msg := range msgc {
if err := enc.Encode(msg); err != nil {
return err
}
}
return nil
} | go | func StreamTo(buffers [][]*rfc5424.Message, msgc <-chan *rfc5424.Message, w io.Writer) error {
enc := gob.NewEncoder(w)
if err := writeTo(buffers, enc); err != nil {
return err
}
for msg := range msgc {
if err := enc.Encode(msg); err != nil {
return err
}
}
return nil
} | [
"func",
"StreamTo",
"(",
"buffers",
"[",
"]",
"[",
"]",
"*",
"rfc5424",
".",
"Message",
",",
"msgc",
"<-",
"chan",
"*",
"rfc5424",
".",
"Message",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"enc",
":=",
"gob",
".",
"NewEncoder",
"(",
"w",
... | // StreamTo writes a snapshot of the buffers to the writer, then writes
// messages from the channel to the writer. The writer is left open. | [
"StreamTo",
"writes",
"a",
"snapshot",
"of",
"the",
"buffers",
"to",
"the",
"writer",
"then",
"writes",
"messages",
"from",
"the",
"channel",
"to",
"the",
"writer",
".",
"The",
"writer",
"is",
"left",
"open",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/logaggregator/snapshot/snapshot.go#L30-L42 | train |
flynn/flynn | logaggregator/snapshot/snapshot.go | NewScanner | func NewScanner(r io.Reader) *Scanner {
return &Scanner{dec: gob.NewDecoder(r)}
} | go | func NewScanner(r io.Reader) *Scanner {
return &Scanner{dec: gob.NewDecoder(r)}
} | [
"func",
"NewScanner",
"(",
"r",
"io",
".",
"Reader",
")",
"*",
"Scanner",
"{",
"return",
"&",
"Scanner",
"{",
"dec",
":",
"gob",
".",
"NewDecoder",
"(",
"r",
")",
"}",
"\n",
"}"
] | // NewScanner returns a new Scanner reading from r. | [
"NewScanner",
"returns",
"a",
"new",
"Scanner",
"reading",
"from",
"r",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/logaggregator/snapshot/snapshot.go#L53-L55 | train |
flynn/flynn | appliance/redis/handler.go | healthStatus | func (h *Handler) healthStatus() status.Status {
info, err := h.Process.Info()
if err != nil || !info.Running {
return status.Unhealthy
}
return status.Healthy
} | go | func (h *Handler) healthStatus() status.Status {
info, err := h.Process.Info()
if err != nil || !info.Running {
return status.Unhealthy
}
return status.Healthy
} | [
"func",
"(",
"h",
"*",
"Handler",
")",
"healthStatus",
"(",
")",
"status",
".",
"Status",
"{",
"info",
",",
"err",
":=",
"h",
".",
"Process",
".",
"Info",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"!",
"info",
".",
"Running",
"{",
"return",... | // healthStatus returns whether the process is healthy or unhealthy. | [
"healthStatus",
"returns",
"whether",
"the",
"process",
"is",
"healthy",
"or",
"unhealthy",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/appliance/redis/handler.go#L38-L44 | train |
flynn/flynn | discoverd/main.go | Promote | func (m *Main) Promote() error {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Printf("attempting promotion")
// Request the leader joins us to the cluster.
m.logger.Println("requesting leader join us to cluster")
targetLogIndex, err := discoverd.DefaultClient.RaftAddPeer(m.advertiseAddr)
if err != nil {
m.logger... | go | func (m *Main) Promote() error {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Printf("attempting promotion")
// Request the leader joins us to the cluster.
m.logger.Println("requesting leader join us to cluster")
targetLogIndex, err := discoverd.DefaultClient.RaftAddPeer(m.advertiseAddr)
if err != nil {
m.logger... | [
"func",
"(",
"m",
"*",
"Main",
")",
"Promote",
"(",
")",
"error",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"m",
".",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n\n",
"... | // Join the consensus set, promoting ourselves from proxy to raft node. | [
"Join",
"the",
"consensus",
"set",
"promoting",
"ourselves",
"from",
"proxy",
"to",
"raft",
"node",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L289-L332 | train |
flynn/flynn | discoverd/main.go | Demote | func (m *Main) Demote() error {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Println("demotion requested")
var leaderAddr string
if m.store != nil {
leaderAddr := m.store.Leader()
if leaderAddr == "" {
return server.ErrNoKnownLeader
}
} else {
leader, err := discoverd.DefaultClient.RaftLeader()
if err ... | go | func (m *Main) Demote() error {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Println("demotion requested")
var leaderAddr string
if m.store != nil {
leaderAddr := m.store.Leader()
if leaderAddr == "" {
return server.ErrNoKnownLeader
}
} else {
leader, err := discoverd.DefaultClient.RaftLeader()
if err ... | [
"func",
"(",
"m",
"*",
"Main",
")",
"Demote",
"(",
")",
"error",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"m",
".",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"... | // Leave the consensus set, demoting ourselves to proxy from raft node. | [
"Leave",
"the",
"consensus",
"set",
"demoting",
"ourselves",
"to",
"proxy",
"from",
"raft",
"node",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L335-L394 | train |
flynn/flynn | discoverd/main.go | Close | func (m *Main) Close() (info dt.TargetLogIndex, err error) {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Println("discoverd shutting down")
if m.httpServer != nil {
// Disable keep alives so that persistent connections will close
m.httpServer.SetKeepAlivesEnabled(false)
}
if m.dnsServer != nil {
m.dnsServer.Cl... | go | func (m *Main) Close() (info dt.TargetLogIndex, err error) {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Println("discoverd shutting down")
if m.httpServer != nil {
// Disable keep alives so that persistent connections will close
m.httpServer.SetKeepAlivesEnabled(false)
}
if m.dnsServer != nil {
m.dnsServer.Cl... | [
"func",
"(",
"m",
"*",
"Main",
")",
"Close",
"(",
")",
"(",
"info",
"dt",
".",
"TargetLogIndex",
",",
"err",
"error",
")",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"m",
".",
"... | // Close shuts down all open servers. | [
"Close",
"shuts",
"down",
"all",
"open",
"servers",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L407-L428 | train |
flynn/flynn | discoverd/main.go | openStore | func (m *Main) openStore() error {
// If the advertised address is not in the peer list then we should proxy.
// Resolve advertised address.
addr, err := net.ResolveTCPAddr("tcp", m.advertiseAddr)
if err != nil {
return err
}
// Listen via mux
storeLn := m.mux.Listen([]byte{server.StoreHdr})
// Initialize ... | go | func (m *Main) openStore() error {
// If the advertised address is not in the peer list then we should proxy.
// Resolve advertised address.
addr, err := net.ResolveTCPAddr("tcp", m.advertiseAddr)
if err != nil {
return err
}
// Listen via mux
storeLn := m.mux.Listen([]byte{server.StoreHdr})
// Initialize ... | [
"func",
"(",
"m",
"*",
"Main",
")",
"openStore",
"(",
")",
"error",
"{",
"// If the advertised address is not in the peer list then we should proxy.",
"// Resolve advertised address.",
"addr",
",",
"err",
":=",
"net",
".",
"ResolveTCPAddr",
"(",
"\"",
"\"",
",",
"m",
... | // openStore initializes and opens the store. | [
"openStore",
"initializes",
"and",
"opens",
"the",
"store",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L431-L465 | train |
flynn/flynn | discoverd/main.go | openDNSServer | func (m *Main) openDNSServer(addr string, recursors []string) error {
s := &server.DNSServer{
UDPAddr: addr,
TCPAddr: addr,
Recursors: recursors,
}
// If store is available then attach it. Otherwise use a proxy.
if m.store != nil {
s.SetStore(m.store)
} else {
s.SetStore(&server.ProxyStore{Peers: m.... | go | func (m *Main) openDNSServer(addr string, recursors []string) error {
s := &server.DNSServer{
UDPAddr: addr,
TCPAddr: addr,
Recursors: recursors,
}
// If store is available then attach it. Otherwise use a proxy.
if m.store != nil {
s.SetStore(m.store)
} else {
s.SetStore(&server.ProxyStore{Peers: m.... | [
"func",
"(",
"m",
"*",
"Main",
")",
"openDNSServer",
"(",
"addr",
"string",
",",
"recursors",
"[",
"]",
"string",
")",
"error",
"{",
"s",
":=",
"&",
"server",
".",
"DNSServer",
"{",
"UDPAddr",
":",
"addr",
",",
"TCPAddr",
":",
"addr",
",",
"Recursors... | // openDNSServer initializes and opens the DNS server.
// The store must already be open. | [
"openDNSServer",
"initializes",
"and",
"opens",
"the",
"DNS",
"server",
".",
"The",
"store",
"must",
"already",
"be",
"open",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L469-L488 | train |
flynn/flynn | discoverd/main.go | openHTTPServer | func (m *Main) openHTTPServer() error {
h := server.NewHandler(false, m.peers)
h.Main = m
h.Peers = m.peers
// If we have no store then start the handler in proxy mode
if m.store == nil {
h.Proxy.Store(true)
} else {
h.Store = m.store
}
m.handler = h
m.httpServer = &http.Server{Handler: h}
// Create list... | go | func (m *Main) openHTTPServer() error {
h := server.NewHandler(false, m.peers)
h.Main = m
h.Peers = m.peers
// If we have no store then start the handler in proxy mode
if m.store == nil {
h.Proxy.Store(true)
} else {
h.Store = m.store
}
m.handler = h
m.httpServer = &http.Server{Handler: h}
// Create list... | [
"func",
"(",
"m",
"*",
"Main",
")",
"openHTTPServer",
"(",
")",
"error",
"{",
"h",
":=",
"server",
".",
"NewHandler",
"(",
"false",
",",
"m",
".",
"peers",
")",
"\n",
"h",
".",
"Main",
"=",
"m",
"\n",
"h",
".",
"Peers",
"=",
"m",
".",
"peers",
... | // openHTTPServer initializes and opens the HTTP server.
// The store must already be open. | [
"openHTTPServer",
"initializes",
"and",
"opens",
"the",
"HTTP",
"server",
".",
"The",
"store",
"must",
"already",
"be",
"open",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L492-L510 | train |
flynn/flynn | discoverd/main.go | Notify | func (m *Main) Notify(notifyURL, dnsAddr string) {
m.mu.Lock()
m.status.URL = strings.Join(m.peers, ",")
if dnsAddr != "" {
m.status.DNS = dnsAddr
}
payload, _ := json.Marshal(m.status)
m.mu.Unlock()
res, err := http.Post(notifyURL, "application/json", bytes.NewReader(payload))
if err != nil {
m.logger.Pri... | go | func (m *Main) Notify(notifyURL, dnsAddr string) {
m.mu.Lock()
m.status.URL = strings.Join(m.peers, ",")
if dnsAddr != "" {
m.status.DNS = dnsAddr
}
payload, _ := json.Marshal(m.status)
m.mu.Unlock()
res, err := http.Post(notifyURL, "application/json", bytes.NewReader(payload))
if err != nil {
m.logger.Pri... | [
"func",
"(",
"m",
"*",
"Main",
")",
"Notify",
"(",
"notifyURL",
",",
"dnsAddr",
"string",
")",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"m",
".",
"status",
".",
"URL",
"=",
"strings",
".",
"Join",
"(",
"m",
".",
"peers",
",",
"\"",
"... | // Notify sends a POST to notifyURL to let it know that addr is accessible. | [
"Notify",
"sends",
"a",
"POST",
"to",
"notifyURL",
"to",
"let",
"it",
"know",
"that",
"addr",
"is",
"accessible",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L513-L528 | train |
flynn/flynn | discoverd/main.go | MergeHostPort | func MergeHostPort(host, portAddr string) string {
_, port, _ := net.SplitHostPort(portAddr)
return net.JoinHostPort(host, port)
} | go | func MergeHostPort(host, portAddr string) string {
_, port, _ := net.SplitHostPort(portAddr)
return net.JoinHostPort(host, port)
} | [
"func",
"MergeHostPort",
"(",
"host",
",",
"portAddr",
"string",
")",
"string",
"{",
"_",
",",
"port",
",",
"_",
":=",
"net",
".",
"SplitHostPort",
"(",
"portAddr",
")",
"\n",
"return",
"net",
".",
"JoinHostPort",
"(",
"host",
",",
"port",
")",
"\n",
... | // MergeHostPort joins host to the port in portAddr. | [
"MergeHostPort",
"joins",
"host",
"to",
"the",
"port",
"in",
"portAddr",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L531-L534 | train |
flynn/flynn | discoverd/main.go | waitForLeader | func (m *Main) waitForLeader(timeout time.Duration) error {
// Ignore leadership if we are a proxy.
if m.store == nil {
return nil
}
var timeoutCh <-chan time.Time
if timeout != IndefiniteTimeout {
timeoutCh = time.After(timeout)
}
for {
select {
case <-timeoutCh:
return errors.New("timed out waiting ... | go | func (m *Main) waitForLeader(timeout time.Duration) error {
// Ignore leadership if we are a proxy.
if m.store == nil {
return nil
}
var timeoutCh <-chan time.Time
if timeout != IndefiniteTimeout {
timeoutCh = time.After(timeout)
}
for {
select {
case <-timeoutCh:
return errors.New("timed out waiting ... | [
"func",
"(",
"m",
"*",
"Main",
")",
"waitForLeader",
"(",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"// Ignore leadership if we are a proxy.",
"if",
"m",
".",
"store",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"timeoutCh",
"<-... | // waitForLeader polls the store until a leader is found or a timeout occurs.
// If timeout is -1 then wait indefinitely | [
"waitForLeader",
"polls",
"the",
"store",
"until",
"a",
"leader",
"is",
"found",
"or",
"a",
"timeout",
"occurs",
".",
"If",
"timeout",
"is",
"-",
"1",
"then",
"wait",
"indefinitely"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L538-L557 | train |
flynn/flynn | discoverd/main.go | TrimSpaceSlice | func TrimSpaceSlice(a []string) []string {
other := make([]string, 0, len(a))
for _, s := range a {
s = strings.TrimSpace(s)
if s == "" {
continue
}
other = append(other, s)
}
return other
} | go | func TrimSpaceSlice(a []string) []string {
other := make([]string, 0, len(a))
for _, s := range a {
s = strings.TrimSpace(s)
if s == "" {
continue
}
other = append(other, s)
}
return other
} | [
"func",
"TrimSpaceSlice",
"(",
"a",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"other",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"a",
")",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"a",
"{",
"s",
"=",
"... | // TrimSpaceSlice returns a new slice of trimmed strings.
// Empty strings are removed entirely. | [
"TrimSpaceSlice",
"returns",
"a",
"new",
"slice",
"of",
"trimmed",
"strings",
".",
"Empty",
"strings",
"are",
"removed",
"entirely",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L612-L622 | train |
flynn/flynn | discoverd/main.go | SetPortSlice | func SetPortSlice(peers []string, addr string) ([]string, error) {
// Retrieve the port from addr.
_, port, err := net.SplitHostPort(addr)
if err != nil {
return nil, err
}
// Merge the port with the peer hosts into a new slice.
other := make([]string, len(peers))
for i, peer := range peers {
host, _, err :... | go | func SetPortSlice(peers []string, addr string) ([]string, error) {
// Retrieve the port from addr.
_, port, err := net.SplitHostPort(addr)
if err != nil {
return nil, err
}
// Merge the port with the peer hosts into a new slice.
other := make([]string, len(peers))
for i, peer := range peers {
host, _, err :... | [
"func",
"SetPortSlice",
"(",
"peers",
"[",
"]",
"string",
",",
"addr",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Retrieve the port from addr.",
"_",
",",
"port",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"addr",
")",
... | // SetPortSlice sets the ports for a slice of hosts. | [
"SetPortSlice",
"sets",
"the",
"ports",
"for",
"a",
"slice",
"of",
"hosts",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/main.go#L625-L644 | train |
flynn/flynn | controller/client/v1/client.go | GetCACert | func (c *Client) GetCACert() ([]byte, error) {
var cert bytes.Buffer
res, err := c.RawReq("GET", "/ca-cert", nil, nil, nil)
if err != nil {
return nil, err
}
defer res.Body.Close()
if _, err := io.Copy(&cert, res.Body); err != nil {
return nil, err
}
return cert.Bytes(), nil
} | go | func (c *Client) GetCACert() ([]byte, error) {
var cert bytes.Buffer
res, err := c.RawReq("GET", "/ca-cert", nil, nil, nil)
if err != nil {
return nil, err
}
defer res.Body.Close()
if _, err := io.Copy(&cert, res.Body); err != nil {
return nil, err
}
return cert.Bytes(), nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetCACert",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"cert",
"bytes",
".",
"Buffer",
"\n",
"res",
",",
"err",
":=",
"c",
".",
"RawReq",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil"... | // GetCACert returns the CA cert for the controller | [
"GetCACert",
"returns",
"the",
"CA",
"cert",
"for",
"the",
"controller"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L112-L123 | train |
flynn/flynn | controller/client/v1/client.go | PutDomain | func (c *Client) PutDomain(dm *ct.DomainMigration) error {
if dm.Domain == "" {
return errors.New("controller: missing domain")
}
if dm.OldDomain == "" {
return errors.New("controller: missing old domain")
}
return c.Put("/domain", dm, dm)
} | go | func (c *Client) PutDomain(dm *ct.DomainMigration) error {
if dm.Domain == "" {
return errors.New("controller: missing domain")
}
if dm.OldDomain == "" {
return errors.New("controller: missing old domain")
}
return c.Put("/domain", dm, dm)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PutDomain",
"(",
"dm",
"*",
"ct",
".",
"DomainMigration",
")",
"error",
"{",
"if",
"dm",
".",
"Domain",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"... | // PutDomain migrates the cluster domain | [
"PutDomain",
"migrates",
"the",
"cluster",
"domain"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L137-L145 | train |
flynn/flynn | controller/client/v1/client.go | CreateArtifact | func (c *Client) CreateArtifact(artifact *ct.Artifact) error {
return c.Post("/artifacts", artifact, artifact)
} | go | func (c *Client) CreateArtifact(artifact *ct.Artifact) error {
return c.Post("/artifacts", artifact, artifact)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateArtifact",
"(",
"artifact",
"*",
"ct",
".",
"Artifact",
")",
"error",
"{",
"return",
"c",
".",
"Post",
"(",
"\"",
"\"",
",",
"artifact",
",",
"artifact",
")",
"\n",
"}"
] | // CreateArtifact creates a new artifact. | [
"CreateArtifact",
"creates",
"a",
"new",
"artifact",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L148-L150 | train |
flynn/flynn | controller/client/v1/client.go | CreateRelease | func (c *Client) CreateRelease(appID string, release *ct.Release) error {
release.AppID = appID
return c.Post("/releases", release, release)
} | go | func (c *Client) CreateRelease(appID string, release *ct.Release) error {
release.AppID = appID
return c.Post("/releases", release, release)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateRelease",
"(",
"appID",
"string",
",",
"release",
"*",
"ct",
".",
"Release",
")",
"error",
"{",
"release",
".",
"AppID",
"=",
"appID",
"\n",
"return",
"c",
".",
"Post",
"(",
"\"",
"\"",
",",
"release",
"... | // CreateRelease creates a new release. | [
"CreateRelease",
"creates",
"a",
"new",
"release",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L153-L156 | train |
flynn/flynn | controller/client/v1/client.go | CreateApp | func (c *Client) CreateApp(app *ct.App) error {
return c.Post("/apps", app, app)
} | go | func (c *Client) CreateApp(app *ct.App) error {
return c.Post("/apps", app, app)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateApp",
"(",
"app",
"*",
"ct",
".",
"App",
")",
"error",
"{",
"return",
"c",
".",
"Post",
"(",
"\"",
"\"",
",",
"app",
",",
"app",
")",
"\n",
"}"
] | // CreateApp creates a new app. | [
"CreateApp",
"creates",
"a",
"new",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L159-L161 | train |
flynn/flynn | controller/client/v1/client.go | UpdateApp | func (c *Client) UpdateApp(app *ct.App) error {
if app.ID == "" {
return errors.New("controller: missing id")
}
return c.Post(fmt.Sprintf("/apps/%s", app.ID), app, app)
} | go | func (c *Client) UpdateApp(app *ct.App) error {
if app.ID == "" {
return errors.New("controller: missing id")
}
return c.Post(fmt.Sprintf("/apps/%s", app.ID), app, app)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateApp",
"(",
"app",
"*",
"ct",
".",
"App",
")",
"error",
"{",
"if",
"app",
".",
"ID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"c",
".",... | // UpdateApp updates the meta and strategy using app.ID. | [
"UpdateApp",
"updates",
"the",
"meta",
"and",
"strategy",
"using",
"app",
".",
"ID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L164-L169 | train |
flynn/flynn | controller/client/v1/client.go | DeleteApp | func (c *Client) DeleteApp(appID string) (*ct.AppDeletion, error) {
events := make(chan *ct.Event)
stream, err := c.StreamEvents(ct.StreamEventsOptions{
AppID: appID,
ObjectTypes: []ct.EventType{ct.EventTypeAppDeletion},
}, events)
if err != nil {
return nil, err
}
defer stream.Close()
if err := c.D... | go | func (c *Client) DeleteApp(appID string) (*ct.AppDeletion, error) {
events := make(chan *ct.Event)
stream, err := c.StreamEvents(ct.StreamEventsOptions{
AppID: appID,
ObjectTypes: []ct.EventType{ct.EventTypeAppDeletion},
}, events)
if err != nil {
return nil, err
}
defer stream.Close()
if err := c.D... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteApp",
"(",
"appID",
"string",
")",
"(",
"*",
"ct",
".",
"AppDeletion",
",",
"error",
")",
"{",
"events",
":=",
"make",
"(",
"chan",
"*",
"ct",
".",
"Event",
")",
"\n",
"stream",
",",
"err",
":=",
"c",
... | // DeleteApp deletes an app. | [
"DeleteApp",
"deletes",
"an",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L180-L211 | train |
flynn/flynn | controller/client/v1/client.go | CreateProvider | func (c *Client) CreateProvider(provider *ct.Provider) error {
return c.Post("/providers", provider, provider)
} | go | func (c *Client) CreateProvider(provider *ct.Provider) error {
return c.Post("/providers", provider, provider)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateProvider",
"(",
"provider",
"*",
"ct",
".",
"Provider",
")",
"error",
"{",
"return",
"c",
".",
"Post",
"(",
"\"",
"\"",
",",
"provider",
",",
"provider",
")",
"\n",
"}"
] | // CreateProvider creates a new provider. | [
"CreateProvider",
"creates",
"a",
"new",
"provider",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L214-L216 | train |
flynn/flynn | controller/client/v1/client.go | GetProvider | func (c *Client) GetProvider(providerID string) (*ct.Provider, error) {
provider := &ct.Provider{}
return provider, c.Get(fmt.Sprintf("/providers/%s", providerID), provider)
} | go | func (c *Client) GetProvider(providerID string) (*ct.Provider, error) {
provider := &ct.Provider{}
return provider, c.Get(fmt.Sprintf("/providers/%s", providerID), provider)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetProvider",
"(",
"providerID",
"string",
")",
"(",
"*",
"ct",
".",
"Provider",
",",
"error",
")",
"{",
"provider",
":=",
"&",
"ct",
".",
"Provider",
"{",
"}",
"\n",
"return",
"provider",
",",
"c",
".",
"Get"... | // GetProvider returns the provider identified by providerID. | [
"GetProvider",
"returns",
"the",
"provider",
"identified",
"by",
"providerID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L219-L222 | train |
flynn/flynn | controller/client/v1/client.go | ProvisionResource | func (c *Client) ProvisionResource(req *ct.ResourceReq) (*ct.Resource, error) {
if req.ProviderID == "" {
return nil, errors.New("controller: missing provider id")
}
res := &ct.Resource{}
err := c.Post(fmt.Sprintf("/providers/%s/resources", req.ProviderID), req, res)
return res, err
} | go | func (c *Client) ProvisionResource(req *ct.ResourceReq) (*ct.Resource, error) {
if req.ProviderID == "" {
return nil, errors.New("controller: missing provider id")
}
res := &ct.Resource{}
err := c.Post(fmt.Sprintf("/providers/%s/resources", req.ProviderID), req, res)
return res, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ProvisionResource",
"(",
"req",
"*",
"ct",
".",
"ResourceReq",
")",
"(",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"if",
"req",
".",
"ProviderID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors... | // ProvisionResource uses a provider to provision a new resource for the
// application. Returns details about the resource. | [
"ProvisionResource",
"uses",
"a",
"provider",
"to",
"provision",
"a",
"new",
"resource",
"for",
"the",
"application",
".",
"Returns",
"details",
"about",
"the",
"resource",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L226-L233 | train |
flynn/flynn | controller/client/v1/client.go | GetResource | func (c *Client) GetResource(providerID, resourceID string) (*ct.Resource, error) {
res := &ct.Resource{}
err := c.Get(fmt.Sprintf("/providers/%s/resources/%s", providerID, resourceID), res)
return res, err
} | go | func (c *Client) GetResource(providerID, resourceID string) (*ct.Resource, error) {
res := &ct.Resource{}
err := c.Get(fmt.Sprintf("/providers/%s/resources/%s", providerID, resourceID), res)
return res, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetResource",
"(",
"providerID",
",",
"resourceID",
"string",
")",
"(",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"res",
":=",
"&",
"ct",
".",
"Resource",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"Ge... | // GetResource returns the resource identified by resourceID under providerID. | [
"GetResource",
"returns",
"the",
"resource",
"identified",
"by",
"resourceID",
"under",
"providerID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L236-L240 | train |
flynn/flynn | controller/client/v1/client.go | ResourceListAll | func (c *Client) ResourceListAll() ([]*ct.Resource, error) {
var resources []*ct.Resource
return resources, c.Get("/resources", &resources)
} | go | func (c *Client) ResourceListAll() ([]*ct.Resource, error) {
var resources []*ct.Resource
return resources, c.Get("/resources", &resources)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ResourceListAll",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resources",
"[",
"]",
"*",
"ct",
".",
"Resource",
"\n",
"return",
"resources",
",",
"c",
".",
"Get",
"("... | // ResourceListAll returns all resources. | [
"ResourceListAll",
"returns",
"all",
"resources",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L243-L246 | train |
flynn/flynn | controller/client/v1/client.go | ResourceList | func (c *Client) ResourceList(providerID string) ([]*ct.Resource, error) {
var resources []*ct.Resource
return resources, c.Get(fmt.Sprintf("/providers/%s/resources", providerID), &resources)
} | go | func (c *Client) ResourceList(providerID string) ([]*ct.Resource, error) {
var resources []*ct.Resource
return resources, c.Get(fmt.Sprintf("/providers/%s/resources", providerID), &resources)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ResourceList",
"(",
"providerID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resources",
"[",
"]",
"*",
"ct",
".",
"Resource",
"\n",
"return",
"resources",
",",
"... | // ResourceList returns all resources under providerID. | [
"ResourceList",
"returns",
"all",
"resources",
"under",
"providerID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L249-L252 | train |
flynn/flynn | controller/client/v1/client.go | AddResourceApp | func (c *Client) AddResourceApp(providerID, resourceID, appID string) (*ct.Resource, error) {
var resource *ct.Resource
return resource, c.Put(fmt.Sprintf("/providers/%s/resources/%s/apps/%s", providerID, resourceID, appID), nil, &resource)
} | go | func (c *Client) AddResourceApp(providerID, resourceID, appID string) (*ct.Resource, error) {
var resource *ct.Resource
return resource, c.Put(fmt.Sprintf("/providers/%s/resources/%s/apps/%s", providerID, resourceID, appID), nil, &resource)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddResourceApp",
"(",
"providerID",
",",
"resourceID",
",",
"appID",
"string",
")",
"(",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resource",
"*",
"ct",
".",
"Resource",
"\n",
"return",
"resource... | // AddResourceApp adds appID to the resource identified by resourceID and returns the resource | [
"AddResourceApp",
"adds",
"appID",
"to",
"the",
"resource",
"identified",
"by",
"resourceID",
"and",
"returns",
"the",
"resource"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L255-L258 | train |
flynn/flynn | controller/client/v1/client.go | DeleteResourceApp | func (c *Client) DeleteResourceApp(providerID, resourceID, appID string) (*ct.Resource, error) {
var resource *ct.Resource
return resource, c.Delete(fmt.Sprintf("/providers/%s/resources/%s/apps/%s", providerID, resourceID, appID), &resource)
} | go | func (c *Client) DeleteResourceApp(providerID, resourceID, appID string) (*ct.Resource, error) {
var resource *ct.Resource
return resource, c.Delete(fmt.Sprintf("/providers/%s/resources/%s/apps/%s", providerID, resourceID, appID), &resource)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteResourceApp",
"(",
"providerID",
",",
"resourceID",
",",
"appID",
"string",
")",
"(",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resource",
"*",
"ct",
".",
"Resource",
"\n",
"return",
"resou... | // DeleteResourceApp removes appID from the resource identified by resourceID and returns the resource | [
"DeleteResourceApp",
"removes",
"appID",
"from",
"the",
"resource",
"identified",
"by",
"resourceID",
"and",
"returns",
"the",
"resource"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L261-L264 | train |
flynn/flynn | controller/client/v1/client.go | AppResourceList | func (c *Client) AppResourceList(appID string) ([]*ct.Resource, error) {
var resources []*ct.Resource
return resources, c.Get(fmt.Sprintf("/apps/%s/resources", appID), &resources)
} | go | func (c *Client) AppResourceList(appID string) ([]*ct.Resource, error) {
var resources []*ct.Resource
return resources, c.Get(fmt.Sprintf("/apps/%s/resources", appID), &resources)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AppResourceList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resources",
"[",
"]",
"*",
"ct",
".",
"Resource",
"\n",
"return",
"resources",
",",
"c"... | // AppResourceList returns a list of all resources under appID. | [
"AppResourceList",
"returns",
"a",
"list",
"of",
"all",
"resources",
"under",
"appID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L267-L270 | train |
flynn/flynn | controller/client/v1/client.go | PutResource | func (c *Client) PutResource(resource *ct.Resource) error {
if resource.ID == "" || resource.ProviderID == "" {
return errors.New("controller: missing id and/or provider id")
}
return c.Put(fmt.Sprintf("/providers/%s/resources/%s", resource.ProviderID, resource.ID), resource, resource)
} | go | func (c *Client) PutResource(resource *ct.Resource) error {
if resource.ID == "" || resource.ProviderID == "" {
return errors.New("controller: missing id and/or provider id")
}
return c.Put(fmt.Sprintf("/providers/%s/resources/%s", resource.ProviderID, resource.ID), resource, resource)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PutResource",
"(",
"resource",
"*",
"ct",
".",
"Resource",
")",
"error",
"{",
"if",
"resource",
".",
"ID",
"==",
"\"",
"\"",
"||",
"resource",
".",
"ProviderID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
... | // PutResource updates a resource. | [
"PutResource",
"updates",
"a",
"resource",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L273-L278 | train |
flynn/flynn | controller/client/v1/client.go | DeleteResource | func (c *Client) DeleteResource(providerID, resourceID string) (*ct.Resource, error) {
res := &ct.Resource{}
err := c.Delete(fmt.Sprintf("/providers/%s/resources/%s", providerID, resourceID), res)
return res, err
} | go | func (c *Client) DeleteResource(providerID, resourceID string) (*ct.Resource, error) {
res := &ct.Resource{}
err := c.Delete(fmt.Sprintf("/providers/%s/resources/%s", providerID, resourceID), res)
return res, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteResource",
"(",
"providerID",
",",
"resourceID",
"string",
")",
"(",
"*",
"ct",
".",
"Resource",
",",
"error",
")",
"{",
"res",
":=",
"&",
"ct",
".",
"Resource",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
... | // DeleteResource deprovisions and deletes the resource identified by resourceID under providerID. | [
"DeleteResource",
"deprovisions",
"and",
"deletes",
"the",
"resource",
"identified",
"by",
"resourceID",
"under",
"providerID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L281-L285 | train |
flynn/flynn | controller/client/v1/client.go | PutFormation | func (c *Client) PutFormation(formation *ct.Formation) error {
if formation.AppID == "" || formation.ReleaseID == "" {
return errors.New("controller: missing app id and/or release id")
}
return c.Put(fmt.Sprintf("/apps/%s/formations/%s", formation.AppID, formation.ReleaseID), formation, formation)
} | go | func (c *Client) PutFormation(formation *ct.Formation) error {
if formation.AppID == "" || formation.ReleaseID == "" {
return errors.New("controller: missing app id and/or release id")
}
return c.Put(fmt.Sprintf("/apps/%s/formations/%s", formation.AppID, formation.ReleaseID), formation, formation)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PutFormation",
"(",
"formation",
"*",
"ct",
".",
"Formation",
")",
"error",
"{",
"if",
"formation",
".",
"AppID",
"==",
"\"",
"\"",
"||",
"formation",
".",
"ReleaseID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
... | // PutFormation updates an existing formation. | [
"PutFormation",
"updates",
"an",
"existing",
"formation",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L389-L394 | train |
flynn/flynn | controller/client/v1/client.go | PutJob | func (c *Client) PutJob(job *ct.Job) error {
if job.UUID == "" || job.AppID == "" {
return errors.New("controller: missing job uuid and/or app id")
}
return c.Put(fmt.Sprintf("/apps/%s/jobs/%s", job.AppID, job.UUID), job, job)
} | go | func (c *Client) PutJob(job *ct.Job) error {
if job.UUID == "" || job.AppID == "" {
return errors.New("controller: missing job uuid and/or app id")
}
return c.Put(fmt.Sprintf("/apps/%s/jobs/%s", job.AppID, job.UUID), job, job)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PutJob",
"(",
"job",
"*",
"ct",
".",
"Job",
")",
"error",
"{",
"if",
"job",
".",
"UUID",
"==",
"\"",
"\"",
"||",
"job",
".",
"AppID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"... | // PutJob updates an existing job. | [
"PutJob",
"updates",
"an",
"existing",
"job",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L397-L402 | train |
flynn/flynn | controller/client/v1/client.go | DeleteJob | func (c *Client) DeleteJob(appID, jobID string) error {
return c.Delete(fmt.Sprintf("/apps/%s/jobs/%s", appID, jobID), nil)
} | go | func (c *Client) DeleteJob(appID, jobID string) error {
return c.Delete(fmt.Sprintf("/apps/%s/jobs/%s", appID, jobID), nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteJob",
"(",
"appID",
",",
"jobID",
"string",
")",
"error",
"{",
"return",
"c",
".",
"Delete",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
",",
"jobID",
")",
",",
"nil",
")",
"\n",
"}"
] | // DeleteJob kills a specific job id under the specified app. | [
"DeleteJob",
"kills",
"a",
"specific",
"job",
"id",
"under",
"the",
"specified",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L405-L407 | train |
flynn/flynn | controller/client/v1/client.go | SetAppRelease | func (c *Client) SetAppRelease(appID, releaseID string) error {
return c.Put(fmt.Sprintf("/apps/%s/release", appID), &ct.Release{ID: releaseID}, nil)
} | go | func (c *Client) SetAppRelease(appID, releaseID string) error {
return c.Put(fmt.Sprintf("/apps/%s/release", appID), &ct.Release{ID: releaseID}, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetAppRelease",
"(",
"appID",
",",
"releaseID",
"string",
")",
"error",
"{",
"return",
"c",
".",
"Put",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
")",
",",
"&",
"ct",
".",
"Release",
"{",
"I... | // SetAppRelease sets the specified release as the current release for an app. | [
"SetAppRelease",
"sets",
"the",
"specified",
"release",
"as",
"the",
"current",
"release",
"for",
"an",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L410-L412 | train |
flynn/flynn | controller/client/v1/client.go | GetAppRelease | func (c *Client) GetAppRelease(appID string) (*ct.Release, error) {
release := &ct.Release{}
return release, c.Get(fmt.Sprintf("/apps/%s/release", appID), release)
} | go | func (c *Client) GetAppRelease(appID string) (*ct.Release, error) {
release := &ct.Release{}
return release, c.Get(fmt.Sprintf("/apps/%s/release", appID), release)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAppRelease",
"(",
"appID",
"string",
")",
"(",
"*",
"ct",
".",
"Release",
",",
"error",
")",
"{",
"release",
":=",
"&",
"ct",
".",
"Release",
"{",
"}",
"\n",
"return",
"release",
",",
"c",
".",
"Get",
"("... | // GetAppRelease returns the current release of an app. | [
"GetAppRelease",
"returns",
"the",
"current",
"release",
"of",
"an",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L415-L418 | train |
flynn/flynn | controller/client/v1/client.go | RouteList | func (c *Client) RouteList(appID string) ([]*router.Route, error) {
var routes []*router.Route
return routes, c.Get(fmt.Sprintf("/apps/%s/routes", appID), &routes)
} | go | func (c *Client) RouteList(appID string) ([]*router.Route, error) {
var routes []*router.Route
return routes, c.Get(fmt.Sprintf("/apps/%s/routes", appID), &routes)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RouteList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"router",
".",
"Route",
",",
"error",
")",
"{",
"var",
"routes",
"[",
"]",
"*",
"router",
".",
"Route",
"\n",
"return",
"routes",
",",
"c",
".",
... | // RouteList returns all routes for an app. | [
"RouteList",
"returns",
"all",
"routes",
"for",
"an",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L421-L424 | train |
flynn/flynn | controller/client/v1/client.go | GetRoute | func (c *Client) GetRoute(appID string, routeID string) (*router.Route, error) {
route := &router.Route{}
return route, c.Get(fmt.Sprintf("/apps/%s/routes/%s", appID, routeID), route)
} | go | func (c *Client) GetRoute(appID string, routeID string) (*router.Route, error) {
route := &router.Route{}
return route, c.Get(fmt.Sprintf("/apps/%s/routes/%s", appID, routeID), route)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRoute",
"(",
"appID",
"string",
",",
"routeID",
"string",
")",
"(",
"*",
"router",
".",
"Route",
",",
"error",
")",
"{",
"route",
":=",
"&",
"router",
".",
"Route",
"{",
"}",
"\n",
"return",
"route",
",",
... | // GetRoute returns details for the routeID under the specified app. | [
"GetRoute",
"returns",
"details",
"for",
"the",
"routeID",
"under",
"the",
"specified",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L427-L430 | train |
flynn/flynn | controller/client/v1/client.go | CreateRoute | func (c *Client) CreateRoute(appID string, route *router.Route) error {
return c.Post(fmt.Sprintf("/apps/%s/routes", appID), route, route)
} | go | func (c *Client) CreateRoute(appID string, route *router.Route) error {
return c.Post(fmt.Sprintf("/apps/%s/routes", appID), route, route)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateRoute",
"(",
"appID",
"string",
",",
"route",
"*",
"router",
".",
"Route",
")",
"error",
"{",
"return",
"c",
".",
"Post",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
")",
",",
"route",
"... | // CreateRoute creates a new route for the specified app. | [
"CreateRoute",
"creates",
"a",
"new",
"route",
"for",
"the",
"specified",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L433-L435 | train |
flynn/flynn | controller/client/v1/client.go | UpdateRoute | func (c *Client) UpdateRoute(appID string, routeID string, route *router.Route) error {
return c.Put(fmt.Sprintf("/apps/%s/routes/%s", appID, routeID), route, route)
} | go | func (c *Client) UpdateRoute(appID string, routeID string, route *router.Route) error {
return c.Put(fmt.Sprintf("/apps/%s/routes/%s", appID, routeID), route, route)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateRoute",
"(",
"appID",
"string",
",",
"routeID",
"string",
",",
"route",
"*",
"router",
".",
"Route",
")",
"error",
"{",
"return",
"c",
".",
"Put",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID... | // UpdateRoute updates details for the routeID under the specified app. | [
"UpdateRoute",
"updates",
"details",
"for",
"the",
"routeID",
"under",
"the",
"specified",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L438-L440 | train |
flynn/flynn | controller/client/v1/client.go | DeleteRoute | func (c *Client) DeleteRoute(appID string, routeID string) error {
return c.Delete(fmt.Sprintf("/apps/%s/routes/%s", appID, routeID), nil)
} | go | func (c *Client) DeleteRoute(appID string, routeID string) error {
return c.Delete(fmt.Sprintf("/apps/%s/routes/%s", appID, routeID), nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteRoute",
"(",
"appID",
"string",
",",
"routeID",
"string",
")",
"error",
"{",
"return",
"c",
".",
"Delete",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
",",
"routeID",
")",
",",
"nil",
")",... | // DeleteRoute deletes a route under the specified app. | [
"DeleteRoute",
"deletes",
"a",
"route",
"under",
"the",
"specified",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L443-L445 | train |
flynn/flynn | controller/client/v1/client.go | GetFormation | func (c *Client) GetFormation(appID, releaseID string) (*ct.Formation, error) {
formation := &ct.Formation{}
return formation, c.Get(fmt.Sprintf("/apps/%s/formations/%s", appID, releaseID), formation)
} | go | func (c *Client) GetFormation(appID, releaseID string) (*ct.Formation, error) {
formation := &ct.Formation{}
return formation, c.Get(fmt.Sprintf("/apps/%s/formations/%s", appID, releaseID), formation)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetFormation",
"(",
"appID",
",",
"releaseID",
"string",
")",
"(",
"*",
"ct",
".",
"Formation",
",",
"error",
")",
"{",
"formation",
":=",
"&",
"ct",
".",
"Formation",
"{",
"}",
"\n",
"return",
"formation",
",",... | // GetFormation returns details for the specified formation under app and
// release. | [
"GetFormation",
"returns",
"details",
"for",
"the",
"specified",
"formation",
"under",
"app",
"and",
"release",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L449-L452 | train |
flynn/flynn | controller/client/v1/client.go | GetExpandedFormation | func (c *Client) GetExpandedFormation(appID, releaseID string) (*ct.ExpandedFormation, error) {
formation := &ct.ExpandedFormation{}
return formation, c.Get(fmt.Sprintf("/apps/%s/formations/%s?expand=true", appID, releaseID), formation)
} | go | func (c *Client) GetExpandedFormation(appID, releaseID string) (*ct.ExpandedFormation, error) {
formation := &ct.ExpandedFormation{}
return formation, c.Get(fmt.Sprintf("/apps/%s/formations/%s?expand=true", appID, releaseID), formation)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetExpandedFormation",
"(",
"appID",
",",
"releaseID",
"string",
")",
"(",
"*",
"ct",
".",
"ExpandedFormation",
",",
"error",
")",
"{",
"formation",
":=",
"&",
"ct",
".",
"ExpandedFormation",
"{",
"}",
"\n",
"return... | // GetExpandedFormation returns expanded details for the specified formation
// under app and release. | [
"GetExpandedFormation",
"returns",
"expanded",
"details",
"for",
"the",
"specified",
"formation",
"under",
"app",
"and",
"release",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L456-L459 | train |
flynn/flynn | controller/client/v1/client.go | FormationList | func (c *Client) FormationList(appID string) ([]*ct.Formation, error) {
var formations []*ct.Formation
return formations, c.Get(fmt.Sprintf("/apps/%s/formations", appID), &formations)
} | go | func (c *Client) FormationList(appID string) ([]*ct.Formation, error) {
var formations []*ct.Formation
return formations, c.Get(fmt.Sprintf("/apps/%s/formations", appID), &formations)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"FormationList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Formation",
",",
"error",
")",
"{",
"var",
"formations",
"[",
"]",
"*",
"ct",
".",
"Formation",
"\n",
"return",
"formations",
",",
"... | // FormationList returns a list of all formations under appID. | [
"FormationList",
"returns",
"a",
"list",
"of",
"all",
"formations",
"under",
"appID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L462-L465 | train |
flynn/flynn | controller/client/v1/client.go | DeleteFormation | func (c *Client) DeleteFormation(appID, releaseID string) error {
return c.Delete(fmt.Sprintf("/apps/%s/formations/%s", appID, releaseID), nil)
} | go | func (c *Client) DeleteFormation(appID, releaseID string) error {
return c.Delete(fmt.Sprintf("/apps/%s/formations/%s", appID, releaseID), nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteFormation",
"(",
"appID",
",",
"releaseID",
"string",
")",
"error",
"{",
"return",
"c",
".",
"Delete",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
",",
"releaseID",
")",
",",
"nil",
")",
"... | // DeleteFormation deletes the formation matching appID and releaseID. | [
"DeleteFormation",
"deletes",
"the",
"formation",
"matching",
"appID",
"and",
"releaseID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L475-L477 | train |
flynn/flynn | controller/client/v1/client.go | GetRelease | func (c *Client) GetRelease(releaseID string) (*ct.Release, error) {
release := &ct.Release{}
return release, c.Get(fmt.Sprintf("/releases/%s", releaseID), release)
} | go | func (c *Client) GetRelease(releaseID string) (*ct.Release, error) {
release := &ct.Release{}
return release, c.Get(fmt.Sprintf("/releases/%s", releaseID), release)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRelease",
"(",
"releaseID",
"string",
")",
"(",
"*",
"ct",
".",
"Release",
",",
"error",
")",
"{",
"release",
":=",
"&",
"ct",
".",
"Release",
"{",
"}",
"\n",
"return",
"release",
",",
"c",
".",
"Get",
"(... | // GetRelease returns details for the specified release. | [
"GetRelease",
"returns",
"details",
"for",
"the",
"specified",
"release",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L480-L483 | train |
flynn/flynn | controller/client/v1/client.go | GetArtifact | func (c *Client) GetArtifact(artifactID string) (*ct.Artifact, error) {
artifact := &ct.Artifact{}
return artifact, c.Get(fmt.Sprintf("/artifacts/%s", artifactID), artifact)
} | go | func (c *Client) GetArtifact(artifactID string) (*ct.Artifact, error) {
artifact := &ct.Artifact{}
return artifact, c.Get(fmt.Sprintf("/artifacts/%s", artifactID), artifact)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetArtifact",
"(",
"artifactID",
"string",
")",
"(",
"*",
"ct",
".",
"Artifact",
",",
"error",
")",
"{",
"artifact",
":=",
"&",
"ct",
".",
"Artifact",
"{",
"}",
"\n",
"return",
"artifact",
",",
"c",
".",
"Get"... | // GetArtifact returns details for the specified artifact. | [
"GetArtifact",
"returns",
"details",
"for",
"the",
"specified",
"artifact",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L486-L489 | train |
flynn/flynn | controller/client/v1/client.go | GetApp | func (c *Client) GetApp(appID string) (*ct.App, error) {
app := &ct.App{}
return app, c.Get(fmt.Sprintf("/apps/%s", appID), app)
} | go | func (c *Client) GetApp(appID string) (*ct.App, error) {
app := &ct.App{}
return app, c.Get(fmt.Sprintf("/apps/%s", appID), app)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetApp",
"(",
"appID",
"string",
")",
"(",
"*",
"ct",
".",
"App",
",",
"error",
")",
"{",
"app",
":=",
"&",
"ct",
".",
"App",
"{",
"}",
"\n",
"return",
"app",
",",
"c",
".",
"Get",
"(",
"fmt",
".",
"Sp... | // GetApp returns details for the specified app. | [
"GetApp",
"returns",
"details",
"for",
"the",
"specified",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L492-L495 | train |
flynn/flynn | controller/client/v1/client.go | GetAppLog | func (c *Client) GetAppLog(appID string, opts *logagg.LogOpts) (io.ReadCloser, error) {
path := fmt.Sprintf("/apps/%s/log", appID)
if opts != nil {
if encodedQuery := opts.EncodedQuery(); encodedQuery != "" {
path = fmt.Sprintf("%s?%s", path, encodedQuery)
}
}
res, err := c.RawReq("GET", path, nil, nil, nil)... | go | func (c *Client) GetAppLog(appID string, opts *logagg.LogOpts) (io.ReadCloser, error) {
path := fmt.Sprintf("/apps/%s/log", appID)
if opts != nil {
if encodedQuery := opts.EncodedQuery(); encodedQuery != "" {
path = fmt.Sprintf("%s?%s", path, encodedQuery)
}
}
res, err := c.RawReq("GET", path, nil, nil, nil)... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAppLog",
"(",
"appID",
"string",
",",
"opts",
"*",
"logagg",
".",
"LogOpts",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
... | // GetAppLog returns a ReadCloser log stream of the app with ID appID. If lines
// is zero or above, the number of lines returned will be capped at that value.
// Otherwise, all available logs are returned. If follow is true, new log lines
// are streamed after the buffered log. | [
"GetAppLog",
"returns",
"a",
"ReadCloser",
"log",
"stream",
"of",
"the",
"app",
"with",
"ID",
"appID",
".",
"If",
"lines",
"is",
"zero",
"or",
"above",
"the",
"number",
"of",
"lines",
"returned",
"will",
"be",
"capped",
"at",
"that",
"value",
".",
"Other... | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L501-L513 | train |
flynn/flynn | controller/client/v1/client.go | StreamAppLog | func (c *Client) StreamAppLog(appID string, opts *logagg.LogOpts, output chan<- *ct.SSELogChunk) (stream.Stream, error) {
path := fmt.Sprintf("/apps/%s/log", appID)
if opts != nil {
if encodedQuery := opts.EncodedQuery(); encodedQuery != "" {
path = fmt.Sprintf("%s?%s", path, encodedQuery)
}
}
return c.Strea... | go | func (c *Client) StreamAppLog(appID string, opts *logagg.LogOpts, output chan<- *ct.SSELogChunk) (stream.Stream, error) {
path := fmt.Sprintf("/apps/%s/log", appID)
if opts != nil {
if encodedQuery := opts.EncodedQuery(); encodedQuery != "" {
path = fmt.Sprintf("%s?%s", path, encodedQuery)
}
}
return c.Strea... | [
"func",
"(",
"c",
"*",
"Client",
")",
"StreamAppLog",
"(",
"appID",
"string",
",",
"opts",
"*",
"logagg",
".",
"LogOpts",
",",
"output",
"chan",
"<-",
"*",
"ct",
".",
"SSELogChunk",
")",
"(",
"stream",
".",
"Stream",
",",
"error",
")",
"{",
"path",
... | // StreamAppLog is the same as GetAppLog but returns log lines via an SSE stream | [
"StreamAppLog",
"is",
"the",
"same",
"as",
"GetAppLog",
"but",
"returns",
"log",
"lines",
"via",
"an",
"SSE",
"stream"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L516-L524 | train |
flynn/flynn | controller/client/v1/client.go | GetDeployment | func (c *Client) GetDeployment(deploymentID string) (*ct.Deployment, error) {
res := &ct.Deployment{}
return res, c.Get(fmt.Sprintf("/deployments/%s", deploymentID), res)
} | go | func (c *Client) GetDeployment(deploymentID string) (*ct.Deployment, error) {
res := &ct.Deployment{}
return res, c.Get(fmt.Sprintf("/deployments/%s", deploymentID), res)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDeployment",
"(",
"deploymentID",
"string",
")",
"(",
"*",
"ct",
".",
"Deployment",
",",
"error",
")",
"{",
"res",
":=",
"&",
"ct",
".",
"Deployment",
"{",
"}",
"\n",
"return",
"res",
",",
"c",
".",
"Get",
... | // GetDeployment returns a deployment queued on the deployer. | [
"GetDeployment",
"returns",
"a",
"deployment",
"queued",
"on",
"the",
"deployer",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L527-L530 | train |
flynn/flynn | controller/client/v1/client.go | DeploymentList | func (c *Client) DeploymentList(appID string) ([]*ct.Deployment, error) {
var deployments []*ct.Deployment
return deployments, c.Get(fmt.Sprintf("/apps/%s/deployments", appID), &deployments)
} | go | func (c *Client) DeploymentList(appID string) ([]*ct.Deployment, error) {
var deployments []*ct.Deployment
return deployments, c.Get(fmt.Sprintf("/apps/%s/deployments", appID), &deployments)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeploymentList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Deployment",
",",
"error",
")",
"{",
"var",
"deployments",
"[",
"]",
"*",
"ct",
".",
"Deployment",
"\n",
"return",
"deployments",
","... | // DeploymentList returns a list of all deployments. | [
"DeploymentList",
"returns",
"a",
"list",
"of",
"all",
"deployments",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L538-L541 | train |
flynn/flynn | controller/client/v1/client.go | StreamJobEvents | func (c *Client) StreamJobEvents(appID string, output chan *ct.Job) (stream.Stream, error) {
appEvents := make(chan *ct.Event)
go convertEvents(appEvents, output)
return c.StreamEvents(ct.StreamEventsOptions{
AppID: appID,
ObjectTypes: []ct.EventType{ct.EventTypeJob},
}, appEvents)
} | go | func (c *Client) StreamJobEvents(appID string, output chan *ct.Job) (stream.Stream, error) {
appEvents := make(chan *ct.Event)
go convertEvents(appEvents, output)
return c.StreamEvents(ct.StreamEventsOptions{
AppID: appID,
ObjectTypes: []ct.EventType{ct.EventTypeJob},
}, appEvents)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"StreamJobEvents",
"(",
"appID",
"string",
",",
"output",
"chan",
"*",
"ct",
".",
"Job",
")",
"(",
"stream",
".",
"Stream",
",",
"error",
")",
"{",
"appEvents",
":=",
"make",
"(",
"chan",
"*",
"ct",
".",
"Event... | // StreamJobEvents streams job events to the output channel. | [
"StreamJobEvents",
"streams",
"job",
"events",
"to",
"the",
"output",
"channel",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L611-L618 | train |
flynn/flynn | controller/client/v1/client.go | RunJobAttached | func (c *Client) RunJobAttached(appID string, job *ct.NewJob) (httpclient.ReadWriteCloser, error) {
return c.Hijack("POST", fmt.Sprintf("/apps/%s/jobs", appID), http.Header{"Upgrade": {"flynn-attach/0"}}, job)
} | go | func (c *Client) RunJobAttached(appID string, job *ct.NewJob) (httpclient.ReadWriteCloser, error) {
return c.Hijack("POST", fmt.Sprintf("/apps/%s/jobs", appID), http.Header{"Upgrade": {"flynn-attach/0"}}, job)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RunJobAttached",
"(",
"appID",
"string",
",",
"job",
"*",
"ct",
".",
"NewJob",
")",
"(",
"httpclient",
".",
"ReadWriteCloser",
",",
"error",
")",
"{",
"return",
"c",
".",
"Hijack",
"(",
"\"",
"\"",
",",
"fmt",
... | // RunJobAttached runs a new job under the specified app, attaching to the job
// and returning a ReadWriteCloser stream, which can then be used for
// communicating with the job. | [
"RunJobAttached",
"runs",
"a",
"new",
"job",
"under",
"the",
"specified",
"app",
"attaching",
"to",
"the",
"job",
"and",
"returning",
"a",
"ReadWriteCloser",
"stream",
"which",
"can",
"then",
"be",
"used",
"for",
"communicating",
"with",
"the",
"job",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L724-L726 | train |
flynn/flynn | controller/client/v1/client.go | RunJobDetached | func (c *Client) RunJobDetached(appID string, req *ct.NewJob) (*ct.Job, error) {
job := &ct.Job{}
return job, c.Post(fmt.Sprintf("/apps/%s/jobs", appID), req, job)
} | go | func (c *Client) RunJobDetached(appID string, req *ct.NewJob) (*ct.Job, error) {
job := &ct.Job{}
return job, c.Post(fmt.Sprintf("/apps/%s/jobs", appID), req, job)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RunJobDetached",
"(",
"appID",
"string",
",",
"req",
"*",
"ct",
".",
"NewJob",
")",
"(",
"*",
"ct",
".",
"Job",
",",
"error",
")",
"{",
"job",
":=",
"&",
"ct",
".",
"Job",
"{",
"}",
"\n",
"return",
"job",
... | // RunJobDetached runs a new job under the specified app, returning the job's
// details. | [
"RunJobDetached",
"runs",
"a",
"new",
"job",
"under",
"the",
"specified",
"app",
"returning",
"the",
"job",
"s",
"details",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L730-L733 | train |
flynn/flynn | controller/client/v1/client.go | GetJob | func (c *Client) GetJob(appID, jobID string) (*ct.Job, error) {
job := &ct.Job{}
return job, c.Get(fmt.Sprintf("/apps/%s/jobs/%s", appID, jobID), job)
} | go | func (c *Client) GetJob(appID, jobID string) (*ct.Job, error) {
job := &ct.Job{}
return job, c.Get(fmt.Sprintf("/apps/%s/jobs/%s", appID, jobID), job)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetJob",
"(",
"appID",
",",
"jobID",
"string",
")",
"(",
"*",
"ct",
".",
"Job",
",",
"error",
")",
"{",
"job",
":=",
"&",
"ct",
".",
"Job",
"{",
"}",
"\n",
"return",
"job",
",",
"c",
".",
"Get",
"(",
"... | // GetJob returns a Job for the given app and job ID | [
"GetJob",
"returns",
"a",
"Job",
"for",
"the",
"given",
"app",
"and",
"job",
"ID"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L736-L739 | train |
flynn/flynn | controller/client/v1/client.go | JobList | func (c *Client) JobList(appID string) ([]*ct.Job, error) {
var jobs []*ct.Job
return jobs, c.Get(fmt.Sprintf("/apps/%s/jobs", appID), &jobs)
} | go | func (c *Client) JobList(appID string) ([]*ct.Job, error) {
var jobs []*ct.Job
return jobs, c.Get(fmt.Sprintf("/apps/%s/jobs", appID), &jobs)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"JobList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Job",
",",
"error",
")",
"{",
"var",
"jobs",
"[",
"]",
"*",
"ct",
".",
"Job",
"\n",
"return",
"jobs",
",",
"c",
".",
"Get",
"(",
"... | // JobList returns a list of all jobs. | [
"JobList",
"returns",
"a",
"list",
"of",
"all",
"jobs",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L742-L745 | train |
flynn/flynn | controller/client/v1/client.go | JobListActive | func (c *Client) JobListActive() ([]*ct.Job, error) {
var jobs []*ct.Job
return jobs, c.Get("/active-jobs", &jobs)
} | go | func (c *Client) JobListActive() ([]*ct.Job, error) {
var jobs []*ct.Job
return jobs, c.Get("/active-jobs", &jobs)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"JobListActive",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Job",
",",
"error",
")",
"{",
"var",
"jobs",
"[",
"]",
"*",
"ct",
".",
"Job",
"\n",
"return",
"jobs",
",",
"c",
".",
"Get",
"(",
"\"",
"\"",
",... | // JobListActive returns a list of all active jobs. | [
"JobListActive",
"returns",
"a",
"list",
"of",
"all",
"active",
"jobs",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L748-L751 | train |
flynn/flynn | controller/client/v1/client.go | AppList | func (c *Client) AppList() ([]*ct.App, error) {
var apps []*ct.App
return apps, c.Get("/apps", &apps)
} | go | func (c *Client) AppList() ([]*ct.App, error) {
var apps []*ct.App
return apps, c.Get("/apps", &apps)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AppList",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"App",
",",
"error",
")",
"{",
"var",
"apps",
"[",
"]",
"*",
"ct",
".",
"App",
"\n",
"return",
"apps",
",",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"... | // AppList returns a list of all apps. | [
"AppList",
"returns",
"a",
"list",
"of",
"all",
"apps",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L754-L757 | train |
flynn/flynn | controller/client/v1/client.go | ArtifactList | func (c *Client) ArtifactList() ([]*ct.Artifact, error) {
var artifacts []*ct.Artifact
return artifacts, c.Get("/artifacts", &artifacts)
} | go | func (c *Client) ArtifactList() ([]*ct.Artifact, error) {
var artifacts []*ct.Artifact
return artifacts, c.Get("/artifacts", &artifacts)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ArtifactList",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Artifact",
",",
"error",
")",
"{",
"var",
"artifacts",
"[",
"]",
"*",
"ct",
".",
"Artifact",
"\n",
"return",
"artifacts",
",",
"c",
".",
"Get",
"(",
... | // ArtifactList returns a list of all artifacts | [
"ArtifactList",
"returns",
"a",
"list",
"of",
"all",
"artifacts"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L760-L763 | train |
flynn/flynn | controller/client/v1/client.go | ReleaseList | func (c *Client) ReleaseList() ([]*ct.Release, error) {
var releases []*ct.Release
return releases, c.Get("/releases", &releases)
} | go | func (c *Client) ReleaseList() ([]*ct.Release, error) {
var releases []*ct.Release
return releases, c.Get("/releases", &releases)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ReleaseList",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Release",
",",
"error",
")",
"{",
"var",
"releases",
"[",
"]",
"*",
"ct",
".",
"Release",
"\n",
"return",
"releases",
",",
"c",
".",
"Get",
"(",
"\""... | // ReleaseList returns a list of all releases | [
"ReleaseList",
"returns",
"a",
"list",
"of",
"all",
"releases"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L766-L769 | train |
flynn/flynn | controller/client/v1/client.go | AppReleaseList | func (c *Client) AppReleaseList(appID string) ([]*ct.Release, error) {
var releases []*ct.Release
return releases, c.Get(fmt.Sprintf("/apps/%s/releases", appID), &releases)
} | go | func (c *Client) AppReleaseList(appID string) ([]*ct.Release, error) {
var releases []*ct.Release
return releases, c.Get(fmt.Sprintf("/apps/%s/releases", appID), &releases)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AppReleaseList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Release",
",",
"error",
")",
"{",
"var",
"releases",
"[",
"]",
"*",
"ct",
".",
"Release",
"\n",
"return",
"releases",
",",
"c",
"... | // AppReleaseList returns a list of all releases under appID. | [
"AppReleaseList",
"returns",
"a",
"list",
"of",
"all",
"releases",
"under",
"appID",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L772-L775 | train |
flynn/flynn | controller/client/v1/client.go | ProviderList | func (c *Client) ProviderList() ([]*ct.Provider, error) {
var providers []*ct.Provider
return providers, c.Get("/providers", &providers)
} | go | func (c *Client) ProviderList() ([]*ct.Provider, error) {
var providers []*ct.Provider
return providers, c.Get("/providers", &providers)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ProviderList",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Provider",
",",
"error",
")",
"{",
"var",
"providers",
"[",
"]",
"*",
"ct",
".",
"Provider",
"\n",
"return",
"providers",
",",
"c",
".",
"Get",
"(",
... | // ProviderList returns a list of all providers. | [
"ProviderList",
"returns",
"a",
"list",
"of",
"all",
"providers",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L778-L781 | train |
flynn/flynn | controller/client/v1/client.go | GetVolume | func (c *Client) GetVolume(appID, id string) (*ct.Volume, error) {
if appID == "" {
return nil, errors.New("controller: missing app ID")
}
if id == "" {
return nil, errors.New("controller: missing id")
}
vol := &ct.Volume{}
return vol, c.Get(fmt.Sprintf("/apps/%s/volumes/%s", appID, id), vol)
} | go | func (c *Client) GetVolume(appID, id string) (*ct.Volume, error) {
if appID == "" {
return nil, errors.New("controller: missing app ID")
}
if id == "" {
return nil, errors.New("controller: missing id")
}
vol := &ct.Volume{}
return vol, c.Get(fmt.Sprintf("/apps/%s/volumes/%s", appID, id), vol)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetVolume",
"(",
"appID",
",",
"id",
"string",
")",
"(",
"*",
"ct",
".",
"Volume",
",",
"error",
")",
"{",
"if",
"appID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",... | // GetVolume returns a Volume for the given volume ID | [
"GetVolume",
"returns",
"a",
"Volume",
"for",
"the",
"given",
"volume",
"ID"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L784-L793 | train |
flynn/flynn | controller/client/v1/client.go | PutVolume | func (c *Client) PutVolume(vol *ct.Volume) error {
if vol.ID == "" {
return errors.New("controller: missing id")
}
return c.Put(fmt.Sprintf("/volumes/%s", vol.ID), vol, vol)
} | go | func (c *Client) PutVolume(vol *ct.Volume) error {
if vol.ID == "" {
return errors.New("controller: missing id")
}
return c.Put(fmt.Sprintf("/volumes/%s", vol.ID), vol, vol)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PutVolume",
"(",
"vol",
"*",
"ct",
".",
"Volume",
")",
"error",
"{",
"if",
"vol",
".",
"ID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"c",
"... | // PutVolume updates an existing volume. | [
"PutVolume",
"updates",
"an",
"existing",
"volume",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L796-L801 | train |
flynn/flynn | controller/client/v1/client.go | VolumeList | func (c *Client) VolumeList() ([]*ct.Volume, error) {
var volumes []*ct.Volume
return volumes, c.Get("/volumes", &volumes)
} | go | func (c *Client) VolumeList() ([]*ct.Volume, error) {
var volumes []*ct.Volume
return volumes, c.Get("/volumes", &volumes)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"VolumeList",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Volume",
",",
"error",
")",
"{",
"var",
"volumes",
"[",
"]",
"*",
"ct",
".",
"Volume",
"\n",
"return",
"volumes",
",",
"c",
".",
"Get",
"(",
"\"",
"... | // VolumeList returns a list of all volumes. | [
"VolumeList",
"returns",
"a",
"list",
"of",
"all",
"volumes",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L804-L807 | train |
flynn/flynn | controller/client/v1/client.go | AppVolumeList | func (c *Client) AppVolumeList(appID string) ([]*ct.Volume, error) {
if appID == "" {
return nil, errors.New("controller: missing app ID")
}
var volumes []*ct.Volume
return volumes, c.Get(fmt.Sprintf("/apps/%s/volumes", appID), &volumes)
} | go | func (c *Client) AppVolumeList(appID string) ([]*ct.Volume, error) {
if appID == "" {
return nil, errors.New("controller: missing app ID")
}
var volumes []*ct.Volume
return volumes, c.Get(fmt.Sprintf("/apps/%s/volumes", appID), &volumes)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AppVolumeList",
"(",
"appID",
"string",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Volume",
",",
"error",
")",
"{",
"if",
"appID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\... | // AppVolumeList returns a list of all volumes for an app. | [
"AppVolumeList",
"returns",
"a",
"list",
"of",
"all",
"volumes",
"for",
"an",
"app",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L810-L816 | train |
flynn/flynn | controller/client/v1/client.go | DecommissionVolume | func (c *Client) DecommissionVolume(appID string, vol *ct.Volume) error {
if appID == "" {
return errors.New("controller: missing app ID")
}
if vol.ID == "" {
return errors.New("controller: missing id")
}
return c.Put(fmt.Sprintf("/apps/%s/volumes/%s/decommission", appID, vol.ID), &vol, &vol)
} | go | func (c *Client) DecommissionVolume(appID string, vol *ct.Volume) error {
if appID == "" {
return errors.New("controller: missing app ID")
}
if vol.ID == "" {
return errors.New("controller: missing id")
}
return c.Put(fmt.Sprintf("/apps/%s/volumes/%s/decommission", appID, vol.ID), &vol, &vol)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DecommissionVolume",
"(",
"appID",
"string",
",",
"vol",
"*",
"ct",
".",
"Volume",
")",
"error",
"{",
"if",
"appID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\... | // DecommissionVolume decommissions a volume | [
"DecommissionVolume",
"decommissions",
"a",
"volume"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L819-L827 | train |
flynn/flynn | controller/client/v1/client.go | StreamVolumes | func (c *Client) StreamVolumes(since *time.Time, output chan *ct.Volume) (stream.Stream, error) {
if since == nil {
s := time.Unix(0, 0)
since = &s
}
t := since.UTC().Format(time.RFC3339Nano)
return c.Stream("GET", "/volumes?since="+t, nil, output)
} | go | func (c *Client) StreamVolumes(since *time.Time, output chan *ct.Volume) (stream.Stream, error) {
if since == nil {
s := time.Unix(0, 0)
since = &s
}
t := since.UTC().Format(time.RFC3339Nano)
return c.Stream("GET", "/volumes?since="+t, nil, output)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"StreamVolumes",
"(",
"since",
"*",
"time",
".",
"Time",
",",
"output",
"chan",
"*",
"ct",
".",
"Volume",
")",
"(",
"stream",
".",
"Stream",
",",
"error",
")",
"{",
"if",
"since",
"==",
"nil",
"{",
"s",
":=",... | // StreamVolumes sends a series of Volume into the provided channel.
// If since is not nil, only retrieves volume updates since the specified time. | [
"StreamVolumes",
"sends",
"a",
"series",
"of",
"Volume",
"into",
"the",
"provided",
"channel",
".",
"If",
"since",
"is",
"not",
"nil",
"only",
"retrieves",
"volume",
"updates",
"since",
"the",
"specified",
"time",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L831-L838 | train |
flynn/flynn | controller/client/v1/client.go | Backup | func (c *Client) Backup() (io.ReadCloser, error) {
res, err := c.RawReq("GET", "/backup", nil, nil, nil)
if err != nil {
return nil, err
}
return res.Body, nil
} | go | func (c *Client) Backup() (io.ReadCloser, error) {
res, err := c.RawReq("GET", "/backup", nil, nil, nil)
if err != nil {
return nil, err
}
return res.Body, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Backup",
"(",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"c",
".",
"RawReq",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"i... | // Backup takes a backup of the cluster | [
"Backup",
"takes",
"a",
"backup",
"of",
"the",
"cluster"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L841-L847 | train |
flynn/flynn | controller/client/v1/client.go | GetBackupMeta | func (c *Client) GetBackupMeta() (*ct.ClusterBackup, error) {
b := &ct.ClusterBackup{}
return b, c.Get("/backup", b)
} | go | func (c *Client) GetBackupMeta() (*ct.ClusterBackup, error) {
b := &ct.ClusterBackup{}
return b, c.Get("/backup", b)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBackupMeta",
"(",
")",
"(",
"*",
"ct",
".",
"ClusterBackup",
",",
"error",
")",
"{",
"b",
":=",
"&",
"ct",
".",
"ClusterBackup",
"{",
"}",
"\n",
"return",
"b",
",",
"c",
".",
"Get",
"(",
"\"",
"\"",
","... | // GetBackupMeta returns metadata for latest backup | [
"GetBackupMeta",
"returns",
"metadata",
"for",
"latest",
"backup"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L850-L853 | train |
flynn/flynn | controller/client/v1/client.go | DeleteRelease | func (c *Client) DeleteRelease(appID, releaseID string) (*ct.ReleaseDeletion, error) {
events := make(chan *ct.Event)
stream, err := c.StreamEvents(ct.StreamEventsOptions{
AppID: appID,
ObjectID: releaseID,
ObjectTypes: []ct.EventType{ct.EventTypeReleaseDeletion},
}, events)
if err != nil {
return ... | go | func (c *Client) DeleteRelease(appID, releaseID string) (*ct.ReleaseDeletion, error) {
events := make(chan *ct.Event)
stream, err := c.StreamEvents(ct.StreamEventsOptions{
AppID: appID,
ObjectID: releaseID,
ObjectTypes: []ct.EventType{ct.EventTypeReleaseDeletion},
}, events)
if err != nil {
return ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteRelease",
"(",
"appID",
",",
"releaseID",
"string",
")",
"(",
"*",
"ct",
".",
"ReleaseDeletion",
",",
"error",
")",
"{",
"events",
":=",
"make",
"(",
"chan",
"*",
"ct",
".",
"Event",
")",
"\n",
"stream",
... | // DeleteRelease deletes a release and any associated file artifacts. | [
"DeleteRelease",
"deletes",
"a",
"release",
"and",
"any",
"associated",
"file",
"artifacts",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L856-L888 | train |
flynn/flynn | controller/client/v1/client.go | ScheduleAppGarbageCollection | func (c *Client) ScheduleAppGarbageCollection(appID string) error {
return c.Post(fmt.Sprintf("/apps/%s/gc", appID), nil, nil)
} | go | func (c *Client) ScheduleAppGarbageCollection(appID string) error {
return c.Post(fmt.Sprintf("/apps/%s/gc", appID), nil, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ScheduleAppGarbageCollection",
"(",
"appID",
"string",
")",
"error",
"{",
"return",
"c",
".",
"Post",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] | // ScheduleAppGarbageCollection schedules a garbage collection cycle for the app | [
"ScheduleAppGarbageCollection",
"schedules",
"a",
"garbage",
"collection",
"cycle",
"for",
"the",
"app"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L891-L893 | train |
flynn/flynn | controller/client/v1/client.go | Status | func (c *Client) Status() (*status.Status, error) {
type statusResponse struct {
Data status.Status `json:"data"`
}
s := &statusResponse{}
if err := c.Get(status.Path, s); err != nil {
return nil, err
}
return &s.Data, nil
} | go | func (c *Client) Status() (*status.Status, error) {
type statusResponse struct {
Data status.Status `json:"data"`
}
s := &statusResponse{}
if err := c.Get(status.Path, s); err != nil {
return nil, err
}
return &s.Data, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Status",
"(",
")",
"(",
"*",
"status",
".",
"Status",
",",
"error",
")",
"{",
"type",
"statusResponse",
"struct",
"{",
"Data",
"status",
".",
"Status",
"`json:\"data\"`",
"\n",
"}",
"\n",
"s",
":=",
"&",
"status... | // Status gets the controller status | [
"Status",
"gets",
"the",
"controller",
"status"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L896-L905 | train |
flynn/flynn | controller/client/v1/client.go | CreateSink | func (c *Client) CreateSink(sink *ct.Sink) error {
return c.Post("/sinks", sink, sink)
} | go | func (c *Client) CreateSink(sink *ct.Sink) error {
return c.Post("/sinks", sink, sink)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateSink",
"(",
"sink",
"*",
"ct",
".",
"Sink",
")",
"error",
"{",
"return",
"c",
".",
"Post",
"(",
"\"",
"\"",
",",
"sink",
",",
"sink",
")",
"\n",
"}"
] | // CreateSink creates a new log sink | [
"CreateSink",
"creates",
"a",
"new",
"log",
"sink"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L908-L910 | train |
flynn/flynn | controller/client/v1/client.go | GetSink | func (c *Client) GetSink(sinkID string) (*ct.Sink, error) {
sink := &ct.Sink{}
return sink, c.Get(fmt.Sprintf("/sinks/%s", sinkID), sink)
} | go | func (c *Client) GetSink(sinkID string) (*ct.Sink, error) {
sink := &ct.Sink{}
return sink, c.Get(fmt.Sprintf("/sinks/%s", sinkID), sink)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSink",
"(",
"sinkID",
"string",
")",
"(",
"*",
"ct",
".",
"Sink",
",",
"error",
")",
"{",
"sink",
":=",
"&",
"ct",
".",
"Sink",
"{",
"}",
"\n",
"return",
"sink",
",",
"c",
".",
"Get",
"(",
"fmt",
".",... | // GetSink gets a log sink | [
"GetSink",
"gets",
"a",
"log",
"sink"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L913-L916 | train |
flynn/flynn | controller/client/v1/client.go | DeleteSink | func (c *Client) DeleteSink(sinkID string) (*ct.Sink, error) {
sink := &ct.Sink{}
return sink, c.Delete(fmt.Sprintf("/sinks/%s", sinkID), sink)
} | go | func (c *Client) DeleteSink(sinkID string) (*ct.Sink, error) {
sink := &ct.Sink{}
return sink, c.Delete(fmt.Sprintf("/sinks/%s", sinkID), sink)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteSink",
"(",
"sinkID",
"string",
")",
"(",
"*",
"ct",
".",
"Sink",
",",
"error",
")",
"{",
"sink",
":=",
"&",
"ct",
".",
"Sink",
"{",
"}",
"\n",
"return",
"sink",
",",
"c",
".",
"Delete",
"(",
"fmt",
... | // DeleteSink removes a log sink | [
"DeleteSink",
"removes",
"a",
"log",
"sink"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L919-L922 | train |
flynn/flynn | controller/client/v1/client.go | ListSinks | func (c *Client) ListSinks() ([]*ct.Sink, error) {
var sinks []*ct.Sink
return sinks, c.Get("/sinks", &sinks)
} | go | func (c *Client) ListSinks() ([]*ct.Sink, error) {
var sinks []*ct.Sink
return sinks, c.Get("/sinks", &sinks)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSinks",
"(",
")",
"(",
"[",
"]",
"*",
"ct",
".",
"Sink",
",",
"error",
")",
"{",
"var",
"sinks",
"[",
"]",
"*",
"ct",
".",
"Sink",
"\n",
"return",
"sinks",
",",
"c",
".",
"Get",
"(",
"\"",
"\"",
",... | // ListSink returns all log sinks | [
"ListSink",
"returns",
"all",
"log",
"sinks"
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/client/v1/client.go#L925-L928 | train |
flynn/flynn | discoverd/client/watch.go | addInst | func (w *Watch) addInst(inst *Instance) (known, identical bool) {
var i *Instance
i, known = w.instances[inst.ID]
identical = known && i.Equal(inst)
w.instances[inst.ID] = inst
return
} | go | func (w *Watch) addInst(inst *Instance) (known, identical bool) {
var i *Instance
i, known = w.instances[inst.ID]
identical = known && i.Equal(inst)
w.instances[inst.ID] = inst
return
} | [
"func",
"(",
"w",
"*",
"Watch",
")",
"addInst",
"(",
"inst",
"*",
"Instance",
")",
"(",
"known",
",",
"identical",
"bool",
")",
"{",
"var",
"i",
"*",
"Instance",
"\n",
"i",
",",
"known",
"=",
"w",
".",
"instances",
"[",
"inst",
".",
"ID",
"]",
... | // addInst adds the given instance to the local state and returns whether the
// instance already existed in the local state, and if it did exist, whether it
// was identical. | [
"addInst",
"adds",
"the",
"given",
"instance",
"to",
"the",
"local",
"state",
"and",
"returns",
"whether",
"the",
"instance",
"already",
"existed",
"in",
"the",
"local",
"state",
"and",
"if",
"it",
"did",
"exist",
"whether",
"it",
"was",
"identical",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/client/watch.go#L64-L70 | train |
flynn/flynn | discoverd/client/watch.go | delInst | func (w *Watch) delInst(inst *Instance) {
delete(w.instances, inst.ID)
} | go | func (w *Watch) delInst(inst *Instance) {
delete(w.instances, inst.ID)
} | [
"func",
"(",
"w",
"*",
"Watch",
")",
"delInst",
"(",
"inst",
"*",
"Instance",
")",
"{",
"delete",
"(",
"w",
".",
"instances",
",",
"inst",
".",
"ID",
")",
"\n",
"}"
] | // delInst removes the given instance from the local state. | [
"delInst",
"removes",
"the",
"given",
"instance",
"from",
"the",
"local",
"state",
"."
] | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/discoverd/client/watch.go#L73-L75 | train |
flynn/flynn | controller/scheduler/scheduler.go | maybeStartBlockedJobs | func (s *Scheduler) maybeStartBlockedJobs(host *Host) {
for _, job := range s.jobs {
if job.State == JobStateBlocked && job.TagsMatchHost(host) {
job.State = JobStatePending
go s.StartJob(job)
}
}
} | go | func (s *Scheduler) maybeStartBlockedJobs(host *Host) {
for _, job := range s.jobs {
if job.State == JobStateBlocked && job.TagsMatchHost(host) {
job.State = JobStatePending
go s.StartJob(job)
}
}
} | [
"func",
"(",
"s",
"*",
"Scheduler",
")",
"maybeStartBlockedJobs",
"(",
"host",
"*",
"Host",
")",
"{",
"for",
"_",
",",
"job",
":=",
"range",
"s",
".",
"jobs",
"{",
"if",
"job",
".",
"State",
"==",
"JobStateBlocked",
"&&",
"job",
".",
"TagsMatchHost",
... | // maybeStartBlockedJobs starts any jobs which are blocked due to not
// matching tags of any hosts on the given host, which is expected to be
// either a new host or a host whose tags have just changed | [
"maybeStartBlockedJobs",
"starts",
"any",
"jobs",
"which",
"are",
"blocked",
"due",
"to",
"not",
"matching",
"tags",
"of",
"any",
"hosts",
"on",
"the",
"given",
"host",
"which",
"is",
"expected",
"to",
"be",
"either",
"a",
"new",
"host",
"or",
"a",
"host",... | b4b05fce92da5fbc53b272362d87b994b88a3869 | https://github.com/flynn/flynn/blob/b4b05fce92da5fbc53b272362d87b994b88a3869/controller/scheduler/scheduler.go#L1003-L1010 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.