id
int32
0
167k
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
147,100
dynport/dgtk
dockerclient/container.go
Container
func (dh *Client) Container(containerId string) (containerInfo *docker.ContainerInfo, e error) { containerInfo = &docker.ContainerInfo{} e = dh.getJSON(dh.Address+"/containers/"+containerId+"/json", containerInfo) return containerInfo, e }
go
func (dh *Client) Container(containerId string) (containerInfo *docker.ContainerInfo, e error) { containerInfo = &docker.ContainerInfo{} e = dh.getJSON(dh.Address+"/containers/"+containerId+"/json", containerInfo) return containerInfo, e }
[ "func", "(", "dh", "*", "Client", ")", "Container", "(", "containerId", "string", ")", "(", "containerInfo", "*", "docker", ".", "ContainerInfo", ",", "e", "error", ")", "{", "containerInfo", "=", "&", "docker", ".", "ContainerInfo", "{", "}", "\n", "e",...
// Get the information for the container with the given id.
[ "Get", "the", "information", "for", "the", "container", "with", "the", "given", "id", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/container.go#L62-L66
147,101
dynport/dgtk
dockerclient/container.go
CreateContainer
func (dh *Client) CreateContainer(options *docker.ContainerConfig, name string) (containerId string, e error) { imageId := options.Image // Verify image available on host. _, e = dh.ImageHistory(imageId) if e != nil && e.Error() == "resource not found" { if e = dh.PullImage(imageId); e != nil { return "", e ...
go
func (dh *Client) CreateContainer(options *docker.ContainerConfig, name string) (containerId string, e error) { imageId := options.Image // Verify image available on host. _, e = dh.ImageHistory(imageId) if e != nil && e.Error() == "resource not found" { if e = dh.PullImage(imageId); e != nil { return "", e ...
[ "func", "(", "dh", "*", "Client", ")", "CreateContainer", "(", "options", "*", "docker", ".", "ContainerConfig", ",", "name", "string", ")", "(", "containerId", "string", ",", "e", "error", ")", "{", "imageId", ":=", "options", ".", "Image", "\n\n", "// ...
// For the given image name and the given container configuration, create a container. If the image name deosn't contain // a tag "latest" is used by default.
[ "For", "the", "given", "image", "name", "and", "the", "given", "container", "configuration", "create", "a", "container", ".", "If", "the", "image", "name", "deosn", "t", "contain", "a", "tag", "latest", "is", "used", "by", "default", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/container.go#L70-L98
147,102
dynport/dgtk
dockerclient/container.go
StartContainer
func (dh *Client) StartContainer(containerId string, hostConfig *docker.HostConfig) (e error) { if hostConfig == nil { hostConfig = &docker.HostConfig{} } _, e = dh.postJSON(dh.Address+"/containers/"+containerId+"/start", hostConfig, nil) return e }
go
func (dh *Client) StartContainer(containerId string, hostConfig *docker.HostConfig) (e error) { if hostConfig == nil { hostConfig = &docker.HostConfig{} } _, e = dh.postJSON(dh.Address+"/containers/"+containerId+"/start", hostConfig, nil) return e }
[ "func", "(", "dh", "*", "Client", ")", "StartContainer", "(", "containerId", "string", ",", "hostConfig", "*", "docker", ".", "HostConfig", ")", "(", "e", "error", ")", "{", "if", "hostConfig", "==", "nil", "{", "hostConfig", "=", "&", "docker", ".", "...
// Start the container with the given identifier. The hostConfig can safely be set to nil to use the defaults.
[ "Start", "the", "container", "with", "the", "given", "identifier", ".", "The", "hostConfig", "can", "safely", "be", "set", "to", "nil", "to", "use", "the", "defaults", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/container.go#L101-L107
147,103
dynport/dgtk
dockerclient/container.go
StopContainer
func (dh *Client) StopContainer(containerId string) (e error) { rsp, e := dh.post(dh.Address + "/containers/" + containerId + "/kill") defer rsp.Body.Close() return e }
go
func (dh *Client) StopContainer(containerId string) (e error) { rsp, e := dh.post(dh.Address + "/containers/" + containerId + "/kill") defer rsp.Body.Close() return e }
[ "func", "(", "dh", "*", "Client", ")", "StopContainer", "(", "containerId", "string", ")", "(", "e", "error", ")", "{", "rsp", ",", "e", ":=", "dh", ".", "post", "(", "dh", ".", "Address", "+", "\"", "\"", "+", "containerId", "+", "\"", "\"", ")"...
// Kill the container with the given identifier.
[ "Kill", "the", "container", "with", "the", "given", "identifier", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/container.go#L125-L129
147,104
dynport/dgtk
dockerclient/container.go
AttachContainer
func (dh *Client) AttachContainer(containerId string, opts *AttachOptions) (e error) { if opts == nil { opts = &AttachOptions{} } rsp, e := dh.post(dh.Address + "/containers/" + containerId + "/attach" + opts.Encode()) if e != nil { return e } defer rsp.Body.Close() return handleMessages(rsp.Body, opts.Stdo...
go
func (dh *Client) AttachContainer(containerId string, opts *AttachOptions) (e error) { if opts == nil { opts = &AttachOptions{} } rsp, e := dh.post(dh.Address + "/containers/" + containerId + "/attach" + opts.Encode()) if e != nil { return e } defer rsp.Body.Close() return handleMessages(rsp.Body, opts.Stdo...
[ "func", "(", "dh", "*", "Client", ")", "AttachContainer", "(", "containerId", "string", ",", "opts", "*", "AttachOptions", ")", "(", "e", "error", ")", "{", "if", "opts", "==", "nil", "{", "opts", "=", "&", "AttachOptions", "{", "}", "\n", "}", "\n",...
// Attach to the given container with the given writer.
[ "Attach", "to", "the", "given", "container", "with", "the", "given", "writer", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/container.go#L218-L229
147,105
dynport/dgtk
github/gh/status.go
dataOn
func dataOn(f *os.File) bool { stat, err := f.Stat() if err != nil { return false } return (stat.Mode() & os.ModeCharDevice) == 0 }
go
func dataOn(f *os.File) bool { stat, err := f.Stat() if err != nil { return false } return (stat.Mode() & os.ModeCharDevice) == 0 }
[ "func", "dataOn", "(", "f", "*", "os", ".", "File", ")", "bool", "{", "stat", ",", "err", ":=", "f", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "return", "(", "stat", ".", "Mode", "(", ")",...
// to be used to colorize
[ "to", "be", "used", "to", "colorize" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/github/gh/status.go#L258-L264
147,106
iron-io/iron_go
cache/cache.go
New
func New(cacheName string) *Cache { return &Cache{Settings: config.Config("iron_cache"), Name: cacheName} }
go
func New(cacheName string) *Cache { return &Cache{Settings: config.Config("iron_cache"), Name: cacheName} }
[ "func", "New", "(", "cacheName", "string", ")", "*", "Cache", "{", "return", "&", "Cache", "{", "Settings", ":", "config", ".", "Config", "(", "\"", "\"", ")", ",", "Name", ":", "cacheName", "}", "\n", "}" ]
// New returns a struct ready to make requests with. // The cacheName argument is used as namespace.
[ "New", "returns", "a", "struct", "ready", "to", "make", "requests", "with", ".", "The", "cacheName", "argument", "is", "used", "as", "namespace", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/cache/cache.go#L41-L43
147,107
iron-io/iron_go
cache/cache.go
Put
func (c *Cache) Put(key string, item *Item) (err error) { in := struct { Value interface{} `json:"value"` ExpiresIn int `json:"expires_in,omitempty"` Replace bool `json:"replace,omitempty"` Add bool `json:"add,omitempty"` }{ Value: item.Value, ExpiresIn: int(item.Expi...
go
func (c *Cache) Put(key string, item *Item) (err error) { in := struct { Value interface{} `json:"value"` ExpiresIn int `json:"expires_in,omitempty"` Replace bool `json:"replace,omitempty"` Add bool `json:"add,omitempty"` }{ Value: item.Value, ExpiresIn: int(item.Expi...
[ "func", "(", "c", "*", "Cache", ")", "Put", "(", "key", "string", ",", "item", "*", "Item", ")", "(", "err", "error", ")", "{", "in", ":=", "struct", "{", "Value", "interface", "{", "}", "`json:\"value\"`", "\n", "ExpiresIn", "int", "`json:\"expires_in...
// Put adds an Item to the cache, overwriting any existing key of the same name.
[ "Put", "adds", "an", "Item", "to", "the", "cache", "overwriting", "any", "existing", "key", "of", "the", "same", "name", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/cache/cache.go#L88-L102
147,108
iron-io/iron_go
cache/cache.go
Increment
func (c *Cache) Increment(key string, amount int64) (value interface{}, err error) { in := map[string]int64{"amount": amount} out := struct { Message string `json:"msg"` Value interface{} `json:"value"` }{} if err = c.caches(c.Name, "items", key, "increment").Req("POST", &in, &out); err == nil { value...
go
func (c *Cache) Increment(key string, amount int64) (value interface{}, err error) { in := map[string]int64{"amount": amount} out := struct { Message string `json:"msg"` Value interface{} `json:"value"` }{} if err = c.caches(c.Name, "items", key, "increment").Req("POST", &in, &out); err == nil { value...
[ "func", "(", "c", "*", "Cache", ")", "Increment", "(", "key", "string", ",", "amount", "int64", ")", "(", "value", "interface", "{", "}", ",", "err", "error", ")", "{", "in", ":=", "map", "[", "string", "]", "int64", "{", "\"", "\"", ":", "amount...
// Increment increments the corresponding item's value.
[ "Increment", "increments", "the", "corresponding", "item", "s", "value", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/cache/cache.go#L157-L168
147,109
iron-io/iron_go
cache/cache.go
Get
func (c *Cache) Get(key string) (value interface{}, err error) { out := struct { Cache string `json:"cache"` Key string `json:"key"` Value interface{} `json:"value"` }{} if err = c.caches(c.Name, "items", key).Req("GET", nil, &out); err == nil { value = out.Value } return }
go
func (c *Cache) Get(key string) (value interface{}, err error) { out := struct { Cache string `json:"cache"` Key string `json:"key"` Value interface{} `json:"value"` }{} if err = c.caches(c.Name, "items", key).Req("GET", nil, &out); err == nil { value = out.Value } return }
[ "func", "(", "c", "*", "Cache", ")", "Get", "(", "key", "string", ")", "(", "value", "interface", "{", "}", ",", "err", "error", ")", "{", "out", ":=", "struct", "{", "Cache", "string", "`json:\"cache\"`", "\n", "Key", "string", "`json:\"key\"`", "\n",...
// Get gets an item from the cache.
[ "Get", "gets", "an", "item", "from", "the", "cache", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/cache/cache.go#L171-L181
147,110
google/readahead
readahead.go
NewConcurrentReader
func NewConcurrentReader(name string, r io.ReaderAt, chunkSize int, chunkAhead int, numWorkers int) io.ReadCloser { chunkRespc, closedc, res := makeReader(name, chunkSize, chunkAhead) go func() { defer res.done.Done() runAt(name, r, chunkRespc, closedc, chunkSize, chunkAhead, numWorkers, &res.chunkPool) }() ret...
go
func NewConcurrentReader(name string, r io.ReaderAt, chunkSize int, chunkAhead int, numWorkers int) io.ReadCloser { chunkRespc, closedc, res := makeReader(name, chunkSize, chunkAhead) go func() { defer res.done.Done() runAt(name, r, chunkRespc, closedc, chunkSize, chunkAhead, numWorkers, &res.chunkPool) }() ret...
[ "func", "NewConcurrentReader", "(", "name", "string", ",", "r", "io", ".", "ReaderAt", ",", "chunkSize", "int", ",", "chunkAhead", "int", ",", "numWorkers", "int", ")", "io", ".", "ReadCloser", "{", "chunkRespc", ",", "closedc", ",", "res", ":=", "makeRead...
// NewConcurrentReader creates a new reader with the specified chunk size and number of workers. // Name is only used for logging. It reads ahead up to chunkAhead chunks of chunkSize with numWorkers // and tries to maintain the readahead buffer.
[ "NewConcurrentReader", "creates", "a", "new", "reader", "with", "the", "specified", "chunk", "size", "and", "number", "of", "workers", ".", "Name", "is", "only", "used", "for", "logging", ".", "It", "reads", "ahead", "up", "to", "chunkAhead", "chunks", "of",...
eaceba16903255cb149d1efc316f6cc83d765268
https://github.com/google/readahead/blob/eaceba16903255cb149d1efc316f6cc83d765268/readahead.go#L53-L60
147,111
google/readahead
readahead.go
NewReader
func NewReader(name string, r io.Reader, chunkSize, chunkAhead int) io.ReadCloser { chunkRespc, closedc, res := makeReader(name, chunkSize, chunkAhead) go func() { defer res.done.Done() run(name, r, chunkRespc, closedc, &res.chunkPool) }() return res }
go
func NewReader(name string, r io.Reader, chunkSize, chunkAhead int) io.ReadCloser { chunkRespc, closedc, res := makeReader(name, chunkSize, chunkAhead) go func() { defer res.done.Done() run(name, r, chunkRespc, closedc, &res.chunkPool) }() return res }
[ "func", "NewReader", "(", "name", "string", ",", "r", "io", ".", "Reader", ",", "chunkSize", ",", "chunkAhead", "int", ")", "io", ".", "ReadCloser", "{", "chunkRespc", ",", "closedc", ",", "res", ":=", "makeReader", "(", "name", ",", "chunkSize", ",", ...
// NewReader creates a readahead reader. It will read up to chunkAhead chunks of // chunkSize bytes each and use a separate goroutine for that. It is useful when reading // from a compressed stream or from network. If an incoming stream supports io.ReaderAt, // NewConcurrentReader is a faster option. Name is only used ...
[ "NewReader", "creates", "a", "readahead", "reader", ".", "It", "will", "read", "up", "to", "chunkAhead", "chunks", "of", "chunkSize", "bytes", "each", "and", "use", "a", "separate", "goroutine", "for", "that", ".", "It", "is", "useful", "when", "reading", ...
eaceba16903255cb149d1efc316f6cc83d765268
https://github.com/google/readahead/blob/eaceba16903255cb149d1efc316f6cc83d765268/readahead.go#L68-L75
147,112
google/readahead
readahead.go
reorderChunks
func reorderChunks(name string, respCh <-chan *chunkResp, chunkRespc chan<- *chunkResp, eofCh chan<- struct{}, closedc <-chan struct{}) { pending := make(map[int64]*chunkResp) var off int64 for resp := range respCh { glog.V(2).Infof("Received chunk (off=%d chunk=<%d bytes> err=%v", resp.off, len(resp.chunk), resp....
go
func reorderChunks(name string, respCh <-chan *chunkResp, chunkRespc chan<- *chunkResp, eofCh chan<- struct{}, closedc <-chan struct{}) { pending := make(map[int64]*chunkResp) var off int64 for resp := range respCh { glog.V(2).Infof("Received chunk (off=%d chunk=<%d bytes> err=%v", resp.off, len(resp.chunk), resp....
[ "func", "reorderChunks", "(", "name", "string", ",", "respCh", "<-", "chan", "*", "chunkResp", ",", "chunkRespc", "chan", "<-", "*", "chunkResp", ",", "eofCh", "chan", "<-", "struct", "{", "}", ",", "closedc", "<-", "chan", "struct", "{", "}", ")", "{"...
// reorderChunks consumes out-of-order chunks from respCh and emits // them in order to chunkRespc. When a chunk is received with an // error, it closes eofCh to prevent new chunks from being read.
[ "reorderChunks", "consumes", "out", "-", "of", "-", "order", "chunks", "from", "respCh", "and", "emits", "them", "in", "order", "to", "chunkRespc", ".", "When", "a", "chunk", "is", "received", "with", "an", "error", "it", "closes", "eofCh", "to", "prevent"...
eaceba16903255cb149d1efc316f6cc83d765268
https://github.com/google/readahead/blob/eaceba16903255cb149d1efc316f6cc83d765268/readahead.go#L165-L195
147,113
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/keyring.go
Add
func (r *keyring) Add(key AddedKey) error { r.mu.Lock() defer r.mu.Unlock() if r.locked { return errLocked } signer, err := ssh.NewSignerFromKey(key.PrivateKey) if err != nil { return err } if cert := key.Certificate; cert != nil { signer, err = ssh.NewCertSigner(cert, signer) if err != nil { retur...
go
func (r *keyring) Add(key AddedKey) error { r.mu.Lock() defer r.mu.Unlock() if r.locked { return errLocked } signer, err := ssh.NewSignerFromKey(key.PrivateKey) if err != nil { return err } if cert := key.Certificate; cert != nil { signer, err = ssh.NewCertSigner(cert, signer) if err != nil { retur...
[ "func", "(", "r", "*", "keyring", ")", "Add", "(", "key", "AddedKey", ")", "error", "{", "r", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "r", ".", "locked", "{", "return", "errLocked", ...
// Insert adds a private key to the keyring. If a certificate // is given, that certificate is added as public key. Note that // any constraints given are ignored.
[ "Insert", "adds", "a", "private", "key", "to", "the", "keyring", ".", "If", "a", "certificate", "is", "given", "that", "certificate", "is", "added", "as", "public", "key", ".", "Note", "that", "any", "constraints", "given", "are", "ignored", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/keyring.go#L130-L152
147,114
dynport/dgtk
wunderproxy/history.go
Load
func (che *ContainerHistoryEvent) Load() (*LaunchConfig, error) { return LoadLaunchConfig(che.history.s3Client, che.history.s3Bucket, che.history.s3Prefix, che.Hash) }
go
func (che *ContainerHistoryEvent) Load() (*LaunchConfig, error) { return LoadLaunchConfig(che.history.s3Client, che.history.s3Bucket, che.history.s3Prefix, che.Hash) }
[ "func", "(", "che", "*", "ContainerHistoryEvent", ")", "Load", "(", ")", "(", "*", "LaunchConfig", ",", "error", ")", "{", "return", "LoadLaunchConfig", "(", "che", ".", "history", ".", "s3Client", ",", "che", ".", "history", ".", "s3Bucket", ",", "che",...
// Load the event's container configuration from S3.
[ "Load", "the", "event", "s", "container", "configuration", "from", "S3", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/history.go#L26-L28
147,115
dynport/dgtk
wunderproxy/history.go
LoadContainerHistory
func LoadContainerHistory(s3c *s3.Client, bucket, prefix string) (*ContainerHistory, error) { ch := &ContainerHistory{s3Client: s3c, s3Bucket: bucket, s3Prefix: prefix} return ch, ch.load() }
go
func LoadContainerHistory(s3c *s3.Client, bucket, prefix string) (*ContainerHistory, error) { ch := &ContainerHistory{s3Client: s3c, s3Bucket: bucket, s3Prefix: prefix} return ch, ch.load() }
[ "func", "LoadContainerHistory", "(", "s3c", "*", "s3", ".", "Client", ",", "bucket", ",", "prefix", "string", ")", "(", "*", "ContainerHistory", ",", "error", ")", "{", "ch", ":=", "&", "ContainerHistory", "{", "s3Client", ":", "s3c", ",", "s3Bucket", ":...
// Load the container history from S3.
[ "Load", "the", "container", "history", "from", "S3", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/history.go#L41-L44
147,116
dynport/dgtk
wunderproxy/history.go
Save
func (ch *ContainerHistory) Save() error { srcKey := ch.s3Prefix + "/container." + ch.Events[len(ch.Events)-1].Hash + ".json" err := ch.s3Client.Copy(ch.s3Bucket, srcKey, ch.s3Bucket, ch.s3Prefix+"/current.json") if err != nil { return err } if len(ch.Events) > maxHistoryEntries { ch.Events = ch.Events[len(ch...
go
func (ch *ContainerHistory) Save() error { srcKey := ch.s3Prefix + "/container." + ch.Events[len(ch.Events)-1].Hash + ".json" err := ch.s3Client.Copy(ch.s3Bucket, srcKey, ch.s3Bucket, ch.s3Prefix+"/current.json") if err != nil { return err } if len(ch.Events) > maxHistoryEntries { ch.Events = ch.Events[len(ch...
[ "func", "(", "ch", "*", "ContainerHistory", ")", "Save", "(", ")", "error", "{", "srcKey", ":=", "ch", ".", "s3Prefix", "+", "\"", "\"", "+", "ch", ".", "Events", "[", "len", "(", "ch", ".", "Events", ")", "-", "1", "]", ".", "Hash", "+", "\"",...
// Persist the container history to S3.
[ "Persist", "the", "container", "history", "to", "S3", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/history.go#L77-L95
147,117
dynport/dgtk
wunderproxy/history.go
RollbackTo
func (ch *ContainerHistory) RollbackTo(che *ContainerHistoryEvent) (*ContainerHistoryEvent, error) { i, err := func() (int, error) { for i := range ch.Events { if ch.Events[i].Hash == che.Hash { return i, nil } } return -1, fmt.Errorf("launch config %q not part of container history", che.Hash) }() if...
go
func (ch *ContainerHistory) RollbackTo(che *ContainerHistoryEvent) (*ContainerHistoryEvent, error) { i, err := func() (int, error) { for i := range ch.Events { if ch.Events[i].Hash == che.Hash { return i, nil } } return -1, fmt.Errorf("launch config %q not part of container history", che.Hash) }() if...
[ "func", "(", "ch", "*", "ContainerHistory", ")", "RollbackTo", "(", "che", "*", "ContainerHistoryEvent", ")", "(", "*", "ContainerHistoryEvent", ",", "error", ")", "{", "i", ",", "err", ":=", "func", "(", ")", "(", "int", ",", "error", ")", "{", "for",...
// Rollback to the container in the given history event. The history is changed // to only contain events up to the given one, i.e. all successors are removed. // Please note an explicit history.Save call must be done to persist the // changed history.
[ "Rollback", "to", "the", "container", "in", "the", "given", "history", "event", ".", "The", "history", "is", "changed", "to", "only", "contain", "events", "up", "to", "the", "given", "one", "i", ".", "e", ".", "all", "successors", "are", "removed", ".", ...
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/history.go#L128-L143
147,118
iron-io/iron_go
mq/mq.go
ConfigNew
func ConfigNew(queueName string, settings *config.Settings) Queue { return Queue{Settings: config.ManualConfig("iron_mq", settings), Name: queueName} }
go
func ConfigNew(queueName string, settings *config.Settings) Queue { return Queue{Settings: config.ManualConfig("iron_mq", settings), Name: queueName} }
[ "func", "ConfigNew", "(", "queueName", "string", ",", "settings", "*", "config", ".", "Settings", ")", "Queue", "{", "return", "Queue", "{", "Settings", ":", "config", ".", "ManualConfig", "(", "\"", "\"", ",", "settings", ")", ",", "Name", ":", "queueNa...
// ConfigNew uses the specified settings over configuration specified in an iron.json file or // environment variables to return a Queue object capable of acquiring information about or // modifying the queue specified by queueName.
[ "ConfigNew", "uses", "the", "specified", "settings", "over", "configuration", "specified", "in", "an", "iron", ".", "json", "file", "or", "environment", "variables", "to", "return", "a", "Queue", "object", "capable", "of", "acquiring", "information", "about", "o...
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/mq/mq.go#L76-L78
147,119
iron-io/iron_go
mq/mq.go
RemoveSubscribers
func (q Queue) RemoveSubscribers(subscribers ...string) (err error) { qi := QueueInfo{Subscribers: make([]QueueSubscriber, len(subscribers))} for i, subscriber := range subscribers { qi.Subscribers[i].URL = subscriber } return q.queues(q.Name, "subscribers").Req("DELETE", &qi, nil) }
go
func (q Queue) RemoveSubscribers(subscribers ...string) (err error) { qi := QueueInfo{Subscribers: make([]QueueSubscriber, len(subscribers))} for i, subscriber := range subscribers { qi.Subscribers[i].URL = subscriber } return q.queues(q.Name, "subscribers").Req("DELETE", &qi, nil) }
[ "func", "(", "q", "Queue", ")", "RemoveSubscribers", "(", "subscribers", "...", "string", ")", "(", "err", "error", ")", "{", "qi", ":=", "QueueInfo", "{", "Subscribers", ":", "make", "(", "[", "]", "QueueSubscriber", ",", "len", "(", "subscribers", ")",...
// RemoveSubscribers removes subscribers.
[ "RemoveSubscribers", "removes", "subscribers", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/mq/mq.go#L153-L159
147,120
iron-io/iron_go
mq/mq.go
Get
func (q Queue) Get() (msg *Message, err error) { msgs, err := q.GetN(1) if err != nil { return } if len(msgs) > 0 { msg = msgs[0] } else { err = errors.New("Couldn't get a single message") } return }
go
func (q Queue) Get() (msg *Message, err error) { msgs, err := q.GetN(1) if err != nil { return } if len(msgs) > 0 { msg = msgs[0] } else { err = errors.New("Couldn't get a single message") } return }
[ "func", "(", "q", "Queue", ")", "Get", "(", ")", "(", "msg", "*", "Message", ",", "err", "error", ")", "{", "msgs", ",", "err", ":=", "q", ".", "GetN", "(", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "if", "...
// Get reserves a message from the queue. // The message will not be deleted, but will be reserved until the timeout // expires. If the timeout expires before the message is deleted, the message // will be placed back onto the queue. // As a result, be sure to Delete a message after you're done with it.
[ "Get", "reserves", "a", "message", "from", "the", "queue", ".", "The", "message", "will", "not", "be", "deleted", "but", "will", "be", "reserved", "until", "the", "timeout", "expires", ".", "If", "the", "timeout", "expires", "before", "the", "message", "is...
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/mq/mq.go#L219-L232
147,121
iron-io/iron_go
mq/mq.go
GetN
func (q Queue) GetN(n int) (msgs []*Message, err error) { return q.GetNWithTimeoutAndWait(n, 0, 0) }
go
func (q Queue) GetN(n int) (msgs []*Message, err error) { return q.GetNWithTimeoutAndWait(n, 0, 0) }
[ "func", "(", "q", "Queue", ")", "GetN", "(", "n", "int", ")", "(", "msgs", "[", "]", "*", "Message", ",", "err", "error", ")", "{", "return", "q", ".", "GetNWithTimeoutAndWait", "(", "n", ",", "0", ",", "0", ")", "\n", "}" ]
// get N messages
[ "get", "N", "messages" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/mq/mq.go#L235-L237
147,122
iron-io/iron_go
mq/mq.go
PeekN
func (q Queue) PeekN(n int) (msgs []*Message, err error) { msgs, err = q.PeekNWithTimeout(n, 0) return }
go
func (q Queue) PeekN(n int) (msgs []*Message, err error) { msgs, err = q.PeekNWithTimeout(n, 0) return }
[ "func", "(", "q", "Queue", ")", "PeekN", "(", "n", "int", ")", "(", "msgs", "[", "]", "*", "Message", ",", "err", "error", ")", "{", "msgs", ",", "err", "=", "q", ".", "PeekNWithTimeout", "(", "n", ",", "0", ")", "\n\n", "return", "\n", "}" ]
// peek N messages
[ "peek", "N", "messages" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/mq/mq.go#L280-L284
147,123
iron-io/iron_go
mq/mq.go
Delete
func (m Message) Delete() (err error) { return m.q.DeleteMessage(m.Id) }
go
func (m Message) Delete() (err error) { return m.q.DeleteMessage(m.Id) }
[ "func", "(", "m", "Message", ")", "Delete", "(", ")", "(", "err", "error", ")", "{", "return", "m", ".", "q", ".", "DeleteMessage", "(", "m", ".", "Id", ")", "\n", "}" ]
// Delete message from queue
[ "Delete", "message", "from", "queue" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/mq/mq.go#L413-L415
147,124
dynport/dgtk
git/git.go
WriteArchiveToTar
func (repo *Repository) WriteArchiveToTar(revision string, w *tar.Writer) (e error) { if !validTar.MatchString(revision) { return fmt.Errorf("revision %q not valid (must be 40 digit git sha)", revision) } mtime, e := repo.DateOf(revision, ".") if e != nil { return e } e = repo.addArchiveToTar(revision, mtim...
go
func (repo *Repository) WriteArchiveToTar(revision string, w *tar.Writer) (e error) { if !validTar.MatchString(revision) { return fmt.Errorf("revision %q not valid (must be 40 digit git sha)", revision) } mtime, e := repo.DateOf(revision, ".") if e != nil { return e } e = repo.addArchiveToTar(revision, mtim...
[ "func", "(", "repo", "*", "Repository", ")", "WriteArchiveToTar", "(", "revision", "string", ",", "w", "*", "tar", ".", "Writer", ")", "(", "e", "error", ")", "{", "if", "!", "validTar", ".", "MatchString", "(", "revision", ")", "{", "return", "fmt", ...
// Writes tgz archive to the given tar writer.
[ "Writes", "tgz", "archive", "to", "the", "given", "tar", "writer", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/git/git.go#L107-L123
147,125
dynport/dgtk
git/git.go
Archive
func (repo *Repository) Archive(revision string, w io.Writer, files ...string) (int64, error) { if err := repo.Init(); err != nil { return 0, err } args := append([]string{"archive", "--format=tar.gz", revision}, files...) cmd := repo.createGitCommand(args...) stderr := &bytes.Buffer{} cmd.Stderr = stderr cnt ...
go
func (repo *Repository) Archive(revision string, w io.Writer, files ...string) (int64, error) { if err := repo.Init(); err != nil { return 0, err } args := append([]string{"archive", "--format=tar.gz", revision}, files...) cmd := repo.createGitCommand(args...) stderr := &bytes.Buffer{} cmd.Stderr = stderr cnt ...
[ "func", "(", "repo", "*", "Repository", ")", "Archive", "(", "revision", "string", ",", "w", "io", ".", "Writer", ",", "files", "...", "string", ")", "(", "int64", ",", "error", ")", "{", "if", "err", ":=", "repo", ".", "Init", "(", ")", ";", "er...
// write tar.gz archive to writer
[ "write", "tar", ".", "gz", "archive", "to", "writer" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/git/git.go#L176-L190
147,126
dynport/dgtk
web/app.go
HandleError
func (t *App) HandleError(w http.ResponseWriter, e error) { status := 500 if s, ok := e.(interface { Status() int }); ok { status = s.Status() } logger.Printf("ERROR: %q", e) http.Error(w, e.Error(), status) }
go
func (t *App) HandleError(w http.ResponseWriter, e error) { status := 500 if s, ok := e.(interface { Status() int }); ok { status = s.Status() } logger.Printf("ERROR: %q", e) http.Error(w, e.Error(), status) }
[ "func", "(", "t", "*", "App", ")", "HandleError", "(", "w", "http", ".", "ResponseWriter", ",", "e", "error", ")", "{", "status", ":=", "500", "\n", "if", "s", ",", "ok", ":=", "e", ".", "(", "interface", "{", "Status", "(", ")", "int", "\n", "...
// allow registering error pages
[ "allow", "registering", "error", "pages" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/web/app.go#L118-L127
147,127
dynport/dgtk
opentsdb/metrics.go
NewMetricsList
func NewMetricsList(tags string) (*MetricsList, error) { tagMap := make(map[string]string) for _, element := range strings.Split(tags, " ") { if element == "" { continue } parts := strings.SplitN(element, "=", 2) if len(parts) == 2 { key, value := parts[0], parts[1] tagMap[key] = value } else { ...
go
func NewMetricsList(tags string) (*MetricsList, error) { tagMap := make(map[string]string) for _, element := range strings.Split(tags, " ") { if element == "" { continue } parts := strings.SplitN(element, "=", 2) if len(parts) == 2 { key, value := parts[0], parts[1] tagMap[key] = value } else { ...
[ "func", "NewMetricsList", "(", "tags", "string", ")", "(", "*", "MetricsList", ",", "error", ")", "{", "tagMap", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "_", ",", "element", ":=", "range", "strings", ".", "Split", "(...
// Create a new metrics list for the given tags.
[ "Create", "a", "new", "metrics", "list", "for", "the", "given", "tags", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L42-L57
147,128
dynport/dgtk
opentsdb/metrics.go
First
func (mvl *MetricsList) First() *MetricValue { if len(mvl.data) > 0 { mvl.Sort() return mvl.data[0] } return nil }
go
func (mvl *MetricsList) First() *MetricValue { if len(mvl.data) > 0 { mvl.Sort() return mvl.data[0] } return nil }
[ "func", "(", "mvl", "*", "MetricsList", ")", "First", "(", ")", "*", "MetricValue", "{", "if", "len", "(", "mvl", ".", "data", ")", ">", "0", "{", "mvl", ".", "Sort", "(", ")", "\n", "return", "mvl", ".", "data", "[", "0", "]", "\n", "}", "\n...
// Returns the first metric recorded.
[ "Returns", "the", "first", "metric", "recorded", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L85-L91
147,129
dynport/dgtk
opentsdb/metrics.go
Last
func (mvl *MetricsList) Last() *MetricValue { if len(mvl.data) > 0 { mvl.Sort() return mvl.data[len(mvl.data)-1] } return nil }
go
func (mvl *MetricsList) Last() *MetricValue { if len(mvl.data) > 0 { mvl.Sort() return mvl.data[len(mvl.data)-1] } return nil }
[ "func", "(", "mvl", "*", "MetricsList", ")", "Last", "(", ")", "*", "MetricValue", "{", "if", "len", "(", "mvl", ".", "data", ")", ">", "0", "{", "mvl", ".", "Sort", "(", ")", "\n", "return", "mvl", ".", "data", "[", "len", "(", "mvl", ".", "...
// Returns the last metric recorded.
[ "Returns", "the", "last", "metric", "recorded", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L94-L100
147,130
dynport/dgtk
opentsdb/metrics.go
Aggregate
func (mvl *MetricsList) Aggregate() (*MetricsAggregate, error) { if len(mvl.data) == 0 { return nil, fmt.Errorf("MetricsList contains no data!") } if mvl.aggregate != nil { return mvl.aggregate, nil } mvl.Sort() sum, min, max := 0.0, mvl.First().Value, mvl.First().Value for _, v := range mvl.data { sum ...
go
func (mvl *MetricsList) Aggregate() (*MetricsAggregate, error) { if len(mvl.data) == 0 { return nil, fmt.Errorf("MetricsList contains no data!") } if mvl.aggregate != nil { return mvl.aggregate, nil } mvl.Sort() sum, min, max := 0.0, mvl.First().Value, mvl.First().Value for _, v := range mvl.data { sum ...
[ "func", "(", "mvl", "*", "MetricsList", ")", "Aggregate", "(", ")", "(", "*", "MetricsAggregate", ",", "error", ")", "{", "if", "len", "(", "mvl", ".", "data", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")",...
// Returns aggregate values on the list of data. The computations are // cached and returned directly if available. Cache will be // invalidated if another value is added.
[ "Returns", "aggregate", "values", "on", "the", "list", "of", "data", ".", "The", "computations", "are", "cached", "and", "returned", "directly", "if", "available", ".", "Cache", "will", "be", "invalidated", "if", "another", "value", "is", "added", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L105-L137
147,131
dynport/dgtk
opentsdb/metrics.go
GetTagValue
func (mvl *MetricsList) GetTagValue(tag string) (value string, e error) { if value, ok := mvl.tags[tag]; !ok { return value, errors.New("Tag unknown!") } else { return value, e } }
go
func (mvl *MetricsList) GetTagValue(tag string) (value string, e error) { if value, ok := mvl.tags[tag]; !ok { return value, errors.New("Tag unknown!") } else { return value, e } }
[ "func", "(", "mvl", "*", "MetricsList", ")", "GetTagValue", "(", "tag", "string", ")", "(", "value", "string", ",", "e", "error", ")", "{", "if", "value", ",", "ok", ":=", "mvl", ".", "tags", "[", "tag", "]", ";", "!", "ok", "{", "return", "value...
// Get value of a given tag.
[ "Get", "value", "of", "a", "given", "tag", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L140-L146
147,132
dynport/dgtk
opentsdb/metrics.go
AddMetricValue
func (mt MetricsTree) AddMetricValue(mv *MetricValue) error { tm, found := mt[mv.Key] if !found { tm = make(tagMap) mt[mv.Key] = tm } metricsList, found := tm[mv.Tags] if !found { var e error metricsList, e = NewMetricsList(mv.Tags) if e != nil { return e } tm[mv.Tags] = metricsList } metricsLis...
go
func (mt MetricsTree) AddMetricValue(mv *MetricValue) error { tm, found := mt[mv.Key] if !found { tm = make(tagMap) mt[mv.Key] = tm } metricsList, found := tm[mv.Tags] if !found { var e error metricsList, e = NewMetricsList(mv.Tags) if e != nil { return e } tm[mv.Tags] = metricsList } metricsLis...
[ "func", "(", "mt", "MetricsTree", ")", "AddMetricValue", "(", "mv", "*", "MetricValue", ")", "error", "{", "tm", ",", "found", ":=", "mt", "[", "mv", ".", "Key", "]", "\n", "if", "!", "found", "{", "tm", "=", "make", "(", "tagMap", ")", "\n", "mt...
// Add a new metric value to the metrics tree.
[ "Add", "a", "new", "metric", "value", "to", "the", "metrics", "tree", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L158-L175
147,133
dynport/dgtk
opentsdb/metrics.go
GetTagsForMetric
func (mt MetricsTree) GetTagsForMetric(metric string) (tags []string, e error) { if m, ok := mt[metric]; ok { keys := make([]string, 0, len(m)) for key, _ := range m { keys = append(keys, key) } return keys, e } return tags, errors.New(fmt.Sprintf("Failed to find metric %s", metric)) }
go
func (mt MetricsTree) GetTagsForMetric(metric string) (tags []string, e error) { if m, ok := mt[metric]; ok { keys := make([]string, 0, len(m)) for key, _ := range m { keys = append(keys, key) } return keys, e } return tags, errors.New(fmt.Sprintf("Failed to find metric %s", metric)) }
[ "func", "(", "mt", "MetricsTree", ")", "GetTagsForMetric", "(", "metric", "string", ")", "(", "tags", "[", "]", "string", ",", "e", "error", ")", "{", "if", "m", ",", "ok", ":=", "mt", "[", "metric", "]", ";", "ok", "{", "keys", ":=", "make", "("...
// Get all tags of the given metric that are returned by the according // query.
[ "Get", "all", "tags", "of", "the", "given", "metric", "that", "are", "returned", "by", "the", "according", "query", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/metrics.go#L189-L198
147,134
dynport/dgtk
cryptostore/store.go
createUserWithBits
func (store *Store) createUserWithBits(login, password string, bits int) (u *User, e error) { if store.UserExists(login) { return nil, fmt.Errorf("user already exists") } user := &User{} dir := store.userPath(login) log.Printf("creating directory %s", dir) e = os.MkdirAll(dir, 0755) if e != nil { return nil,...
go
func (store *Store) createUserWithBits(login, password string, bits int) (u *User, e error) { if store.UserExists(login) { return nil, fmt.Errorf("user already exists") } user := &User{} dir := store.userPath(login) log.Printf("creating directory %s", dir) e = os.MkdirAll(dir, 0755) if e != nil { return nil,...
[ "func", "(", "store", "*", "Store", ")", "createUserWithBits", "(", "login", ",", "password", "string", ",", "bits", "int", ")", "(", "u", "*", "User", ",", "e", "error", ")", "{", "if", "store", ".", "UserExists", "(", "login", ")", "{", "return", ...
// password needs to have a valid length
[ "password", "needs", "to", "have", "a", "valid", "length" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cryptostore/store.go#L187-L231
147,135
dynport/dgtk
wunderproxy/launch_config.go
LoadCurrentLaunchConfig
func LoadCurrentLaunchConfig(s3c *s3.Client, bucket, prefix string) (*LaunchConfig, error) { lc := new(LaunchConfig) return lc, lc.load(s3c, bucket, prefix, "current.json") }
go
func LoadCurrentLaunchConfig(s3c *s3.Client, bucket, prefix string) (*LaunchConfig, error) { lc := new(LaunchConfig) return lc, lc.load(s3c, bucket, prefix, "current.json") }
[ "func", "LoadCurrentLaunchConfig", "(", "s3c", "*", "s3", ".", "Client", ",", "bucket", ",", "prefix", "string", ")", "(", "*", "LaunchConfig", ",", "error", ")", "{", "lc", ":=", "new", "(", "LaunchConfig", ")", "\n", "return", "lc", ",", "lc", ".", ...
// Function to load the currently deployed container for the environment // specified in the prefix. If history is empty the ErrorLaunchConfigNotFound // error type will be returned.
[ "Function", "to", "load", "the", "currently", "deployed", "container", "for", "the", "environment", "specified", "in", "the", "prefix", ".", "If", "history", "is", "empty", "the", "ErrorLaunchConfigNotFound", "error", "type", "will", "be", "returned", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/launch_config.go#L32-L35
147,136
dynport/dgtk
dockerclient/dockerclient.go
New
func New(addr string) *Client { return &Client{Address: addr, Client: &http.Client{}} }
go
func New(addr string) *Client { return &Client{Address: addr, Client: &http.Client{}} }
[ "func", "New", "(", "addr", "string", ")", "*", "Client", "{", "return", "&", "Client", "{", "Address", ":", "addr", ",", "Client", ":", "&", "http", ".", "Client", "{", "}", "}", "\n", "}" ]
// Create a new connection to a docker host reachable at the given host and port.
[ "Create", "a", "new", "connection", "to", "a", "docker", "host", "reachable", "at", "the", "given", "host", "and", "port", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/dockerclient.go#L12-L14
147,137
iron-io/iron_go
worker/methods.go
CodePackageUpload
func (w *Worker) CodePackageUpload(code Code) (id string, err error) { client := http.Client{} body := &bytes.Buffer{} mWriter := multipart.NewWriter(body) // write meta-data mMetaWriter, err := mWriter.CreateFormField("data") if err != nil { return } jEncoder := json.NewEncoder(mMetaWriter) err = jEncoder...
go
func (w *Worker) CodePackageUpload(code Code) (id string, err error) { client := http.Client{} body := &bytes.Buffer{} mWriter := multipart.NewWriter(body) // write meta-data mMetaWriter, err := mWriter.CreateFormField("data") if err != nil { return } jEncoder := json.NewEncoder(mMetaWriter) err = jEncoder...
[ "func", "(", "w", "*", "Worker", ")", "CodePackageUpload", "(", "code", "Code", ")", "(", "id", "string", ",", "err", "error", ")", "{", "client", ":=", "http", ".", "Client", "{", "}", "\n\n", "body", ":=", "&", "bytes", ".", "Buffer", "{", "}", ...
// CodePackageUpload uploads a code package
[ "CodePackageUpload", "uploads", "a", "code", "package" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L131-L209
147,138
iron-io/iron_go
worker/methods.go
CodePackageInfo
func (w *Worker) CodePackageInfo(codeId string) (code CodeInfo, err error) { out := CodeInfo{} err = w.codes(codeId).Req("GET", nil, &out) return out, err }
go
func (w *Worker) CodePackageInfo(codeId string) (code CodeInfo, err error) { out := CodeInfo{} err = w.codes(codeId).Req("GET", nil, &out) return out, err }
[ "func", "(", "w", "*", "Worker", ")", "CodePackageInfo", "(", "codeId", "string", ")", "(", "code", "CodeInfo", ",", "err", "error", ")", "{", "out", ":=", "CodeInfo", "{", "}", "\n", "err", "=", "w", ".", "codes", "(", "codeId", ")", ".", "Req", ...
// CodePackageInfo gets info about a code package
[ "CodePackageInfo", "gets", "info", "about", "a", "code", "package" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L212-L216
147,139
iron-io/iron_go
worker/methods.go
CodePackageDelete
func (w *Worker) CodePackageDelete(codeId string) (err error) { return w.codes(codeId).Req("DELETE", nil, nil) }
go
func (w *Worker) CodePackageDelete(codeId string) (err error) { return w.codes(codeId).Req("DELETE", nil, nil) }
[ "func", "(", "w", "*", "Worker", ")", "CodePackageDelete", "(", "codeId", "string", ")", "(", "err", "error", ")", "{", "return", "w", ".", "codes", "(", "codeId", ")", ".", "Req", "(", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "}" ]
// CodePackageDelete deletes a code package
[ "CodePackageDelete", "deletes", "a", "code", "package" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L219-L221
147,140
iron-io/iron_go
worker/methods.go
CodePackageDownload
func (w *Worker) CodePackageDownload(codeId string) (code Code, err error) { out := Code{} err = w.codes(codeId, "download").Req("GET", nil, &out) return out, err }
go
func (w *Worker) CodePackageDownload(codeId string) (code Code, err error) { out := Code{} err = w.codes(codeId, "download").Req("GET", nil, &out) return out, err }
[ "func", "(", "w", "*", "Worker", ")", "CodePackageDownload", "(", "codeId", "string", ")", "(", "code", "Code", ",", "err", "error", ")", "{", "out", ":=", "Code", "{", "}", "\n", "err", "=", "w", ".", "codes", "(", "codeId", ",", "\"", "\"", ")"...
// CodePackageDownload downloads a code package
[ "CodePackageDownload", "downloads", "a", "code", "package" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L224-L228
147,141
iron-io/iron_go
worker/methods.go
TaskQueue
func (w *Worker) TaskQueue(tasks ...Task) (taskIds []string, err error) { outTasks := make([]map[string]interface{}, 0, len(tasks)) for _, task := range tasks { thisTask := map[string]interface{}{ "code_name": task.CodeName, "payload": task.Payload, "priority": task.Priority, "cluster": task.Clust...
go
func (w *Worker) TaskQueue(tasks ...Task) (taskIds []string, err error) { outTasks := make([]map[string]interface{}, 0, len(tasks)) for _, task := range tasks { thisTask := map[string]interface{}{ "code_name": task.CodeName, "payload": task.Payload, "priority": task.Priority, "cluster": task.Clust...
[ "func", "(", "w", "*", "Worker", ")", "TaskQueue", "(", "tasks", "...", "Task", ")", "(", "taskIds", "[", "]", "string", ",", "err", "error", ")", "{", "outTasks", ":=", "make", "(", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ","...
// TaskQueue queues a task
[ "TaskQueue", "queues", "a", "task" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L296-L336
147,142
iron-io/iron_go
worker/methods.go
TaskInfo
func (w *Worker) TaskInfo(taskId string) (task TaskInfo, err error) { out := TaskInfo{} err = w.tasks(taskId).Req("GET", nil, &out) return out, err }
go
func (w *Worker) TaskInfo(taskId string) (task TaskInfo, err error) { out := TaskInfo{} err = w.tasks(taskId).Req("GET", nil, &out) return out, err }
[ "func", "(", "w", "*", "Worker", ")", "TaskInfo", "(", "taskId", "string", ")", "(", "task", "TaskInfo", ",", "err", "error", ")", "{", "out", ":=", "TaskInfo", "{", "}", "\n", "err", "=", "w", ".", "tasks", "(", "taskId", ")", ".", "Req", "(", ...
// TaskInfo gives info about a given task
[ "TaskInfo", "gives", "info", "about", "a", "given", "task" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L339-L343
147,143
iron-io/iron_go
worker/methods.go
TaskCancel
func (w *Worker) TaskCancel(taskId string) (err error) { _, err = w.tasks(taskId, "cancel").Request("POST", nil) return err }
go
func (w *Worker) TaskCancel(taskId string) (err error) { _, err = w.tasks(taskId, "cancel").Request("POST", nil) return err }
[ "func", "(", "w", "*", "Worker", ")", "TaskCancel", "(", "taskId", "string", ")", "(", "err", "error", ")", "{", "_", ",", "err", "=", "w", ".", "tasks", "(", "taskId", ",", "\"", "\"", ")", ".", "Request", "(", "\"", "\"", ",", "nil", ")", "...
// TaskCancel cancels a Task
[ "TaskCancel", "cancels", "a", "Task" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L356-L359
147,144
iron-io/iron_go
worker/methods.go
TaskProgress
func (w *Worker) TaskProgress(taskId string, progress int, msg string) (err error) { payload := map[string]interface{}{ "msg": msg, "percent": progress, } err = w.tasks(taskId, "progress").Req("POST", payload, nil) return }
go
func (w *Worker) TaskProgress(taskId string, progress int, msg string) (err error) { payload := map[string]interface{}{ "msg": msg, "percent": progress, } err = w.tasks(taskId, "progress").Req("POST", payload, nil) return }
[ "func", "(", "w", "*", "Worker", ")", "TaskProgress", "(", "taskId", "string", ",", "progress", "int", ",", "msg", "string", ")", "(", "err", "error", ")", "{", "payload", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":"...
// TaskProgress sets a Task's Progress
[ "TaskProgress", "sets", "a", "Task", "s", "Progress" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L362-L370
147,145
iron-io/iron_go
worker/methods.go
ScheduleList
func (w *Worker) ScheduleList() (schedules []ScheduleInfo, err error) { out := map[string][]ScheduleInfo{} err = w.schedules().Req("GET", nil, &out) if err != nil { return } return out["schedules"], nil }
go
func (w *Worker) ScheduleList() (schedules []ScheduleInfo, err error) { out := map[string][]ScheduleInfo{} err = w.schedules().Req("GET", nil, &out) if err != nil { return } return out["schedules"], nil }
[ "func", "(", "w", "*", "Worker", ")", "ScheduleList", "(", ")", "(", "schedules", "[", "]", "ScheduleInfo", ",", "err", "error", ")", "{", "out", ":=", "map", "[", "string", "]", "[", "]", "ScheduleInfo", "{", "}", "\n", "err", "=", "w", ".", "sc...
// ScheduleList lists Scheduled Tasks
[ "ScheduleList", "lists", "Scheduled", "Tasks" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L376-L383
147,146
iron-io/iron_go
worker/methods.go
Schedule
func (w *Worker) Schedule(schedules ...Schedule) (scheduleIds []string, err error) { outSchedules := make([]map[string]interface{}, 0, len(schedules)) for _, schedule := range schedules { sm := map[string]interface{}{ "code_name": schedule.CodeName, "name": schedule.Name, "payload": schedule.Payloa...
go
func (w *Worker) Schedule(schedules ...Schedule) (scheduleIds []string, err error) { outSchedules := make([]map[string]interface{}, 0, len(schedules)) for _, schedule := range schedules { sm := map[string]interface{}{ "code_name": schedule.CodeName, "name": schedule.Name, "payload": schedule.Payloa...
[ "func", "(", "w", "*", "Worker", ")", "Schedule", "(", "schedules", "...", "Schedule", ")", "(", "scheduleIds", "[", "]", "string", ",", "err", "error", ")", "{", "outSchedules", ":=", "make", "(", "[", "]", "map", "[", "string", "]", "interface", "{...
// Schedule a Task
[ "Schedule", "a", "Task" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L386-L441
147,147
iron-io/iron_go
worker/methods.go
ScheduleInfo
func (w *Worker) ScheduleInfo(scheduleId string) (info ScheduleInfo, err error) { info = ScheduleInfo{} err = w.schedules(scheduleId).Req("GET", nil, &info) return info, nil }
go
func (w *Worker) ScheduleInfo(scheduleId string) (info ScheduleInfo, err error) { info = ScheduleInfo{} err = w.schedules(scheduleId).Req("GET", nil, &info) return info, nil }
[ "func", "(", "w", "*", "Worker", ")", "ScheduleInfo", "(", "scheduleId", "string", ")", "(", "info", "ScheduleInfo", ",", "err", "error", ")", "{", "info", "=", "ScheduleInfo", "{", "}", "\n", "err", "=", "w", ".", "schedules", "(", "scheduleId", ")", ...
// ScheduleInfo gets info about a scheduled task
[ "ScheduleInfo", "gets", "info", "about", "a", "scheduled", "task" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L444-L448
147,148
iron-io/iron_go
worker/methods.go
ScheduleCancel
func (w *Worker) ScheduleCancel(scheduleId string) (err error) { _, err = w.schedules(scheduleId, "cancel").Request("POST", nil) return }
go
func (w *Worker) ScheduleCancel(scheduleId string) (err error) { _, err = w.schedules(scheduleId, "cancel").Request("POST", nil) return }
[ "func", "(", "w", "*", "Worker", ")", "ScheduleCancel", "(", "scheduleId", "string", ")", "(", "err", "error", ")", "{", "_", ",", "err", "=", "w", ".", "schedules", "(", "scheduleId", ",", "\"", "\"", ")", ".", "Request", "(", "\"", "\"", ",", "...
// ScheduleCancel cancels a scheduled task
[ "ScheduleCancel", "cancels", "a", "scheduled", "task" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/methods.go#L451-L454
147,149
dynport/dgtk
jenkins/jenkins.go
TriggerBuildWithParams
func (j *Client) TriggerBuildWithParams(name string, values url.Values) (string, error) { //curl -u "dynport:horse battery staple" -d 'SPECS=spec&BRANCH=2.2.3&' https://phrasebuild.wunderscale.com/job/phrase-experimental/buildWithParameters -i u := j.Address + "/job/" + name + "/buildWithParameters" rsp, err := j.cl...
go
func (j *Client) TriggerBuildWithParams(name string, values url.Values) (string, error) { //curl -u "dynport:horse battery staple" -d 'SPECS=spec&BRANCH=2.2.3&' https://phrasebuild.wunderscale.com/job/phrase-experimental/buildWithParameters -i u := j.Address + "/job/" + name + "/buildWithParameters" rsp, err := j.cl...
[ "func", "(", "j", "*", "Client", ")", "TriggerBuildWithParams", "(", "name", "string", ",", "values", "url", ".", "Values", ")", "(", "string", ",", "error", ")", "{", "//curl -u \"dynport:horse battery staple\" -d 'SPECS=spec&BRANCH=2.2.3&' https://phrasebuild.wunderscal...
// maybe also add add delay=0sec
[ "maybe", "also", "add", "add", "delay", "=", "0sec" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/jenkins/jenkins.go#L21-L34
147,150
dynport/dgtk
es/aggregations/aggregations.go
UnmarshalJSON
func (a Aggregations) UnmarshalJSON(b []byte) error { var i map[string]interface{} e := json.Unmarshal(b, &i) if e != nil { return e } if a == nil { return fmt.Errorf("Aggregations must be set before unmarshalling") } return a.load(i) }
go
func (a Aggregations) UnmarshalJSON(b []byte) error { var i map[string]interface{} e := json.Unmarshal(b, &i) if e != nil { return e } if a == nil { return fmt.Errorf("Aggregations must be set before unmarshalling") } return a.load(i) }
[ "func", "(", "a", "Aggregations", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "i", "map", "[", "string", "]", "interface", "{", "}", "\n", "e", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "i", ")", "\n", ...
// UnmarshalJSON implement the json.Unmarshaler interface
[ "UnmarshalJSON", "implement", "the", "json", ".", "Unmarshaler", "interface" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/es/aggregations/aggregations.go#L11-L21
147,151
dynport/dgtk
es/aggregations/aggregations.go
load
func (a Aggregations) load(i map[string]interface{}) error { for k, value := range i { valueMap, ok := value.(map[string]interface{}) if ok { agg := &Aggregate{Name: k} e := agg.Load(valueMap) if e != nil { return e } a[k] = agg } } return nil }
go
func (a Aggregations) load(i map[string]interface{}) error { for k, value := range i { valueMap, ok := value.(map[string]interface{}) if ok { agg := &Aggregate{Name: k} e := agg.Load(valueMap) if e != nil { return e } a[k] = agg } } return nil }
[ "func", "(", "a", "Aggregations", ")", "load", "(", "i", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "for", "k", ",", "value", ":=", "range", "i", "{", "valueMap", ",", "ok", ":=", "value", ".", "(", "map", "[", "string",...
// load initialized the Aggregations map from a generic map
[ "load", "initialized", "the", "Aggregations", "map", "from", "a", "generic", "map" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/es/aggregations/aggregations.go#L24-L37
147,152
iron-io/iron_go
worker/worker.go
sleepBetweenRetries
func sleepBetweenRetries(previousDuration time.Duration) time.Duration { if previousDuration >= 60*time.Second { return previousDuration } return previousDuration + previousDuration }
go
func sleepBetweenRetries(previousDuration time.Duration) time.Duration { if previousDuration >= 60*time.Second { return previousDuration } return previousDuration + previousDuration }
[ "func", "sleepBetweenRetries", "(", "previousDuration", "time", ".", "Duration", ")", "time", ".", "Duration", "{", "if", "previousDuration", ">=", "60", "*", "time", ".", "Second", "{", "return", "previousDuration", "\n", "}", "\n", "return", "previousDuration"...
// exponential sleep between retries, replace this with your own preferred strategy
[ "exponential", "sleep", "between", "retries", "replace", "this", "with", "your", "own", "preferred", "strategy" ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/worker.go#L24-L29
147,153
iron-io/iron_go
worker/worker.go
WaitForTask
func (w *Worker) WaitForTask(taskId string) chan TaskInfo { out := make(chan TaskInfo) go func() { defer close(out) retryDelay := 100 * time.Millisecond for { info, err := w.TaskInfo(taskId) if err != nil { return } if info.Status == "queued" || info.Status == "running" { time.Sleep(retryD...
go
func (w *Worker) WaitForTask(taskId string) chan TaskInfo { out := make(chan TaskInfo) go func() { defer close(out) retryDelay := 100 * time.Millisecond for { info, err := w.TaskInfo(taskId) if err != nil { return } if info.Status == "queued" || info.Status == "running" { time.Sleep(retryD...
[ "func", "(", "w", "*", "Worker", ")", "WaitForTask", "(", "taskId", "string", ")", "chan", "TaskInfo", "{", "out", ":=", "make", "(", "chan", "TaskInfo", ")", "\n", "go", "func", "(", ")", "{", "defer", "close", "(", "out", ")", "\n", "retryDelay", ...
// WaitForTask returns a channel that will receive the completed task and is closed afterwards. // If an error occured during the wait, the channel will be closed.
[ "WaitForTask", "returns", "a", "channel", "that", "will", "receive", "the", "completed", "task", "and", "is", "closed", "afterwards", ".", "If", "an", "error", "occured", "during", "the", "wait", "the", "channel", "will", "be", "closed", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/worker.go#L47-L70
147,154
iron-io/iron_go
worker/remote.go
ParseFlags
func ParseFlags() { flag.StringVar(&TaskDir, "d", "", "task dir") flag.StringVar(&envFlag, "e", "", "environment type") flag.StringVar(&payloadFlag, "payload", "", "payload file") flag.StringVar(&TaskId, "id", "", "task id") flag.StringVar(&configFlag, "config", "", "config file") flag.Parse() if os.Geten...
go
func ParseFlags() { flag.StringVar(&TaskDir, "d", "", "task dir") flag.StringVar(&envFlag, "e", "", "environment type") flag.StringVar(&payloadFlag, "payload", "", "payload file") flag.StringVar(&TaskId, "id", "", "task id") flag.StringVar(&configFlag, "config", "", "config file") flag.Parse() if os.Geten...
[ "func", "ParseFlags", "(", ")", "{", "flag", ".", "StringVar", "(", "&", "TaskDir", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "flag", ".", "StringVar", "(", "&", "envFlag", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ...
// call this to parse flags before using the other methods.
[ "call", "this", "to", "parse", "flags", "before", "using", "the", "other", "methods", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/worker/remote.go#L20-L39
147,155
dynport/dgtk
es/batch_indexer.go
checkFlush
func (i *BatchIndexer) checkFlush() bool { if time.Since(i.lastFlush) < i.flushDuration && i.cnt < i.flushCount { return false } i.flush() return true }
go
func (i *BatchIndexer) checkFlush() bool { if time.Since(i.lastFlush) < i.flushDuration && i.cnt < i.flushCount { return false } i.flush() return true }
[ "func", "(", "i", "*", "BatchIndexer", ")", "checkFlush", "(", ")", "bool", "{", "if", "time", ".", "Since", "(", "i", ".", "lastFlush", ")", "<", "i", ".", "flushDuration", "&&", "i", ".", "cnt", "<", "i", ".", "flushCount", "{", "return", "false"...
// checkFlush calls flush if // a) time since last flush > threshold // or // b) rows since last flush > threshold
[ "checkFlush", "calls", "flush", "if", "a", ")", "time", "since", "last", "flush", ">", "threshold", "or", "b", ")", "rows", "since", "last", "flush", ">", "threshold" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/es/batch_indexer.go#L91-L97
147,156
dynport/dgtk
es/batch_indexer.go
addInternal
func (i *BatchIndexer) addInternal(doc *Doc) (int, error) { b, err := json.Marshal(&indexDoc{Doc: doc}) if err != nil { return i.cnt, err } i.buf.Write(b) i.buf.Write([]byte("\n")) b, err = json.Marshal(doc.Source) if err != nil { return i.cnt, nil } i.buf.Write(b) i.buf.Write([]byte("\n")) i.cnt++ retu...
go
func (i *BatchIndexer) addInternal(doc *Doc) (int, error) { b, err := json.Marshal(&indexDoc{Doc: doc}) if err != nil { return i.cnt, err } i.buf.Write(b) i.buf.Write([]byte("\n")) b, err = json.Marshal(doc.Source) if err != nil { return i.cnt, nil } i.buf.Write(b) i.buf.Write([]byte("\n")) i.cnt++ retu...
[ "func", "(", "i", "*", "BatchIndexer", ")", "addInternal", "(", "doc", "*", "Doc", ")", "(", "int", ",", "error", ")", "{", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "&", "indexDoc", "{", "Doc", ":", "doc", "}", ")", "\n", "if", "err"...
// add should NOT be called directly as it is not thread safe // use the channel to add new documents
[ "add", "should", "NOT", "be", "called", "directly", "as", "it", "is", "not", "thread", "safe", "use", "the", "channel", "to", "add", "new", "documents" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/es/batch_indexer.go#L149-L164
147,157
dynport/dgtk
stats/stats.go
Perc
func (stats *Stats) Perc(perc float64) float64 { stats.Sort() return Percentile(stats.values, perc) }
go
func (stats *Stats) Perc(perc float64) float64 { stats.Sort() return Percentile(stats.values, perc) }
[ "func", "(", "stats", "*", "Stats", ")", "Perc", "(", "perc", "float64", ")", "float64", "{", "stats", ".", "Sort", "(", ")", "\n", "return", "Percentile", "(", "stats", ".", "values", ",", "perc", ")", "\n", "}" ]
// Perc calculates the percentile, use 50 for median
[ "Perc", "calculates", "the", "percentile", "use", "50", "for", "median" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/stats/stats.go#L90-L93
147,158
iron-io/iron_go
config/config.go
ManualConfig
func ManualConfig(fullProduct string, configuration *Settings) (settings Settings) { return config(fullProduct, "", configuration) }
go
func ManualConfig(fullProduct string, configuration *Settings) (settings Settings) { return config(fullProduct, "", configuration) }
[ "func", "ManualConfig", "(", "fullProduct", "string", ",", "configuration", "*", "Settings", ")", "(", "settings", "Settings", ")", "{", "return", "config", "(", "fullProduct", ",", "\"", "\"", ",", "configuration", ")", "\n", "}" ]
// ManualConfig gathers configuration from env variables, json config files // and finally overwrites it with specified instance of Settings.
[ "ManualConfig", "gathers", "configuration", "from", "env", "variables", "json", "config", "files", "and", "finally", "overwrites", "it", "with", "specified", "instance", "of", "Settings", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/config/config.go#L63-L65
147,159
iron-io/iron_go
config/config.go
UseConfigFile
func (s *Settings) UseConfigFile(family, product, path, env string) { content, err := ioutil.ReadFile(path) if err != nil { dbg("tried to", err, ": skipping") return } data := map[string]interface{}{} err = json.Unmarshal(content, &data) if err != nil { panic("Invalid JSON in " + path + ": " + err.Error())...
go
func (s *Settings) UseConfigFile(family, product, path, env string) { content, err := ioutil.ReadFile(path) if err != nil { dbg("tried to", err, ": skipping") return } data := map[string]interface{}{} err = json.Unmarshal(content, &data) if err != nil { panic("Invalid JSON in " + path + ": " + err.Error())...
[ "func", "(", "s", "*", "Settings", ")", "UseConfigFile", "(", "family", ",", "product", ",", "path", ",", "env", "string", ")", "{", "content", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "dbg...
// Load and merge the given JSON config file.
[ "Load", "and", "merge", "the", "given", "JSON", "config", "file", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/config/config.go#L192-L221
147,160
iron-io/iron_go
config/config.go
UseConfigMap
func (s *Settings) UseConfigMap(data map[string]interface{}) { if token, found := data["token"]; found { s.Token = token.(string) dbg("config has token:", s.Token) } if projectId, found := data["project_id"]; found { s.ProjectId = projectId.(string) dbg("config has project_id:", s.ProjectId) } if host, fou...
go
func (s *Settings) UseConfigMap(data map[string]interface{}) { if token, found := data["token"]; found { s.Token = token.(string) dbg("config has token:", s.Token) } if projectId, found := data["project_id"]; found { s.ProjectId = projectId.(string) dbg("config has project_id:", s.ProjectId) } if host, fou...
[ "func", "(", "s", "*", "Settings", ")", "UseConfigMap", "(", "data", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "if", "token", ",", "found", ":=", "data", "[", "\"", "\"", "]", ";", "found", "{", "s", ".", "Token", "=", "token", ...
// Merge the given data into the settings.
[ "Merge", "the", "given", "data", "into", "the", "settings", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/config/config.go#L224-L253
147,161
iron-io/iron_go
config/config.go
UseSettings
func (s *Settings) UseSettings(settings *Settings) { if settings.Token != "" { s.Token = settings.Token } if settings.ProjectId != "" { s.ProjectId = settings.ProjectId } if settings.Host != "" { s.Host = settings.Host } if settings.Scheme != "" { s.Scheme = settings.Scheme } if settings.ApiVersion != ...
go
func (s *Settings) UseSettings(settings *Settings) { if settings.Token != "" { s.Token = settings.Token } if settings.ProjectId != "" { s.ProjectId = settings.ProjectId } if settings.Host != "" { s.Host = settings.Host } if settings.Scheme != "" { s.Scheme = settings.Scheme } if settings.ApiVersion != ...
[ "func", "(", "s", "*", "Settings", ")", "UseSettings", "(", "settings", "*", "Settings", ")", "{", "if", "settings", ".", "Token", "!=", "\"", "\"", "{", "s", ".", "Token", "=", "settings", ".", "Token", "\n", "}", "\n", "if", "settings", ".", "Pro...
// Merge the given instance into the settings.
[ "Merge", "the", "given", "instance", "into", "the", "settings", "." ]
56e218bf01ba28987db9b70100a59631a78eb78f
https://github.com/iron-io/iron_go/blob/56e218bf01ba28987db9b70100a59631a78eb78f/config/config.go#L256-L278
147,162
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/curve25519/mont25519_amd64.go
unpack
func unpack(r *[5]uint64, x *[32]byte) { r[0] = uint64(x[0]) | uint64(x[1])<<8 | uint64(x[2])<<16 | uint64(x[3])<<24 | uint64(x[4])<<32 | uint64(x[5])<<40 | uint64(x[6]&7)<<48 r[1] = uint64(x[6])>>3 | uint64(x[7])<<5 | uint64(x[8])<<13 | uint64(x[9])<<21 | uint64(x[10])<<29 | uint64(x[11])<<37 ...
go
func unpack(r *[5]uint64, x *[32]byte) { r[0] = uint64(x[0]) | uint64(x[1])<<8 | uint64(x[2])<<16 | uint64(x[3])<<24 | uint64(x[4])<<32 | uint64(x[5])<<40 | uint64(x[6]&7)<<48 r[1] = uint64(x[6])>>3 | uint64(x[7])<<5 | uint64(x[8])<<13 | uint64(x[9])<<21 | uint64(x[10])<<29 | uint64(x[11])<<37 ...
[ "func", "unpack", "(", "r", "*", "[", "5", "]", "uint64", ",", "x", "*", "[", "32", "]", "byte", ")", "{", "r", "[", "0", "]", "=", "uint64", "(", "x", "[", "0", "]", ")", "|", "uint64", "(", "x", "[", "1", "]", ")", "<<", "8", "|", "...
// unpack sets r = x where r consists of 5, 51-bit limbs in little-endian // order.
[ "unpack", "sets", "r", "=", "x", "where", "r", "consists", "of", "5", "51", "-", "bit", "limbs", "in", "little", "-", "endian", "order", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/curve25519/mont25519_amd64.go#L87-L128
147,163
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/curve25519/mont25519_amd64.go
invert
func invert(r *[5]uint64, x *[5]uint64) { var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t [5]uint64 square(&z2, x) /* 2 */ square(&t, &z2) /* 4 */ square(&t, &t) /* 8 */ mul(&z9, &t, x) /* 9 */ mul(&z11, &z9, &z2) /* 11 */ square(&t, &z11) /* 22 */ mul(&z2_5_0, ...
go
func invert(r *[5]uint64, x *[5]uint64) { var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t [5]uint64 square(&z2, x) /* 2 */ square(&t, &z2) /* 4 */ square(&t, &t) /* 8 */ mul(&z9, &t, x) /* 9 */ mul(&z11, &z9, &z2) /* 11 */ square(&t, &z11) /* 22 */ mul(&z2_5_0, ...
[ "func", "invert", "(", "r", "*", "[", "5", "]", "uint64", ",", "x", "*", "[", "5", "]", "uint64", ")", "{", "var", "z2", ",", "z9", ",", "z11", ",", "z2_5_0", ",", "z2_10_0", ",", "z2_20_0", ",", "z2_50_0", ",", "z2_100_0", ",", "t", "[", "5"...
// invert calculates r = x^-1 mod p using Fermat's little theorem.
[ "invert", "calculates", "r", "=", "x^", "-", "1", "mod", "p", "using", "Fermat", "s", "little", "theorem", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/curve25519/mont25519_amd64.go#L179-L240
147,164
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/handshake.go
sendKexInitLocked
func (t *handshakeTransport) sendKexInitLocked() (*kexInitMsg, []byte, error) { // kexInits may be sent either in response to the other side, // or because our side wants to initiate a key change, so we // may have already sent a kexInit. In that case, don't send a // second kexInit. if t.sentInitMsg != nil { re...
go
func (t *handshakeTransport) sendKexInitLocked() (*kexInitMsg, []byte, error) { // kexInits may be sent either in response to the other side, // or because our side wants to initiate a key change, so we // may have already sent a kexInit. In that case, don't send a // second kexInit. if t.sentInitMsg != nil { re...
[ "func", "(", "t", "*", "handshakeTransport", ")", "sendKexInitLocked", "(", ")", "(", "*", "kexInitMsg", ",", "[", "]", "byte", ",", "error", ")", "{", "// kexInits may be sent either in response to the other side,", "// or because our side wants to initiate a key change, s...
// sendKexInitLocked sends a key change message. t.mu must be locked // while this happens.
[ "sendKexInitLocked", "sends", "a", "key", "change", "message", ".", "t", ".", "mu", "must", "be", "locked", "while", "this", "happens", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/handshake.go#L232-L272
147,165
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/handshake.go
enterKeyExchange
func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { if debugHandshake { log.Printf("%s entered key exchange", t.id()) } myInit, myInitPacket, err := t.sendKexInit() if err != nil { return err } otherInit := &kexInitMsg{} if err := Unmarshal(otherInitPacket, otherInit); err != nil {...
go
func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { if debugHandshake { log.Printf("%s entered key exchange", t.id()) } myInit, myInitPacket, err := t.sendKexInit() if err != nil { return err } otherInit := &kexInitMsg{} if err := Unmarshal(otherInitPacket, otherInit); err != nil {...
[ "func", "(", "t", "*", "handshakeTransport", ")", "enterKeyExchange", "(", "otherInitPacket", "[", "]", "byte", ")", "error", "{", "if", "debugHandshake", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "t", ".", "id", "(", ")", ")", "\n", "}", "\n"...
// enterKeyExchange runs the key exchange.
[ "enterKeyExchange", "runs", "the", "key", "exchange", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/handshake.go#L304-L375
147,166
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/server.go
serverHandshake
func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) { if len(config.hostKeys) == 0 { return nil, errors.New("ssh: server has no host keys") } if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil { r...
go
func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) { if len(config.hostKeys) == 0 { return nil, errors.New("ssh: server has no host keys") } if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil { r...
[ "func", "(", "s", "*", "connection", ")", "serverHandshake", "(", "config", "*", "ServerConfig", ")", "(", "*", "Permissions", ",", "error", ")", "{", "if", "len", "(", "config", ".", "hostKeys", ")", "==", "0", "{", "return", "nil", ",", "errors", "...
// handshake performs key exchange and user authentication.
[ "handshake", "performs", "key", "exchange", "and", "user", "authentication", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/server.go#L166-L227
147,167
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/certs.go
CheckCert
func (c *CertChecker) CheckCert(principal string, cert *Certificate) error { if c.IsRevoked != nil && c.IsRevoked(cert) { return fmt.Errorf("ssh: certicate serial %d revoked", cert.Serial) } for opt, _ := range cert.CriticalOptions { // sourceAddressCriticalOption will be enforced by // serverAuthenticate i...
go
func (c *CertChecker) CheckCert(principal string, cert *Certificate) error { if c.IsRevoked != nil && c.IsRevoked(cert) { return fmt.Errorf("ssh: certicate serial %d revoked", cert.Serial) } for opt, _ := range cert.CriticalOptions { // sourceAddressCriticalOption will be enforced by // serverAuthenticate i...
[ "func", "(", "c", "*", "CertChecker", ")", "CheckCert", "(", "principal", "string", ",", "cert", "*", "Certificate", ")", "error", "{", "if", "c", ".", "IsRevoked", "!=", "nil", "&&", "c", ".", "IsRevoked", "(", "cert", ")", "{", "return", "fmt", "."...
// CheckCert checks CriticalOptions, ValidPrincipals, revocation, timestamp and // the signature of the certificate.
[ "CheckCert", "checks", "CriticalOptions", "ValidPrincipals", "revocation", "timestamp", "and", "the", "signature", "of", "the", "certificate", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/ssh/certs.go#L320-L379
147,168
dynport/dgtk
cli/router.go
NewRouter
func NewRouter() *Router { r := &Router{} r.root = &routingTreeNode{children: map[string]*routingTreeNode{}} return r }
go
func NewRouter() *Router { r := &Router{} r.root = &routingTreeNode{children: map[string]*routingTreeNode{}} return r }
[ "func", "NewRouter", "(", ")", "*", "Router", "{", "r", ":=", "&", "Router", "{", "}", "\n", "r", ".", "root", "=", "&", "routingTreeNode", "{", "children", ":", "map", "[", "string", "]", "*", "routingTreeNode", "{", "}", "}", "\n", "return", "r",...
// Create a new router that will be used to register and run the actions of the application.
[ "Create", "a", "new", "router", "that", "will", "be", "used", "to", "register", "and", "run", "the", "actions", "of", "the", "application", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cli/router.go#L29-L33
147,169
dynport/dgtk
cli/router.go
Run
func (r *Router) Run(args ...string) (e error) { if r.initFailed { fmt.Fprintln(DefaultWriter, "errors found during initialization") os.Exit(1) } // Find action and parse args. node, args := r.findNode(args, true) if node != nil && node.action != nil { if e := node.action.parseArgs(args); e != nil { node....
go
func (r *Router) Run(args ...string) (e error) { if r.initFailed { fmt.Fprintln(DefaultWriter, "errors found during initialization") os.Exit(1) } // Find action and parse args. node, args := r.findNode(args, true) if node != nil && node.action != nil { if e := node.action.parseArgs(args); e != nil { node....
[ "func", "(", "r", "*", "Router", ")", "Run", "(", "args", "...", "string", ")", "(", "e", "error", ")", "{", "if", "r", ".", "initFailed", "{", "fmt", ".", "Fprintln", "(", "DefaultWriter", ",", "\"", "\"", ")", "\n", "os", ".", "Exit", "(", "1...
// Run the given arguments against the registered actions, i.e. try to find a matching route and run the according // action.
[ "Run", "the", "given", "arguments", "against", "the", "registered", "actions", "i", ".", "e", ".", "try", "to", "find", "a", "matching", "route", "and", "run", "the", "according", "action", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cli/router.go#L37-L55
147,170
dynport/dgtk
cli/router.go
RegisterFunc
func (r *Router) RegisterFunc(path string, f func() error, desc string) { aA := &annonymousAction{runner: f} r.Register(path, aA, desc) }
go
func (r *Router) RegisterFunc(path string, f func() error, desc string) { aA := &annonymousAction{runner: f} r.Register(path, aA, desc) }
[ "func", "(", "r", "*", "Router", ")", "RegisterFunc", "(", "path", "string", ",", "f", "func", "(", ")", "error", ",", "desc", "string", ")", "{", "aA", ":=", "&", "annonymousAction", "{", "runner", ":", "f", "}", "\n", "r", ".", "Register", "(", ...
// Register the given function as handler for the given route. This is a shortcut for actions that don't need options or // arguments. A description can be provided as an optional argument.
[ "Register", "the", "given", "function", "as", "handler", "for", "the", "given", "route", ".", "This", "is", "a", "shortcut", "for", "actions", "that", "don", "t", "need", "options", "or", "arguments", ".", "A", "description", "can", "be", "provided", "as",...
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cli/router.go#L74-L77
147,171
dynport/dgtk
wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/curve25519/curve25519.go
feInvert
func feInvert(out, z *fieldElement) { var t0, t1, t2, t3 fieldElement var i int feSquare(&t0, z) for i = 1; i < 1; i++ { feSquare(&t0, &t0) } feSquare(&t1, &t0) for i = 1; i < 2; i++ { feSquare(&t1, &t1) } feMul(&t1, z, &t1) feMul(&t0, &t0, &t1) feSquare(&t2, &t0) for i = 1; i < 1; i++ { feSquare(&t2...
go
func feInvert(out, z *fieldElement) { var t0, t1, t2, t3 fieldElement var i int feSquare(&t0, z) for i = 1; i < 1; i++ { feSquare(&t0, &t0) } feSquare(&t1, &t0) for i = 1; i < 2; i++ { feSquare(&t1, &t1) } feMul(&t1, z, &t1) feMul(&t0, &t0, &t1) feSquare(&t2, &t0) for i = 1; i < 1; i++ { feSquare(&t2...
[ "func", "feInvert", "(", "out", ",", "z", "*", "fieldElement", ")", "{", "var", "t0", ",", "t1", ",", "t2", ",", "t3", "fieldElement", "\n", "var", "i", "int", "\n\n", "feSquare", "(", "&", "t0", ",", "z", ")", "\n", "for", "i", "=", "1", ";", ...
// feInvert sets out = z^-1.
[ "feInvert", "sets", "out", "=", "z^", "-", "1", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/wunderproxy/wunderproxy/Godeps/_workspace/src/golang.org/x/crypto/curve25519/curve25519.go#L731-L790
147,172
dynport/dgtk
cli/action.go
newAction
func newAction(path string, r Runner, desc string) (act *action, e error) { act = &action{ path: path, runner: r, params: map[string]*option{}, description: desc} // Inject the "help" option (handled specially). helpOption := &option{field: "Help", short: "h", long: "help", isFlag: true, d...
go
func newAction(path string, r Runner, desc string) (act *action, e error) { act = &action{ path: path, runner: r, params: map[string]*option{}, description: desc} // Inject the "help" option (handled specially). helpOption := &option{field: "Help", short: "h", long: "help", isFlag: true, d...
[ "func", "newAction", "(", "path", "string", ",", "r", "Runner", ",", "desc", "string", ")", "(", "act", "*", "action", ",", "e", "error", ")", "{", "act", "=", "&", "action", "{", "path", ":", "path", ",", "runner", ":", "r", ",", "params", ":", ...
// Register an action for the given path with the given runner.
[ "Register", "an", "action", "for", "the", "given", "path", "with", "the", "given", "runner", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cli/action.go#L22-L40
147,173
dynport/dgtk
cli/action.go
reflect
func (a *action) reflect() (e error) { v := reflect.ValueOf(a.runner) if v.Kind() == reflect.Ptr { v = v.Elem() } a.value = v e = a.reflectRecurse(v) if e != nil { e = fmt.Errorf("%s: %s", v.Type().Name(), e) } return e }
go
func (a *action) reflect() (e error) { v := reflect.ValueOf(a.runner) if v.Kind() == reflect.Ptr { v = v.Elem() } a.value = v e = a.reflectRecurse(v) if e != nil { e = fmt.Errorf("%s: %s", v.Type().Name(), e) } return e }
[ "func", "(", "a", "*", "action", ")", "reflect", "(", ")", "(", "e", "error", ")", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "a", ".", "runner", ")", "\n", "if", "v", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "v", "=", ...
// Method to reflect on the action's runner type and determine the according options and arguments.
[ "Method", "to", "reflect", "on", "the", "action", "s", "runner", "type", "and", "determine", "the", "according", "options", "and", "arguments", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cli/action.go#L43-L54
147,174
dynport/dgtk
cli/action.go
reflectIntoRunner
func (a *action) reflectIntoRunner() (e error) { if e = a.reflectOptions(); e != nil { return e } if e = a.reflectArguments(); e != nil { return e } return nil }
go
func (a *action) reflectIntoRunner() (e error) { if e = a.reflectOptions(); e != nil { return e } if e = a.reflectArguments(); e != nil { return e } return nil }
[ "func", "(", "a", "*", "action", ")", "reflectIntoRunner", "(", ")", "(", "e", "error", ")", "{", "if", "e", "=", "a", ".", "reflectOptions", "(", ")", ";", "e", "!=", "nil", "{", "return", "e", "\n", "}", "\n", "if", "e", "=", "a", ".", "ref...
// Use reflection to set values of the runner, if the action was called with a matching route.
[ "Use", "reflection", "to", "set", "values", "of", "the", "runner", "if", "the", "action", "was", "called", "with", "a", "matching", "route", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/cli/action.go#L247-L255
147,175
dynport/dgtk
goassets/examples/http-server/main.go
main
func main() { port := os.Getenv("PORT") if port == "" { port = "3000" } // make all files in assets accessible via /static/<name>, e.g. /static/style.css http.Handle("/static/", http.StripPrefix("/static", http.FileServer(FileSystem()))) // root handler for layout http.HandleFunc("/", handler) e := http.Lis...
go
func main() { port := os.Getenv("PORT") if port == "" { port = "3000" } // make all files in assets accessible via /static/<name>, e.g. /static/style.css http.Handle("/static/", http.StripPrefix("/static", http.FileServer(FileSystem()))) // root handler for layout http.HandleFunc("/", handler) e := http.Lis...
[ "func", "main", "(", ")", "{", "port", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "port", "==", "\"", "\"", "{", "port", "=", "\"", "\"", "\n", "}", "\n\n", "// make all files in assets accessible via /static/<name>, e.g. /static/style.css", ...
// make assets to build assets // make run to build assets and start server // GOASSETS_PATH=assets make run to start server and always read local assets
[ "make", "assets", "to", "build", "assets", "make", "run", "to", "build", "assets", "and", "start", "server", "GOASSETS_PATH", "=", "assets", "make", "run", "to", "start", "server", "and", "always", "read", "local", "assets" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/goassets/examples/http-server/main.go#L14-L29
147,176
dynport/dgtk
opentsdb/main.go
parseLogEventLine
func parseLogEventLine(line string, mCfg MetricConfigurations) (*MetricValue, error) { mv := &MetricValue{} if e := mv.Parse(line); e != nil { return nil, e } if mCfg[mv.Key].Filter != nil { mv.Value = mCfg[mv.Key].Filter(mv.Value) } return mv, nil }
go
func parseLogEventLine(line string, mCfg MetricConfigurations) (*MetricValue, error) { mv := &MetricValue{} if e := mv.Parse(line); e != nil { return nil, e } if mCfg[mv.Key].Filter != nil { mv.Value = mCfg[mv.Key].Filter(mv.Value) } return mv, nil }
[ "func", "parseLogEventLine", "(", "line", "string", ",", "mCfg", "MetricConfigurations", ")", "(", "*", "MetricValue", ",", "error", ")", "{", "mv", ":=", "&", "MetricValue", "{", "}", "\n", "if", "e", ":=", "mv", ".", "Parse", "(", "line", ")", ";", ...
// Parse a single line of the result returned by OpenTSDB in ASCII mode.
[ "Parse", "a", "single", "line", "of", "the", "result", "returned", "by", "OpenTSDB", "in", "ASCII", "mode", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/main.go#L59-L68
147,177
dynport/dgtk
opentsdb/main.go
parseResponse
func parseResponse(content io.ReadCloser, mCfg MetricConfigurations) (MetricsTree, error) { scanner := bufio.NewScanner(content) mt := NewMetricsTree() cnt := 0 dur := map[string]time.Duration{} started := time.Now() for { cnt++ started := time.Now() if !scanner.Scan() { break } l := scanner.Text() ...
go
func parseResponse(content io.ReadCloser, mCfg MetricConfigurations) (MetricsTree, error) { scanner := bufio.NewScanner(content) mt := NewMetricsTree() cnt := 0 dur := map[string]time.Duration{} started := time.Now() for { cnt++ started := time.Now() if !scanner.Scan() { break } l := scanner.Text() ...
[ "func", "parseResponse", "(", "content", "io", ".", "ReadCloser", ",", "mCfg", "MetricConfigurations", ")", "(", "MetricsTree", ",", "error", ")", "{", "scanner", ":=", "bufio", ".", "NewScanner", "(", "content", ")", "\n", "mt", ":=", "NewMetricsTree", "(",...
// Parse the content of the ASCII based OpenTSDB response.
[ "Parse", "the", "content", "of", "the", "ASCII", "based", "OpenTSDB", "response", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/main.go#L71-L97
147,178
dynport/dgtk
opentsdb/main.go
GetData
func GetData(attrs *RequestParams) (MetricsTree, error) { url := createQueryURL(attrs) logger.Debug("Request URL is ", url) mCfg, err := createMetricConfigurations(attrs) if err != nil { return nil, err } logger.Debug("Starting request to OpenTSDB: " + url) resp, err := http.Get(url) if err != nil { retur...
go
func GetData(attrs *RequestParams) (MetricsTree, error) { url := createQueryURL(attrs) logger.Debug("Request URL is ", url) mCfg, err := createMetricConfigurations(attrs) if err != nil { return nil, err } logger.Debug("Starting request to OpenTSDB: " + url) resp, err := http.Get(url) if err != nil { retur...
[ "func", "GetData", "(", "attrs", "*", "RequestParams", ")", "(", "MetricsTree", ",", "error", ")", "{", "url", ":=", "createQueryURL", "(", "attrs", ")", "\n", "logger", ".", "Debug", "(", "\"", "\"", ",", "url", ")", "\n\n", "mCfg", ",", "err", ":="...
// Request data from OpenTSDB in ASCII format.
[ "Request", "data", "from", "OpenTSDB", "in", "ASCII", "format", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/opentsdb/main.go#L132-L159
147,179
dynport/dgtk
dockerclient/image.go
Images
func (dh *Client) Images() (images []*docker.Image, e error) { e = dh.getJSON(dh.Address+"/images/json", &images) return images, e }
go
func (dh *Client) Images() (images []*docker.Image, e error) { e = dh.getJSON(dh.Address+"/images/json", &images) return images, e }
[ "func", "(", "dh", "*", "Client", ")", "Images", "(", ")", "(", "images", "[", "]", "*", "docker", ".", "Image", ",", "e", "error", ")", "{", "e", "=", "dh", ".", "getJSON", "(", "dh", ".", "Address", "+", "\"", "\"", ",", "&", "images", ")",...
// Get the list of all images available on the this host.
[ "Get", "the", "list", "of", "all", "images", "available", "on", "the", "this", "host", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/image.go#L23-L26
147,180
dynport/dgtk
dockerclient/image.go
ImageHistory
func (dh *Client) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error) { imageHistory = &docker.ImageHistory{} e = dh.getJSON(dh.Address+"/images/"+id+"/history", imageHistory) return imageHistory, e }
go
func (dh *Client) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error) { imageHistory = &docker.ImageHistory{} e = dh.getJSON(dh.Address+"/images/"+id+"/history", imageHistory) return imageHistory, e }
[ "func", "(", "dh", "*", "Client", ")", "ImageHistory", "(", "id", "string", ")", "(", "imageHistory", "*", "docker", ".", "ImageHistory", ",", "e", "error", ")", "{", "imageHistory", "=", "&", "docker", ".", "ImageHistory", "{", "}", "\n", "e", "=", ...
// Get the given image's history.
[ "Get", "the", "given", "image", "s", "history", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/image.go#L35-L39
147,181
dynport/dgtk
dockerclient/image.go
BuildDockerfile
func (dh *Client) BuildDockerfile(dockerfile string, opts *BuildImageOptions) (imageId string, e error) { r, e := dh.createDockerfileArchive(dockerfile) if e != nil { return "", e } return dh.Build(r, opts) }
go
func (dh *Client) BuildDockerfile(dockerfile string, opts *BuildImageOptions) (imageId string, e error) { r, e := dh.createDockerfileArchive(dockerfile) if e != nil { return "", e } return dh.Build(r, opts) }
[ "func", "(", "dh", "*", "Client", ")", "BuildDockerfile", "(", "dockerfile", "string", ",", "opts", "*", "BuildImageOptions", ")", "(", "imageId", "string", ",", "e", "error", ")", "{", "r", ",", "e", ":=", "dh", ".", "createDockerfileArchive", "(", "doc...
// Create a new image from the given dockerfile. If name is non empty the new image is named accordingly. If a writer is // given it is used to send the docker output to.
[ "Create", "a", "new", "image", "from", "the", "given", "dockerfile", ".", "If", "name", "is", "non", "empty", "the", "new", "image", "is", "named", "accordingly", ".", "If", "a", "writer", "is", "given", "it", "is", "used", "to", "send", "the", "docker...
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/image.go#L67-L74
147,182
dynport/dgtk
dockerclient/image.go
Build
func (dh *Client) Build(r io.Reader, opts *BuildImageOptions) (imageId string, e error) { u := dh.Address + "/build" if opts == nil { opts = &BuildImageOptions{} } if enc := opts.encode(); enc != "" { u += "?" + enc } rsp, e := dh.postWithContentType(u, "application/tar", r) if e != nil { return "", e } ...
go
func (dh *Client) Build(r io.Reader, opts *BuildImageOptions) (imageId string, e error) { u := dh.Address + "/build" if opts == nil { opts = &BuildImageOptions{} } if enc := opts.encode(); enc != "" { u += "?" + enc } rsp, e := dh.postWithContentType(u, "application/tar", r) if e != nil { return "", e } ...
[ "func", "(", "dh", "*", "Client", ")", "Build", "(", "r", "io", ".", "Reader", ",", "opts", "*", "BuildImageOptions", ")", "(", "imageId", "string", ",", "e", "error", ")", "{", "u", ":=", "dh", ".", "Address", "+", "\"", "\"", "\n", "if", "opts"...
// Build a container image from a tar or tar.gz Reader
[ "Build", "a", "container", "image", "from", "a", "tar", "or", "tar", ".", "gz", "Reader" ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/image.go#L77-L93
147,183
dynport/dgtk
dockerclient/image.go
TagImage
func (dh *Client) TagImage(imageId, repository, tag string) (e error) { if repository == "" { return fmt.Errorf("empty repository given") } url := dh.Address + "/images/" + imageId + "/tag?repo=" + repository if tag != "" { url += "&tag=" + tag } rsp, e := dh.post(url) if e != nil { return e } return rs...
go
func (dh *Client) TagImage(imageId, repository, tag string) (e error) { if repository == "" { return fmt.Errorf("empty repository given") } url := dh.Address + "/images/" + imageId + "/tag?repo=" + repository if tag != "" { url += "&tag=" + tag } rsp, e := dh.post(url) if e != nil { return e } return rs...
[ "func", "(", "dh", "*", "Client", ")", "TagImage", "(", "imageId", ",", "repository", ",", "tag", "string", ")", "(", "e", "error", ")", "{", "if", "repository", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "...
// Tag the image with the given repository and tag. The tag is optional.
[ "Tag", "the", "image", "with", "the", "given", "repository", "and", "tag", ".", "The", "tag", "is", "optional", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/image.go#L96-L110
147,184
dynport/dgtk
dockerclient/image.go
DeleteImage
func (dh *Client) DeleteImage(name string) error { if name == "" { return fmt.Errorf("no image name given") } req, e := http.NewRequest("DELETE", dh.Address+"/images/"+name, nil) if e != nil { return e } resp, e := dh.Client.Do(req) if e != nil { return e } defer resp.Body.Close() if !success(resp) {...
go
func (dh *Client) DeleteImage(name string) error { if name == "" { return fmt.Errorf("no image name given") } req, e := http.NewRequest("DELETE", dh.Address+"/images/"+name, nil) if e != nil { return e } resp, e := dh.Client.Do(req) if e != nil { return e } defer resp.Body.Close() if !success(resp) {...
[ "func", "(", "dh", "*", "Client", ")", "DeleteImage", "(", "name", "string", ")", "error", "{", "if", "name", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "req", ",", "e", ":=", "http", ".", "N...
// Delete the given image from the docker host.
[ "Delete", "the", "given", "image", "from", "the", "docker", "host", "." ]
267e33d07f1763e0fd6e630517b9636317020881
https://github.com/dynport/dgtk/blob/267e33d07f1763e0fd6e630517b9636317020881/dockerclient/image.go#L198-L218
147,185
Financial-Times/content-rw-neo4j
content/content_service.go
Read
func (cd service) Read(uuid string, transId string) (interface{}, bool, error) { var results []struct { content } query := &neoism.CypherQuery{ Statement: `MATCH (n:Content {uuid:{uuid}}) OPTIONAL MATCH (sp:Thing)-[rel1:IS_CURATED_FOR]->(n) OPTIONAL MATCH (n)-[rel2:CONTAINS]->(cp:Thing) WITH n,sp,cp ...
go
func (cd service) Read(uuid string, transId string) (interface{}, bool, error) { var results []struct { content } query := &neoism.CypherQuery{ Statement: `MATCH (n:Content {uuid:{uuid}}) OPTIONAL MATCH (sp:Thing)-[rel1:IS_CURATED_FOR]->(n) OPTIONAL MATCH (n)-[rel2:CONTAINS]->(cp:Thing) WITH n,sp,cp ...
[ "func", "(", "cd", "service", ")", "Read", "(", "uuid", "string", ",", "transId", "string", ")", "(", "interface", "{", "}", ",", "bool", ",", "error", ")", "{", "var", "results", "[", "]", "struct", "{", "content", "\n", "}", "\n\n", "query", ":="...
// Read - reads a content given a UUID
[ "Read", "-", "reads", "a", "content", "given", "a", "UUID" ]
a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f
https://github.com/Financial-Times/content-rw-neo4j/blob/a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f/content/content_service.go#L50-L91
147,186
Financial-Times/content-rw-neo4j
content/content_service.go
Write
func (cd service) Write(thing interface{}, transId string) error { c := thing.(content) // Letting through only articles (which have body), live blogs, content packages, graphics, videos and audios (which don't have a body) if c.Body == "" && !contentTypesWithNoBody[c.Type] { logger.WithField(tid.TransactionIDKey...
go
func (cd service) Write(thing interface{}, transId string) error { c := thing.(content) // Letting through only articles (which have body), live blogs, content packages, graphics, videos and audios (which don't have a body) if c.Body == "" && !contentTypesWithNoBody[c.Type] { logger.WithField(tid.TransactionIDKey...
[ "func", "(", "cd", "service", ")", "Write", "(", "thing", "interface", "{", "}", ",", "transId", "string", ")", "error", "{", "c", ":=", "thing", ".", "(", "content", ")", "\n\n", "// Letting through only articles (which have body), live blogs, content packages, gra...
//Write - Writes a content node
[ "Write", "-", "Writes", "a", "content", "node" ]
a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f
https://github.com/Financial-Times/content-rw-neo4j/blob/a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f/content/content_service.go#L94-L173
147,187
Financial-Times/content-rw-neo4j
content/content_service.go
Delete
func (cd service) Delete(uuid string, transId string) (bool, error) { clearNode := &neoism.CypherQuery{ Statement: ` MATCH (p:Thing {uuid: {uuid}}) OPTIONAL MATCH (sp:Thing)-[rel1:IS_CURATED_FOR]->(p) OPTIONAL MATCH (p)-[rel2:CONTAINS]->(contained_cp:Thing) OPTIONAL MATCH (containing_cp:Thing)-[rel3:CONT...
go
func (cd service) Delete(uuid string, transId string) (bool, error) { clearNode := &neoism.CypherQuery{ Statement: ` MATCH (p:Thing {uuid: {uuid}}) OPTIONAL MATCH (sp:Thing)-[rel1:IS_CURATED_FOR]->(p) OPTIONAL MATCH (p)-[rel2:CONTAINS]->(contained_cp:Thing) OPTIONAL MATCH (containing_cp:Thing)-[rel3:CONT...
[ "func", "(", "cd", "service", ")", "Delete", "(", "uuid", "string", ",", "transId", "string", ")", "(", "bool", ",", "error", ")", "{", "clearNode", ":=", "&", "neoism", ".", "CypherQuery", "{", "Statement", ":", "`\n\t\t\tMATCH (p:Thing {uuid: {uuid}})\n\t\t\...
//Delete - Deletes a content
[ "Delete", "-", "Deletes", "a", "content" ]
a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f
https://github.com/Financial-Times/content-rw-neo4j/blob/a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f/content/content_service.go#L206-L256
147,188
Financial-Times/content-rw-neo4j
content/content_service.go
DecodeJSON
func (cd service) DecodeJSON(dec *json.Decoder) (interface{}, string, error) { c := content{} err := dec.Decode(&c) return c, c.UUID, err }
go
func (cd service) DecodeJSON(dec *json.Decoder) (interface{}, string, error) { c := content{} err := dec.Decode(&c) return c, c.UUID, err }
[ "func", "(", "cd", "service", ")", "DecodeJSON", "(", "dec", "*", "json", ".", "Decoder", ")", "(", "interface", "{", "}", ",", "string", ",", "error", ")", "{", "c", ":=", "content", "{", "}", "\n", "err", ":=", "dec", ".", "Decode", "(", "&", ...
// DecodeJSON - Decodes JSON into content
[ "DecodeJSON", "-", "Decodes", "JSON", "into", "content" ]
a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f
https://github.com/Financial-Times/content-rw-neo4j/blob/a8b4c6720d8e72c3eeb1fb22ff0138b6ae20e31f/content/content_service.go#L259-L264
147,189
Clever/gearadmin
gearadmin.go
Status
func (ga GearmanAdmin) Status() ([]Status, error) { var statuses []Status fmt.Fprintf(ga.conn, "status\n") scanner := bufio.NewScanner(ga.conn) for scanner.Scan() && scanner.Text() != "." { toks := strings.Split(scanner.Text(), "\t") if len(toks) != 4 { return statuses, fmt.Errorf("unexpected status: '%s'", ...
go
func (ga GearmanAdmin) Status() ([]Status, error) { var statuses []Status fmt.Fprintf(ga.conn, "status\n") scanner := bufio.NewScanner(ga.conn) for scanner.Scan() && scanner.Text() != "." { toks := strings.Split(scanner.Text(), "\t") if len(toks) != 4 { return statuses, fmt.Errorf("unexpected status: '%s'", ...
[ "func", "(", "ga", "GearmanAdmin", ")", "Status", "(", ")", "(", "[", "]", "Status", ",", "error", ")", "{", "var", "statuses", "[", "]", "Status", "\n", "fmt", ".", "Fprintf", "(", "ga", ".", "conn", ",", "\"", "\\n", "\"", ")", "\n", "scanner",...
// Status returns the status of all function queues.
[ "Status", "returns", "the", "status", "of", "all", "function", "queues", "." ]
c2f7fbb1daf9b08d5dbc899653a52ff5b3f0531e
https://github.com/Clever/gearadmin/blob/c2f7fbb1daf9b08d5dbc899653a52ff5b3f0531e/gearadmin.go#L38-L67
147,190
Clever/gearadmin
gearadmin.go
Workers
func (ga GearmanAdmin) Workers() ([]Worker, error) { var workers []Worker fmt.Fprintf(ga.conn, "workers\n") scanner := bufio.NewScanner(ga.conn) for scanner.Scan() && scanner.Text() != "." { toks := strings.Split(scanner.Text(), " ") if len(toks) < 4 { return workers, fmt.Errorf("unexpected worker: '%s'", sc...
go
func (ga GearmanAdmin) Workers() ([]Worker, error) { var workers []Worker fmt.Fprintf(ga.conn, "workers\n") scanner := bufio.NewScanner(ga.conn) for scanner.Scan() && scanner.Text() != "." { toks := strings.Split(scanner.Text(), " ") if len(toks) < 4 { return workers, fmt.Errorf("unexpected worker: '%s'", sc...
[ "func", "(", "ga", "GearmanAdmin", ")", "Workers", "(", ")", "(", "[", "]", "Worker", ",", "error", ")", "{", "var", "workers", "[", "]", "Worker", "\n", "fmt", ".", "Fprintf", "(", "ga", ".", "conn", ",", "\"", "\\n", "\"", ")", "\n", "scanner",...
// Workers returns a summary of workers connected to gearman.
[ "Workers", "returns", "a", "summary", "of", "workers", "connected", "to", "gearman", "." ]
c2f7fbb1daf9b08d5dbc899653a52ff5b3f0531e
https://github.com/Clever/gearadmin/blob/c2f7fbb1daf9b08d5dbc899653a52ff5b3f0531e/gearadmin.go#L70-L87
147,191
apex/httplog
httplog.go
WriteHeader
func (w *wrapper) WriteHeader(code int) { w.status = code w.ResponseWriter.WriteHeader(code) }
go
func (w *wrapper) WriteHeader(code int) { w.status = code w.ResponseWriter.WriteHeader(code) }
[ "func", "(", "w", "*", "wrapper", ")", "WriteHeader", "(", "code", "int", ")", "{", "w", ".", "status", "=", "code", "\n", "w", ".", "ResponseWriter", ".", "WriteHeader", "(", "code", ")", "\n", "}" ]
// WriteHeader wrapper to capture status code.
[ "WriteHeader", "wrapper", "to", "capture", "status", "code", "." ]
d677fdf2ae1fa75d8111faf17f2d6fcf46dd9af7
https://github.com/apex/httplog/blob/d677fdf2ae1fa75d8111faf17f2d6fcf46dd9af7/httplog.go#L31-L34
147,192
apex/httplog
httplog.go
Write
func (w *wrapper) Write(b []byte) (int, error) { n, err := w.ResponseWriter.Write(b) w.written += n return n, err }
go
func (w *wrapper) Write(b []byte) (int, error) { n, err := w.ResponseWriter.Write(b) w.written += n return n, err }
[ "func", "(", "w", "*", "wrapper", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "n", ",", "err", ":=", "w", ".", "ResponseWriter", ".", "Write", "(", "b", ")", "\n", "w", ".", "written", "+=", "n", "\n", ...
// Write wrapper to capture response size.
[ "Write", "wrapper", "to", "capture", "response", "size", "." ]
d677fdf2ae1fa75d8111faf17f2d6fcf46dd9af7
https://github.com/apex/httplog/blob/d677fdf2ae1fa75d8111faf17f2d6fcf46dd9af7/httplog.go#L37-L41
147,193
pubnub/go-metrics-statsd
statsd.go
StatsD
func StatsD(r metrics.Registry, d time.Duration, prefix string, addr *net.UDPAddr) { StatsDWithConfig(StatsDConfig{ Addr: addr, Registry: r, FlushInterval: d, DurationUnit: time.Nanosecond, Prefix: prefix, Percentiles: []float64{0.5, 0.75, 0.95, 0.99, 0.999}, }) }
go
func StatsD(r metrics.Registry, d time.Duration, prefix string, addr *net.UDPAddr) { StatsDWithConfig(StatsDConfig{ Addr: addr, Registry: r, FlushInterval: d, DurationUnit: time.Nanosecond, Prefix: prefix, Percentiles: []float64{0.5, 0.75, 0.95, 0.99, 0.999}, }) }
[ "func", "StatsD", "(", "r", "metrics", ".", "Registry", ",", "d", "time", ".", "Duration", ",", "prefix", "string", ",", "addr", "*", "net", ".", "UDPAddr", ")", "{", "StatsDWithConfig", "(", "StatsDConfig", "{", "Addr", ":", "addr", ",", "Registry", "...
// StatsD is a blocking exporter function which reports metrics in r // to a statsd server located at addr, flushing them every d duration // and prepending metric names with prefix.
[ "StatsD", "is", "a", "blocking", "exporter", "function", "which", "reports", "metrics", "in", "r", "to", "a", "statsd", "server", "located", "at", "addr", "flushing", "them", "every", "d", "duration", "and", "prepending", "metric", "names", "with", "prefix", ...
7da61f429d6bdaa79d5d5746998e0db9622c56fc
https://github.com/pubnub/go-metrics-statsd/blob/7da61f429d6bdaa79d5d5746998e0db9622c56fc/statsd.go#L30-L39
147,194
pubnub/go-metrics-statsd
statsd.go
StatsDWithConfig
func StatsDWithConfig(c StatsDConfig) { for _ = range time.Tick(c.FlushInterval) { if err := statsd(&c); nil != err { log.Println(err) } } }
go
func StatsDWithConfig(c StatsDConfig) { for _ = range time.Tick(c.FlushInterval) { if err := statsd(&c); nil != err { log.Println(err) } } }
[ "func", "StatsDWithConfig", "(", "c", "StatsDConfig", ")", "{", "for", "_", "=", "range", "time", ".", "Tick", "(", "c", ".", "FlushInterval", ")", "{", "if", "err", ":=", "statsd", "(", "&", "c", ")", ";", "nil", "!=", "err", "{", "log", ".", "P...
// StatsDWithConfig is a blocking exporter function just like StatsD, // but it takes a StatsDConfig instead.
[ "StatsDWithConfig", "is", "a", "blocking", "exporter", "function", "just", "like", "StatsD", "but", "it", "takes", "a", "StatsDConfig", "instead", "." ]
7da61f429d6bdaa79d5d5746998e0db9622c56fc
https://github.com/pubnub/go-metrics-statsd/blob/7da61f429d6bdaa79d5d5746998e0db9622c56fc/statsd.go#L43-L49
147,195
dajohi/goemail
email.go
NewMessageType
func NewMessageType(from, subject, body, contentType string) *Message { // Allow addresses of the form "Alice <alice@example.com>". fromAddr, err := mail.ParseAddress(from) if err != nil { return nil } // Create the message with the parsed from address. m := newMessage(fromAddr.Address, subject, body, contentT...
go
func NewMessageType(from, subject, body, contentType string) *Message { // Allow addresses of the form "Alice <alice@example.com>". fromAddr, err := mail.ParseAddress(from) if err != nil { return nil } // Create the message with the parsed from address. m := newMessage(fromAddr.Address, subject, body, contentT...
[ "func", "NewMessageType", "(", "from", ",", "subject", ",", "body", ",", "contentType", "string", ")", "*", "Message", "{", "// Allow addresses of the form \"Alice <alice@example.com>\".", "fromAddr", ",", "err", ":=", "mail", ".", "ParseAddress", "(", "from", ")", ...
// NewMessageType creates a new email with the specified content-type.
[ "NewMessageType", "creates", "a", "new", "email", "with", "the", "specified", "content", "-", "type", "." ]
2e68548ea8bb950e454918222398598a8aad0e60
https://github.com/dajohi/goemail/blob/2e68548ea8bb950e454918222398598a8aad0e60/email.go#L65-L80
147,196
dajohi/goemail
email.go
AddAttachment
func (m *Message) AddAttachment(filename string, attachment []byte) { m.attachments[filename] = attachment }
go
func (m *Message) AddAttachment(filename string, attachment []byte) { m.attachments[filename] = attachment }
[ "func", "(", "m", "*", "Message", ")", "AddAttachment", "(", "filename", "string", ",", "attachment", "[", "]", "byte", ")", "{", "m", ".", "attachments", "[", "filename", "]", "=", "attachment", "\n", "}" ]
// AddAttachment adds the provided attachment to the message.
[ "AddAttachment", "adds", "the", "provided", "attachment", "to", "the", "message", "." ]
2e68548ea8bb950e454918222398598a8aad0e60
https://github.com/dajohi/goemail/blob/2e68548ea8bb950e454918222398598a8aad0e60/email.go#L93-L95
147,197
dajohi/goemail
email.go
AddAttachmentFromFile
func (m *Message) AddAttachmentFromFile(filename string) error { a, err := ioutil.ReadFile(filename) if err != nil { return err } m.attachments[filename] = a return nil }
go
func (m *Message) AddAttachmentFromFile(filename string) error { a, err := ioutil.ReadFile(filename) if err != nil { return err } m.attachments[filename] = a return nil }
[ "func", "(", "m", "*", "Message", ")", "AddAttachmentFromFile", "(", "filename", "string", ")", "error", "{", "a", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n...
// AddAttachmentFromFile adds an attachment specified by filename to the // message.
[ "AddAttachmentFromFile", "adds", "an", "attachment", "specified", "by", "filename", "to", "the", "message", "." ]
2e68548ea8bb950e454918222398598a8aad0e60
https://github.com/dajohi/goemail/blob/2e68548ea8bb950e454918222398598a8aad0e60/email.go#L99-L106
147,198
dajohi/goemail
email.go
IsValidAddress
func IsValidAddress(addr string) bool { _, err := mail.ParseAddress(addr) return err == nil }
go
func IsValidAddress(addr string) bool { _, err := mail.ParseAddress(addr) return err == nil }
[ "func", "IsValidAddress", "(", "addr", "string", ")", "bool", "{", "_", ",", "err", ":=", "mail", ".", "ParseAddress", "(", "addr", ")", "\n", "return", "err", "==", "nil", "\n", "}" ]
// IsValidAddress validates the input email address, returning false if the // address cannot be parsed by mail.ParseAddress.
[ "IsValidAddress", "validates", "the", "input", "email", "address", "returning", "false", "if", "the", "address", "cannot", "be", "parsed", "by", "mail", ".", "ParseAddress", "." ]
2e68548ea8bb950e454918222398598a8aad0e60
https://github.com/dajohi/goemail/blob/2e68548ea8bb950e454918222398598a8aad0e60/email.go#L110-L113
147,199
dajohi/goemail
email.go
AddCC
func (m *Message) AddCC(emailAddr string) { m.cc = append(m.cc, emailAddr) }
go
func (m *Message) AddCC(emailAddr string) { m.cc = append(m.cc, emailAddr) }
[ "func", "(", "m", "*", "Message", ")", "AddCC", "(", "emailAddr", "string", ")", "{", "m", ".", "cc", "=", "append", "(", "m", ".", "cc", ",", "emailAddr", ")", "\n", "}" ]
// AddCC adds a single email address to the CC list.
[ "AddCC", "adds", "a", "single", "email", "address", "to", "the", "CC", "list", "." ]
2e68548ea8bb950e454918222398598a8aad0e60
https://github.com/dajohi/goemail/blob/2e68548ea8bb950e454918222398598a8aad0e60/email.go#L116-L118