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
153,100
deis/controller-sdk-go
certs/certs.go
Delete
func Delete(c *deis.Client, name string) error { url := fmt.Sprintf("/v2/certs/%s", name) res, err := c.Request("DELETE", url, nil) if err == nil { res.Body.Close() } return err }
go
func Delete(c *deis.Client, name string) error { url := fmt.Sprintf("/v2/certs/%s", name) res, err := c.Request("DELETE", url, nil) if err == nil { res.Body.Close() } return err }
[ "func", "Delete", "(", "c", "*", "deis", ".", "Client", ",", "name", "string", ")", "error", "{", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", "\n", "res", ",", "err", ":=", "c", ".", "Request", "(", "\"", "\"", ",", ...
// Delete removes a certificate.
[ "Delete", "removes", "a", "certificate", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/certs/certs.go#L71-L78
153,101
deis/controller-sdk-go
certs/certs.go
Attach
func Attach(c *deis.Client, name string, domain string) error { req := api.CertAttachRequest{Domain: domain} reqBody, err := json.Marshal(req) if err != nil { return err } url := fmt.Sprintf("/v2/certs/%s/domain/", name) res, err := c.Request("POST", url, reqBody) if err == nil { res.Body.Close() } return err }
go
func Attach(c *deis.Client, name string, domain string) error { req := api.CertAttachRequest{Domain: domain} reqBody, err := json.Marshal(req) if err != nil { return err } url := fmt.Sprintf("/v2/certs/%s/domain/", name) res, err := c.Request("POST", url, reqBody) if err == nil { res.Body.Close() } return err }
[ "func", "Attach", "(", "c", "*", "deis", ".", "Client", ",", "name", "string", ",", "domain", "string", ")", "error", "{", "req", ":=", "api", ".", "CertAttachRequest", "{", "Domain", ":", "domain", "}", "\n", "reqBody", ",", "err", ":=", "json", "."...
// Attach adds a domain to a certificate.
[ "Attach", "adds", "a", "domain", "to", "a", "certificate", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/certs/certs.go#L81-L94
153,102
deis/controller-sdk-go
appsettings/appsettings.go
List
func List(c *deis.Client, app string) (api.AppSettings, error) { u := fmt.Sprintf("/v2/apps/%s/settings/", app) res, reqErr := c.Request("GET", u, nil) if reqErr != nil { return api.AppSettings{}, reqErr } defer res.Body.Close() settings := api.AppSettings{} if err := json.NewDecoder(res.Body).Decode(&settings); err != nil { return api.AppSettings{}, err } return settings, reqErr }
go
func List(c *deis.Client, app string) (api.AppSettings, error) { u := fmt.Sprintf("/v2/apps/%s/settings/", app) res, reqErr := c.Request("GET", u, nil) if reqErr != nil { return api.AppSettings{}, reqErr } defer res.Body.Close() settings := api.AppSettings{} if err := json.NewDecoder(res.Body).Decode(&settings); err != nil { return api.AppSettings{}, err } return settings, reqErr }
[ "func", "List", "(", "c", "*", "deis", ".", "Client", ",", "app", "string", ")", "(", "api", ".", "AppSettings", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "app", ")", "\n\n", "res", ",", "reqErr", ":=", "c"...
// List lists an app's settings.
[ "List", "lists", "an", "app", "s", "settings", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/appsettings/appsettings.go#L13-L28
153,103
deis/controller-sdk-go
hooks/hooks.go
UserFromKey
func UserFromKey(c *deis.Client, fingerprint string) (api.UserApps, error) { res, reqErr := c.Request("GET", fmt.Sprintf("/v2/hooks/key/%s", fingerprint), nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.UserApps{}, reqErr } defer res.Body.Close() resUser := api.UserApps{} if err := json.NewDecoder(res.Body).Decode(&resUser); err != nil { return api.UserApps{}, err } return resUser, reqErr }
go
func UserFromKey(c *deis.Client, fingerprint string) (api.UserApps, error) { res, reqErr := c.Request("GET", fmt.Sprintf("/v2/hooks/key/%s", fingerprint), nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.UserApps{}, reqErr } defer res.Body.Close() resUser := api.UserApps{} if err := json.NewDecoder(res.Body).Decode(&resUser); err != nil { return api.UserApps{}, err } return resUser, reqErr }
[ "func", "UserFromKey", "(", "c", "*", "deis", ".", "Client", ",", "fingerprint", "string", ")", "(", "api", ".", "UserApps", ",", "error", ")", "{", "res", ",", "reqErr", ":=", "c", ".", "Request", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", ...
// UserFromKey retrives a user from their SSH key fingerprint.
[ "UserFromKey", "retrives", "a", "user", "from", "their", "SSH", "key", "fingerprint", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/hooks/hooks.go#L15-L29
153,104
deis/controller-sdk-go
hooks/hooks.go
GetAppConfig
func GetAppConfig(c *deis.Client, username, app string) (api.Config, error) { req := api.ConfigHookRequest{User: username, App: app} b, err := json.Marshal(req) if err != nil { return api.Config{}, err } res, reqErr := c.Request("POST", "/v2/hooks/config/", b) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.Config{}, reqErr } defer res.Body.Close() config := api.Config{} if err := json.NewDecoder(res.Body).Decode(&config); err != nil { return api.Config{}, err } return config, reqErr }
go
func GetAppConfig(c *deis.Client, username, app string) (api.Config, error) { req := api.ConfigHookRequest{User: username, App: app} b, err := json.Marshal(req) if err != nil { return api.Config{}, err } res, reqErr := c.Request("POST", "/v2/hooks/config/", b) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.Config{}, reqErr } defer res.Body.Close() config := api.Config{} if err := json.NewDecoder(res.Body).Decode(&config); err != nil { return api.Config{}, err } return config, reqErr }
[ "func", "GetAppConfig", "(", "c", "*", "deis", ".", "Client", ",", "username", ",", "app", "string", ")", "(", "api", ".", "Config", ",", "error", ")", "{", "req", ":=", "api", ".", "ConfigHookRequest", "{", "User", ":", "username", ",", "App", ":", ...
// GetAppConfig retrives an app's configuration from the controller.
[ "GetAppConfig", "retrives", "an", "app", "s", "configuration", "from", "the", "controller", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/hooks/hooks.go#L32-L51
153,105
deis/controller-sdk-go
tls/tls.go
Info
func Info(c *deis.Client, app string) (api.TLS, error) { u := fmt.Sprintf("/v2/apps/%s/tls/", app) res, reqErr := c.Request("GET", u, nil) if reqErr != nil { return api.TLS{}, reqErr } defer res.Body.Close() tls := api.TLS{} if err := json.NewDecoder(res.Body).Decode(&tls); err != nil { return api.TLS{}, err } return tls, reqErr }
go
func Info(c *deis.Client, app string) (api.TLS, error) { u := fmt.Sprintf("/v2/apps/%s/tls/", app) res, reqErr := c.Request("GET", u, nil) if reqErr != nil { return api.TLS{}, reqErr } defer res.Body.Close() tls := api.TLS{} if err := json.NewDecoder(res.Body).Decode(&tls); err != nil { return api.TLS{}, err } return tls, reqErr }
[ "func", "Info", "(", "c", "*", "deis", ".", "Client", ",", "app", "string", ")", "(", "api", ".", "TLS", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "app", ")", "\n\n", "res", ",", "reqErr", ":=", "c", ".",...
// Info displays an app's tls config.
[ "Info", "displays", "an", "app", "s", "tls", "config", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/tls/tls.go#L13-L28
153,106
deis/controller-sdk-go
tls/tls.go
Enable
func Enable(c *deis.Client, app string) (api.TLS, error) { t := api.NewTLS() b := true t.HTTPSEnforced = &b body, err := json.Marshal(t) if err != nil { return api.TLS{}, err } u := fmt.Sprintf("/v2/apps/%s/tls/", app) res, reqErr := c.Request("POST", u, body) if reqErr != nil { return api.TLS{}, reqErr } defer res.Body.Close() newTLS := api.TLS{} if err = json.NewDecoder(res.Body).Decode(&newTLS); err != nil { return api.TLS{}, err } return newTLS, reqErr }
go
func Enable(c *deis.Client, app string) (api.TLS, error) { t := api.NewTLS() b := true t.HTTPSEnforced = &b body, err := json.Marshal(t) if err != nil { return api.TLS{}, err } u := fmt.Sprintf("/v2/apps/%s/tls/", app) res, reqErr := c.Request("POST", u, body) if reqErr != nil { return api.TLS{}, reqErr } defer res.Body.Close() newTLS := api.TLS{} if err = json.NewDecoder(res.Body).Decode(&newTLS); err != nil { return api.TLS{}, err } return newTLS, reqErr }
[ "func", "Enable", "(", "c", "*", "deis", ".", "Client", ",", "app", "string", ")", "(", "api", ".", "TLS", ",", "error", ")", "{", "t", ":=", "api", ".", "NewTLS", "(", ")", "\n", "b", ":=", "true", "\n", "t", ".", "HTTPSEnforced", "=", "&", ...
// Enable enables the router to enforce https-only requests to the application.
[ "Enable", "enables", "the", "router", "to", "enforce", "https", "-", "only", "requests", "to", "the", "application", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/tls/tls.go#L31-L55
153,107
deis/controller-sdk-go
api/config.go
String
func (h Healthcheck) String() string { var doc bytes.Buffer tmpl, err := template.New("healthcheck").Parse(`Initial Delay (seconds): {{.InitialDelaySeconds}} Timeout (seconds): {{.TimeoutSeconds}} Period (seconds): {{.PeriodSeconds}} Success Threshold: {{.SuccessThreshold}} Failure Threshold: {{.FailureThreshold}} Exec Probe: {{or .Exec "N/A"}} HTTP GET Probe: {{or .HTTPGet "N/A"}} TCP Socket Probe: {{or .TCPSocket "N/A"}}`) if err != nil { panic(err) } if err := tmpl.Execute(&doc, h); err != nil { panic(err) } return doc.String() }
go
func (h Healthcheck) String() string { var doc bytes.Buffer tmpl, err := template.New("healthcheck").Parse(`Initial Delay (seconds): {{.InitialDelaySeconds}} Timeout (seconds): {{.TimeoutSeconds}} Period (seconds): {{.PeriodSeconds}} Success Threshold: {{.SuccessThreshold}} Failure Threshold: {{.FailureThreshold}} Exec Probe: {{or .Exec "N/A"}} HTTP GET Probe: {{or .HTTPGet "N/A"}} TCP Socket Probe: {{or .TCPSocket "N/A"}}`) if err != nil { panic(err) } if err := tmpl.Execute(&doc, h); err != nil { panic(err) } return doc.String() }
[ "func", "(", "h", "Healthcheck", ")", "String", "(", ")", "string", "{", "var", "doc", "bytes", ".", "Buffer", "\n", "tmpl", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "`Initial Delay (seconds): {{.InitialDelaySecond...
// String displays the HealthcheckHTTPGetProbe in a readable format.
[ "String", "displays", "the", "HealthcheckHTTPGetProbe", "in", "a", "readable", "format", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/api/config.go#L74-L91
153,108
deis/controller-sdk-go
api/config.go
String
func (h HTTPGetProbe) String() string { return fmt.Sprintf(`Path="%s" Port=%d HTTPHeaders=%s`, h.Path, h.Port, h.HTTPHeaders) }
go
func (h HTTPGetProbe) String() string { return fmt.Sprintf(`Path="%s" Port=%d HTTPHeaders=%s`, h.Path, h.Port, h.HTTPHeaders) }
[ "func", "(", "h", "HTTPGetProbe", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`Path=\"%s\" Port=%d HTTPHeaders=%s`", ",", "h", ".", "Path", ",", "h", ".", "Port", ",", "h", ".", "HTTPHeaders", ")", "\n", "}" ]
// String displays the HTTPGetProbe in a readable format.
[ "String", "displays", "the", "HTTPGetProbe", "in", "a", "readable", "format", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/api/config.go#L123-L128
153,109
deis/controller-sdk-go
auth/auth.go
Register
func Register(c *deis.Client, username, password, email string) error { user := api.AuthRegisterRequest{Username: username, Password: password, Email: email} body, err := json.Marshal(user) if err != nil { return err } res, err := c.Request("POST", "/v2/auth/register/", body) if err == nil { res.Body.Close() } return err }
go
func Register(c *deis.Client, username, password, email string) error { user := api.AuthRegisterRequest{Username: username, Password: password, Email: email} body, err := json.Marshal(user) if err != nil { return err } res, err := c.Request("POST", "/v2/auth/register/", body) if err == nil { res.Body.Close() } return err }
[ "func", "Register", "(", "c", "*", "deis", ".", "Client", ",", "username", ",", "password", ",", "email", "string", ")", "error", "{", "user", ":=", "api", ".", "AuthRegisterRequest", "{", "Username", ":", "username", ",", "Password", ":", "password", ",...
// Register a new user with the controller. // If controller registration is set to administrators only, a valid administrative // user token is required in the client.
[ "Register", "a", "new", "user", "with", "the", "controller", ".", "If", "controller", "registration", "is", "set", "to", "administrators", "only", "a", "valid", "administrative", "user", "token", "is", "required", "in", "the", "client", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/auth/auth.go#L14-L27
153,110
deis/controller-sdk-go
auth/auth.go
Regenerate
func Regenerate(c *deis.Client, username string, all bool) (string, error) { var reqBody []byte var err error if all { reqBody, err = json.Marshal(api.AuthRegenerateRequest{All: all}) } else if username != "" { reqBody, err = json.Marshal(api.AuthRegenerateRequest{Name: username}) } if err != nil { return "", err } res, reqErr := c.Request("POST", "/v2/auth/tokens/", reqBody) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return "", reqErr } defer res.Body.Close() if all { return "", nil } token := api.AuthRegenerateResponse{} if err = json.NewDecoder(res.Body).Decode(&token); err != nil { return "", err } return token.Token, reqErr }
go
func Regenerate(c *deis.Client, username string, all bool) (string, error) { var reqBody []byte var err error if all { reqBody, err = json.Marshal(api.AuthRegenerateRequest{All: all}) } else if username != "" { reqBody, err = json.Marshal(api.AuthRegenerateRequest{Name: username}) } if err != nil { return "", err } res, reqErr := c.Request("POST", "/v2/auth/tokens/", reqBody) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return "", reqErr } defer res.Body.Close() if all { return "", nil } token := api.AuthRegenerateResponse{} if err = json.NewDecoder(res.Body).Decode(&token); err != nil { return "", err } return token.Token, reqErr }
[ "func", "Regenerate", "(", "c", "*", "deis", ".", "Client", ",", "username", "string", ",", "all", "bool", ")", "(", "string", ",", "error", ")", "{", "var", "reqBody", "[", "]", "byte", "\n", "var", "err", "error", "\n\n", "if", "all", "{", "reqBo...
// Regenerate auth tokens. This invalidates existing tokens, and if targeting a specific user // returns a new token. // // If username is an empty string and all is false, this regenerates the // client user's token and will return a new token. Make sure to update the client token // with this new token to avoid authentication errors. // // If username is set and all is false, this will regenerate that user's token // and return a new token. If not targeting yourself, regenerate requires administrative privileges. // // If all is true, this will regenerate every user's token. This requires administrative privileges.
[ "Regenerate", "auth", "tokens", ".", "This", "invalidates", "existing", "tokens", "and", "if", "targeting", "a", "specific", "user", "returns", "a", "new", "token", ".", "If", "username", "is", "an", "empty", "string", "and", "all", "is", "false", "this", ...
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/auth/auth.go#L84-L114
153,111
deis/controller-sdk-go
auth/auth.go
Passwd
func Passwd(c *deis.Client, username, password, newPassword string) error { req := api.AuthPasswdRequest{Password: password, NewPassword: newPassword} if username != "" { req.Username = username } body, err := json.Marshal(req) if err != nil { return err } res, err := c.Request("POST", "/v2/auth/passwd/", body) if err == nil { res.Body.Close() } return err }
go
func Passwd(c *deis.Client, username, password, newPassword string) error { req := api.AuthPasswdRequest{Password: password, NewPassword: newPassword} if username != "" { req.Username = username } body, err := json.Marshal(req) if err != nil { return err } res, err := c.Request("POST", "/v2/auth/passwd/", body) if err == nil { res.Body.Close() } return err }
[ "func", "Passwd", "(", "c", "*", "deis", ".", "Client", ",", "username", ",", "password", ",", "newPassword", "string", ")", "error", "{", "req", ":=", "api", ".", "AuthPasswdRequest", "{", "Password", ":", "password", ",", "NewPassword", ":", "newPassword...
// Passwd changes a user's password. // // If username if an empty string, change the password of the client's user. // // If username is set, change the password of another user and do not require // their password. This requires administrative privileges.
[ "Passwd", "changes", "a", "user", "s", "password", ".", "If", "username", "if", "an", "empty", "string", "change", "the", "password", "of", "the", "client", "s", "user", ".", "If", "username", "is", "set", "change", "the", "password", "of", "another", "u...
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/auth/auth.go#L122-L140
153,112
deis/controller-sdk-go
auth/auth.go
Whoami
func Whoami(c *deis.Client) (api.User, error) { res, err := c.Request("GET", "/v2/auth/whoami/", nil) if err != nil { return api.User{}, err } defer res.Body.Close() resUser := api.User{} if err = json.NewDecoder(res.Body).Decode(&resUser); err != nil { return api.User{}, err } return resUser, nil }
go
func Whoami(c *deis.Client) (api.User, error) { res, err := c.Request("GET", "/v2/auth/whoami/", nil) if err != nil { return api.User{}, err } defer res.Body.Close() resUser := api.User{} if err = json.NewDecoder(res.Body).Decode(&resUser); err != nil { return api.User{}, err } return resUser, nil }
[ "func", "Whoami", "(", "c", "*", "deis", ".", "Client", ")", "(", "api", ".", "User", ",", "error", ")", "{", "res", ",", "err", ":=", "c", ".", "Request", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "...
// Whoami retrives the user object for the authenticated user.
[ "Whoami", "retrives", "the", "user", "object", "for", "the", "authenticated", "user", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/auth/auth.go#L143-L156
153,113
bulletind/khabar
dbapi/stats/dbapi.go
Save
func Save(args *RequestArgs) error { user := args.User appName := args.AppName org := args.Organization stats_query := utils.M{ "user": user, "app_name": appName, "org": org, } save_doc := utils.M{ "user": user, "app_name": appName, "org": org, "timestamp": utils.EpochNow(), } return db.Conn.Upsert(db.StatsCollection, stats_query, save_doc) }
go
func Save(args *RequestArgs) error { user := args.User appName := args.AppName org := args.Organization stats_query := utils.M{ "user": user, "app_name": appName, "org": org, } save_doc := utils.M{ "user": user, "app_name": appName, "org": org, "timestamp": utils.EpochNow(), } return db.Conn.Upsert(db.StatsCollection, stats_query, save_doc) }
[ "func", "Save", "(", "args", "*", "RequestArgs", ")", "error", "{", "user", ":=", "args", ".", "User", "\n", "appName", ":=", "args", ".", "AppName", "\n", "org", ":=", "args", ".", "Organization", "\n\n", "stats_query", ":=", "utils", ".", "M", "{", ...
// Save updates the last seen time stamp if the record already exists for the user // otherwise it creates one
[ "Save", "updates", "the", "last", "seen", "time", "stamp", "if", "the", "record", "already", "exists", "for", "the", "user", "otherwise", "it", "creates", "one" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/dbapi/stats/dbapi.go#L27-L46
153,114
bulletind/khabar
dbapi/stats/dbapi.go
Get
func Get(args *RequestArgs) (stats *Stats, err error) { user := args.User appName := args.AppName org := args.Organization stats = &Stats{} stats_query := utils.M{} unread_query := utils.M{"is_read": false} unread_since_query := utils.M{"is_read": false} stats_query["user"] = user unread_query["user"] = user unread_since_query["user"] = user if len(appName) > 0 { stats_query["app_name"] = appName unread_query["app_name"] = appName unread_since_query["app_name"] = appName } if len(org) > 0 { stats_query["org"] = org unread_query["org"] = org unread_since_query["org"] = org } var last_seen db.LastSeen err = db.Conn.GetOne(db.StatsCollection, stats_query, &last_seen) if err != nil { err = Save(args) if err == nil { err = db.Conn.GetOne(db.StatsCollection, stats_query, &last_seen) } else { log.Println(err) return nil, err } } if last_seen.Timestamp > 0 { unread_since_query["created_on"] = utils.M{"$gt": last_seen.Timestamp} } stats.LastSeen = last_seen.Timestamp var wg sync.WaitGroup wg.Add(3) var unread_count, total_count, total_unread int go func() { defer wg.Done() total_count = db.Conn.Count(db.SentCollection, stats_query) }() go func() { defer wg.Done() unread_count = db.Conn.Count(db.SentCollection, unread_since_query) }() go func() { defer wg.Done() total_unread = db.Conn.Count(db.SentCollection, unread_query) }() wg.Wait() stats.TotalCount = total_count stats.TotalUnread = total_unread stats.UnreadCount = unread_count return }
go
func Get(args *RequestArgs) (stats *Stats, err error) { user := args.User appName := args.AppName org := args.Organization stats = &Stats{} stats_query := utils.M{} unread_query := utils.M{"is_read": false} unread_since_query := utils.M{"is_read": false} stats_query["user"] = user unread_query["user"] = user unread_since_query["user"] = user if len(appName) > 0 { stats_query["app_name"] = appName unread_query["app_name"] = appName unread_since_query["app_name"] = appName } if len(org) > 0 { stats_query["org"] = org unread_query["org"] = org unread_since_query["org"] = org } var last_seen db.LastSeen err = db.Conn.GetOne(db.StatsCollection, stats_query, &last_seen) if err != nil { err = Save(args) if err == nil { err = db.Conn.GetOne(db.StatsCollection, stats_query, &last_seen) } else { log.Println(err) return nil, err } } if last_seen.Timestamp > 0 { unread_since_query["created_on"] = utils.M{"$gt": last_seen.Timestamp} } stats.LastSeen = last_seen.Timestamp var wg sync.WaitGroup wg.Add(3) var unread_count, total_count, total_unread int go func() { defer wg.Done() total_count = db.Conn.Count(db.SentCollection, stats_query) }() go func() { defer wg.Done() unread_count = db.Conn.Count(db.SentCollection, unread_since_query) }() go func() { defer wg.Done() total_unread = db.Conn.Count(db.SentCollection, unread_query) }() wg.Wait() stats.TotalCount = total_count stats.TotalUnread = total_unread stats.UnreadCount = unread_count return }
[ "func", "Get", "(", "args", "*", "RequestArgs", ")", "(", "stats", "*", "Stats", ",", "err", "error", ")", "{", "user", ":=", "args", ".", "User", "\n", "appName", ":=", "args", ".", "AppName", "\n", "org", ":=", "args", ".", "Organization", "\n\n", ...
// Get returns notification stats like when was it last seen, total count, // unread count and total unread
[ "Get", "returns", "notification", "stats", "like", "when", "was", "it", "last", "seen", "total", "count", "unread", "count", "and", "total", "unread" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/dbapi/stats/dbapi.go#L50-L123
153,115
deis/controller-sdk-go
ps/ps.go
Scale
func Scale(c *deis.Client, appID string, targets map[string]int) error { u := fmt.Sprintf("/v2/apps/%s/scale/", appID) body, err := json.Marshal(targets) if err != nil { return err } res, err := c.Request("POST", u, body) if err == nil { return res.Body.Close() } return err }
go
func Scale(c *deis.Client, appID string, targets map[string]int) error { u := fmt.Sprintf("/v2/apps/%s/scale/", appID) body, err := json.Marshal(targets) if err != nil { return err } res, err := c.Request("POST", u, body) if err == nil { return res.Body.Close() } return err }
[ "func", "Scale", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ",", "targets", "map", "[", "string", "]", "int", ")", "error", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "appID", ")", "\n\n", "body", ",", "err", ...
// Scale increases or decreases an app's processes. The processes are specified in the target argument, // a key-value map, where the key is the process name and the value is the number of replicas
[ "Scale", "increases", "or", "decreases", "an", "app", "s", "processes", ".", "The", "processes", "are", "specified", "in", "the", "target", "argument", "a", "key", "-", "value", "map", "where", "the", "key", "is", "the", "process", "name", "and", "the", ...
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/ps/ps.go#L31-L45
153,116
deis/controller-sdk-go
ps/ps.go
Restart
func Restart(c *deis.Client, appID string, procType string, name string) (api.PodsList, error) { u := fmt.Sprintf("/v2/apps/%s/pods/", appID) if procType == "" { u += "restart/" } else { if name == "" { u += procType + "/restart/" } else { u += procType + "/" + name + "/restart/" } } res, reqErr := c.Request("POST", u, nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []api.Pods{}, reqErr } defer res.Body.Close() procs := []api.Pods{} if err := json.NewDecoder(res.Body).Decode(&procs); err != nil { return []api.Pods{}, err } return procs, reqErr }
go
func Restart(c *deis.Client, appID string, procType string, name string) (api.PodsList, error) { u := fmt.Sprintf("/v2/apps/%s/pods/", appID) if procType == "" { u += "restart/" } else { if name == "" { u += procType + "/restart/" } else { u += procType + "/" + name + "/restart/" } } res, reqErr := c.Request("POST", u, nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []api.Pods{}, reqErr } defer res.Body.Close() procs := []api.Pods{} if err := json.NewDecoder(res.Body).Decode(&procs); err != nil { return []api.Pods{}, err } return procs, reqErr }
[ "func", "Restart", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ",", "procType", "string", ",", "name", "string", ")", "(", "api", ".", "PodsList", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "...
// Restart restarts an app's processes. To restart all app processes, pass empty strings for // procType and name. To restart an specific process, pass an procType by leave name empty. // To restart a specific instance, pass a procType and a name.
[ "Restart", "restarts", "an", "app", "s", "processes", ".", "To", "restart", "all", "app", "processes", "pass", "empty", "strings", "for", "procType", "and", "name", ".", "To", "restart", "an", "specific", "process", "pass", "an", "procType", "by", "leave", ...
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/ps/ps.go#L50-L75
153,117
bulletind/khabar
handlers/sent.go
Get
func (self *Notifications) Get(request *gottp.Request) { var args struct { Organization string `json:"org"` AppName string `json:"app_name"` User string `json:"user" required:"true"` } request.ConvertArguments(&args) paginator := request.GetPaginator() all, err := sentApi.GetAll(paginator, args.User, args.AppName, args.Organization) if err != nil { if err != mgo.ErrNotFound { log.Println(err) request.Raise(gottp.HttpError{ http.StatusInternalServerError, "Unable to fetch data, Please try again later.", }) } else { request.Raise(gottp.HttpError{ http.StatusNotFound, "Not Found.", }) } return } request.Write(all) return }
go
func (self *Notifications) Get(request *gottp.Request) { var args struct { Organization string `json:"org"` AppName string `json:"app_name"` User string `json:"user" required:"true"` } request.ConvertArguments(&args) paginator := request.GetPaginator() all, err := sentApi.GetAll(paginator, args.User, args.AppName, args.Organization) if err != nil { if err != mgo.ErrNotFound { log.Println(err) request.Raise(gottp.HttpError{ http.StatusInternalServerError, "Unable to fetch data, Please try again later.", }) } else { request.Raise(gottp.HttpError{ http.StatusNotFound, "Not Found.", }) } return } request.Write(all) return }
[ "func", "(", "self", "*", "Notifications", ")", "Get", "(", "request", "*", "gottp", ".", "Request", ")", "{", "var", "args", "struct", "{", "Organization", "string", "`json:\"org\"`", "\n", "AppName", "string", "`json:\"app_name\"`", "\n", "User", "string", ...
// List all notifications
[ "List", "all", "notifications" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/handlers/sent.go#L22-L53
153,118
bulletind/khabar
handlers/sent.go
Put
func (self *Notifications) Put(request *gottp.Request) { var args struct { Organization string `json:"org"` AppName string `json:"app_name"` User string `json:"user" required:"true"` } request.ConvertArguments(&args) err := sentApi.MarkRead(args.User, args.AppName, args.Organization) if err != nil { log.Println(err) request.Raise(gottp.HttpError{ http.StatusInternalServerError, "Unable to insert.", }) return } request.Write(utils.R{StatusCode: http.StatusNoContent, Data: nil, Message: "NoContent"}) return }
go
func (self *Notifications) Put(request *gottp.Request) { var args struct { Organization string `json:"org"` AppName string `json:"app_name"` User string `json:"user" required:"true"` } request.ConvertArguments(&args) err := sentApi.MarkRead(args.User, args.AppName, args.Organization) if err != nil { log.Println(err) request.Raise(gottp.HttpError{ http.StatusInternalServerError, "Unable to insert.", }) return } request.Write(utils.R{StatusCode: http.StatusNoContent, Data: nil, Message: "NoContent"}) return }
[ "func", "(", "self", "*", "Notifications", ")", "Put", "(", "request", "*", "gottp", ".", "Request", ")", "{", "var", "args", "struct", "{", "Organization", "string", "`json:\"org\"`", "\n", "AppName", "string", "`json:\"app_name\"`", "\n", "User", "string", ...
// Mark all notifications as read
[ "Mark", "all", "notifications", "as", "read" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/handlers/sent.go#L56-L80
153,119
bulletind/khabar
handlers/sent.go
Post
func (self *Notifications) Post(request *gottp.Request) { pending_item := new(db.PendingItem) request.ConvertArguments(pending_item) if request.GetArgument("topic") == nil { request.Raise(gottp.HttpError{ http.StatusBadRequest, "Please provide topic for notification.", }) return } if pending.Throttled(pending_item) { MSG := "Repeated Notifications are Blocked. Skipping." log.Println(MSG) request.Raise(gottp.HttpError{http.StatusBadRequest, MSG}) return } pending_item.Topic = request.GetArgument("topic").(string) pending_item.IsRead = false pending_item.PrepareSave() if !utils.ValidateAndRaiseError(request, pending_item) { return } if !pending_item.IsValid() { request.Raise(gottp.HttpError{ http.StatusBadRequest, "Context is required for sending notification.", }) return } core.SendNotification(pending_item) request.Write(utils.R{StatusCode: http.StatusNoContent, Data: nil, Message: "true"}) return }
go
func (self *Notifications) Post(request *gottp.Request) { pending_item := new(db.PendingItem) request.ConvertArguments(pending_item) if request.GetArgument("topic") == nil { request.Raise(gottp.HttpError{ http.StatusBadRequest, "Please provide topic for notification.", }) return } if pending.Throttled(pending_item) { MSG := "Repeated Notifications are Blocked. Skipping." log.Println(MSG) request.Raise(gottp.HttpError{http.StatusBadRequest, MSG}) return } pending_item.Topic = request.GetArgument("topic").(string) pending_item.IsRead = false pending_item.PrepareSave() if !utils.ValidateAndRaiseError(request, pending_item) { return } if !pending_item.IsValid() { request.Raise(gottp.HttpError{ http.StatusBadRequest, "Context is required for sending notification.", }) return } core.SendNotification(pending_item) request.Write(utils.R{StatusCode: http.StatusNoContent, Data: nil, Message: "true"}) return }
[ "func", "(", "self", "*", "Notifications", ")", "Post", "(", "request", "*", "gottp", ".", "Request", ")", "{", "pending_item", ":=", "new", "(", "db", ".", "PendingItem", ")", "\n", "request", ".", "ConvertArguments", "(", "pending_item", ")", "\n\n", "...
// Send a notification to the user depending on preferences
[ "Send", "a", "notification", "to", "the", "user", "depending", "on", "preferences" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/handlers/sent.go#L83-L126
153,120
deis/controller-sdk-go
apps/apps.go
New
func New(c *deis.Client, appID string) (api.App, error) { body := []byte{} if appID != "" { req := api.AppCreateRequest{ID: appID} b, err := json.Marshal(req) if err != nil { return api.App{}, err } body = b } res, reqErr := c.Request("POST", "/v2/apps/", body) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.App{}, reqErr } defer res.Body.Close() app := api.App{} if err := json.NewDecoder(res.Body).Decode(&app); err != nil { return api.App{}, err } return app, reqErr }
go
func New(c *deis.Client, appID string) (api.App, error) { body := []byte{} if appID != "" { req := api.AppCreateRequest{ID: appID} b, err := json.Marshal(req) if err != nil { return api.App{}, err } body = b } res, reqErr := c.Request("POST", "/v2/apps/", body) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.App{}, reqErr } defer res.Body.Close() app := api.App{} if err := json.NewDecoder(res.Body).Decode(&app); err != nil { return api.App{}, err } return app, reqErr }
[ "func", "New", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ")", "(", "api", ".", "App", ",", "error", ")", "{", "body", ":=", "[", "]", "byte", "{", "}", "\n\n", "if", "appID", "!=", "\"", "\"", "{", "req", ":=", "api", ".",...
// New creates a new app with the given appID. Passing an empty string will result in // a randomized app name. // // If the app name already exists, the error deis.ErrDuplicateApp will be returned.
[ "New", "creates", "a", "new", "app", "with", "the", "given", "appID", ".", "Passing", "an", "empty", "string", "will", "result", "in", "a", "randomized", "app", "name", ".", "If", "the", "app", "name", "already", "exists", "the", "error", "deis", ".", ...
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/apps/apps.go#L43-L68
153,121
deis/controller-sdk-go
apps/apps.go
Get
func Get(c *deis.Client, appID string) (api.App, error) { u := fmt.Sprintf("/v2/apps/%s/", appID) res, reqErr := c.Request("GET", u, nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.App{}, reqErr } defer res.Body.Close() app := api.App{} if err := json.NewDecoder(res.Body).Decode(&app); err != nil { return api.App{}, err } return app, reqErr }
go
func Get(c *deis.Client, appID string) (api.App, error) { u := fmt.Sprintf("/v2/apps/%s/", appID) res, reqErr := c.Request("GET", u, nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.App{}, reqErr } defer res.Body.Close() app := api.App{} if err := json.NewDecoder(res.Body).Decode(&app); err != nil { return api.App{}, err } return app, reqErr }
[ "func", "Get", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ")", "(", "api", ".", "App", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "appID", ")", "\n\n", "res", ",", "reqErr", ":=", "c", "...
// Get app details from a controller.
[ "Get", "app", "details", "from", "a", "controller", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/apps/apps.go#L71-L87
153,122
deis/controller-sdk-go
apps/apps.go
Logs
func Logs(c *deis.Client, appID string, lines int) (string, error) { u := fmt.Sprintf("/v2/apps/%s/logs", appID) if lines > 0 { u += "?log_lines=" + strconv.Itoa(lines) } res, reqErr := c.Request("GET", u, nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return "", ErrNoLogs } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil || len(body) < 3 { return "", ErrNoLogs } // We need to trim a few characters off the front and end of the string return string(body), reqErr }
go
func Logs(c *deis.Client, appID string, lines int) (string, error) { u := fmt.Sprintf("/v2/apps/%s/logs", appID) if lines > 0 { u += "?log_lines=" + strconv.Itoa(lines) } res, reqErr := c.Request("GET", u, nil) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return "", ErrNoLogs } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil || len(body) < 3 { return "", ErrNoLogs } // We need to trim a few characters off the front and end of the string return string(body), reqErr }
[ "func", "Logs", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ",", "lines", "int", ")", "(", "string", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "appID", ")", "\n\n", "if", "lines", ">", "0"...
// Logs retrieves logs from an app. The number of log lines fetched can be set by the lines // argument. Setting lines = -1 will retrive all app logs.
[ "Logs", "retrieves", "logs", "from", "an", "app", ".", "The", "number", "of", "log", "lines", "fetched", "can", "be", "set", "by", "the", "lines", "argument", ".", "Setting", "lines", "=", "-", "1", "will", "retrive", "all", "app", "logs", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/apps/apps.go#L91-L111
153,123
deis/controller-sdk-go
apps/apps.go
Run
func Run(c *deis.Client, appID string, command string) (api.AppRunResponse, error) { req := api.AppRunRequest{Command: command} body, err := json.Marshal(req) if err != nil { return api.AppRunResponse{}, err } u := fmt.Sprintf("/v2/apps/%s/run", appID) res, reqErr := c.Request("POST", u, body) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.AppRunResponse{}, reqErr } arr := api.AppRunResponse{} if err = json.NewDecoder(res.Body).Decode(&arr); err != nil { return api.AppRunResponse{}, err } return arr, reqErr }
go
func Run(c *deis.Client, appID string, command string) (api.AppRunResponse, error) { req := api.AppRunRequest{Command: command} body, err := json.Marshal(req) if err != nil { return api.AppRunResponse{}, err } u := fmt.Sprintf("/v2/apps/%s/run", appID) res, reqErr := c.Request("POST", u, body) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.AppRunResponse{}, reqErr } arr := api.AppRunResponse{} if err = json.NewDecoder(res.Body).Decode(&arr); err != nil { return api.AppRunResponse{}, err } return arr, reqErr }
[ "func", "Run", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ",", "command", "string", ")", "(", "api", ".", "AppRunResponse", ",", "error", ")", "{", "req", ":=", "api", ".", "AppRunRequest", "{", "Command", ":", "command", "}", "\n"...
// Run a one-time command in your app. This will start a kubernetes job with the // same container image and environment as the rest of the app.
[ "Run", "a", "one", "-", "time", "command", "in", "your", "app", ".", "This", "will", "start", "a", "kubernetes", "job", "with", "the", "same", "container", "image", "and", "environment", "as", "the", "rest", "of", "the", "app", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/apps/apps.go#L115-L137
153,124
deis/controller-sdk-go
api/appsettings.go
String
func (a Autoscale) String() string { var doc bytes.Buffer tmpl, err := template.New("autoscale").Parse(`Min Replicas: {{.Min}} Max Replicas: {{.Max}} CPU: {{.CPUPercent}}%`) if err != nil { panic(err) } if err := tmpl.Execute(&doc, a); err != nil { panic(err) } return doc.String() }
go
func (a Autoscale) String() string { var doc bytes.Buffer tmpl, err := template.New("autoscale").Parse(`Min Replicas: {{.Min}} Max Replicas: {{.Max}} CPU: {{.CPUPercent}}%`) if err != nil { panic(err) } if err := tmpl.Execute(&doc, a); err != nil { panic(err) } return doc.String() }
[ "func", "(", "a", "Autoscale", ")", "String", "(", ")", "string", "{", "var", "doc", "bytes", ".", "Buffer", "\n", "tmpl", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "`Min Replicas: {{.Min}}\nMax Replicas: {{.Max}}\n...
// String displays the Autoscale rule in a readable format.
[ "String", "displays", "the", "Autoscale", "rule", "in", "a", "readable", "format", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/api/appsettings.go#L42-L54
153,125
deis/controller-sdk-go
perms/perms.go
ListAdmins
func ListAdmins(c *deis.Client, results int) ([]string, int, error) { body, count, reqErr := c.LimitedRequest("/v2/admin/perms/", results) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []string{}, -1, reqErr } var users []api.PermsRequest if err := json.Unmarshal([]byte(body), &users); err != nil { return []string{}, -1, err } usersList := []string{} for _, user := range users { usersList = append(usersList, user.Username) } return usersList, count, reqErr }
go
func ListAdmins(c *deis.Client, results int) ([]string, int, error) { body, count, reqErr := c.LimitedRequest("/v2/admin/perms/", results) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []string{}, -1, reqErr } var users []api.PermsRequest if err := json.Unmarshal([]byte(body), &users); err != nil { return []string{}, -1, err } usersList := []string{} for _, user := range users { usersList = append(usersList, user.Username) } return usersList, count, reqErr }
[ "func", "ListAdmins", "(", "c", "*", "deis", ".", "Client", ",", "results", "int", ")", "(", "[", "]", "string", ",", "int", ",", "error", ")", "{", "body", ",", "count", ",", "reqErr", ":=", "c", ".", "LimitedRequest", "(", "\"", "\"", ",", "res...
// ListAdmins lists deis platform administrators.
[ "ListAdmins", "lists", "deis", "platform", "administrators", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/perms/perms.go#L29-L48
153,126
deis/controller-sdk-go
perms/perms.go
New
func New(c *deis.Client, appID string, username string) error { return doNew(c, fmt.Sprintf("/v2/apps/%s/perms/", appID), username) }
go
func New(c *deis.Client, appID string, username string) error { return doNew(c, fmt.Sprintf("/v2/apps/%s/perms/", appID), username) }
[ "func", "New", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ",", "username", "string", ")", "error", "{", "return", "doNew", "(", "c", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "appID", ")", ",", "username", ")", "\n", "}...
// New gives a user access to an app.
[ "New", "gives", "a", "user", "access", "to", "an", "app", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/perms/perms.go#L51-L53
153,127
deis/controller-sdk-go
keys/keys.go
List
func List(c *deis.Client, results int) (api.Keys, int, error) { body, count, reqErr := c.LimitedRequest("/v2/keys/", results) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []api.Key{}, -1, reqErr } var keys []api.Key if err := json.Unmarshal([]byte(body), &keys); err != nil { return []api.Key{}, -1, err } return keys, count, reqErr }
go
func List(c *deis.Client, results int) (api.Keys, int, error) { body, count, reqErr := c.LimitedRequest("/v2/keys/", results) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []api.Key{}, -1, reqErr } var keys []api.Key if err := json.Unmarshal([]byte(body), &keys); err != nil { return []api.Key{}, -1, err } return keys, count, reqErr }
[ "func", "List", "(", "c", "*", "deis", ".", "Client", ",", "results", "int", ")", "(", "api", ".", "Keys", ",", "int", ",", "error", ")", "{", "body", ",", "count", ",", "reqErr", ":=", "c", ".", "LimitedRequest", "(", "\"", "\"", ",", "results",...
// List lists a user's ssh keys.
[ "List", "lists", "a", "user", "s", "ssh", "keys", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/keys/keys.go#L13-L26
153,128
deis/controller-sdk-go
keys/keys.go
New
func New(c *deis.Client, id string, pubKey string) (api.Key, error) { req := api.KeyCreateRequest{ID: id, Public: pubKey} body, err := json.Marshal(req) if err != nil { return api.Key{}, err } res, reqErr := c.Request("POST", "/v2/keys/", body) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.Key{}, reqErr } defer res.Body.Close() key := api.Key{} if err = json.NewDecoder(res.Body).Decode(&key); err != nil { return api.Key{}, err } return key, reqErr }
go
func New(c *deis.Client, id string, pubKey string) (api.Key, error) { req := api.KeyCreateRequest{ID: id, Public: pubKey} body, err := json.Marshal(req) if err != nil { return api.Key{}, err } res, reqErr := c.Request("POST", "/v2/keys/", body) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return api.Key{}, reqErr } defer res.Body.Close() key := api.Key{} if err = json.NewDecoder(res.Body).Decode(&key); err != nil { return api.Key{}, err } return key, reqErr }
[ "func", "New", "(", "c", "*", "deis", ".", "Client", ",", "id", "string", ",", "pubKey", "string", ")", "(", "api", ".", "Key", ",", "error", ")", "{", "req", ":=", "api", ".", "KeyCreateRequest", "{", "ID", ":", "id", ",", "Public", ":", "pubKey...
// New adds a new ssh key for the user. This is used for authenting with the git // remote for the builder. This key must be unique to the current user, or the error // deis.ErrDuplicateKey will be returned.
[ "New", "adds", "a", "new", "ssh", "key", "for", "the", "user", ".", "This", "is", "used", "for", "authenting", "with", "the", "git", "remote", "for", "the", "builder", ".", "This", "key", "must", "be", "unique", "to", "the", "current", "user", "or", ...
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/keys/keys.go#L31-L50
153,129
deis/controller-sdk-go
keys/keys.go
Delete
func Delete(c *deis.Client, keyID string) error { u := fmt.Sprintf("/v2/keys/%s", keyID) res, err := c.Request("DELETE", u, nil) if err == nil { res.Body.Close() } return err }
go
func Delete(c *deis.Client, keyID string) error { u := fmt.Sprintf("/v2/keys/%s", keyID) res, err := c.Request("DELETE", u, nil) if err == nil { res.Body.Close() } return err }
[ "func", "Delete", "(", "c", "*", "deis", ".", "Client", ",", "keyID", "string", ")", "error", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "keyID", ")", "\n\n", "res", ",", "err", ":=", "c", ".", "Request", "(", "\"", "\"", ",",...
// Delete removes a user's ssh key. The key ID will be the key comment, usually the email or user@hostname // of the user. The exact keyID can be retrieved with List()
[ "Delete", "removes", "a", "user", "s", "ssh", "key", ".", "The", "key", "ID", "will", "be", "the", "key", "comment", "usually", "the", "email", "or", "user" ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/keys/keys.go#L54-L62
153,130
deis/controller-sdk-go
builds/builds.go
List
func List(c *deis.Client, appID string, results int) ([]api.Build, int, error) { u := fmt.Sprintf("/v2/apps/%s/builds/", appID) body, count, reqErr := c.LimitedRequest(u, results) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []api.Build{}, -1, reqErr } var builds []api.Build if err := json.Unmarshal([]byte(body), &builds); err != nil { return []api.Build{}, -1, err } return builds, count, reqErr }
go
func List(c *deis.Client, appID string, results int) ([]api.Build, int, error) { u := fmt.Sprintf("/v2/apps/%s/builds/", appID) body, count, reqErr := c.LimitedRequest(u, results) if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) { return []api.Build{}, -1, reqErr } var builds []api.Build if err := json.Unmarshal([]byte(body), &builds); err != nil { return []api.Build{}, -1, err } return builds, count, reqErr }
[ "func", "List", "(", "c", "*", "deis", ".", "Client", ",", "appID", "string", ",", "results", "int", ")", "(", "[", "]", "api", ".", "Build", ",", "int", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "appID", ...
// List lists an app's builds.
[ "List", "lists", "an", "app", "s", "builds", "." ]
c9ffa05111835e74d71a6659f1339b849a9b0a7b
https://github.com/deis/controller-sdk-go/blob/c9ffa05111835e74d71a6659f1339b849a9b0a7b/builds/builds.go#L13-L27
153,131
bulletind/khabar
core/emailer.go
htmlCopy
func htmlCopy(item interface{}) interface{} { kind := reflect.TypeOf(item).Kind() original := reflect.ValueOf(item) if kind == reflect.Slice { clone := []interface{}{} for i := 0; i < original.Len(); i += 1 { clone = append(clone, htmlCopy(original.Index(i).Interface())) } return clone } else if kind == reflect.Map { clone := map[string]interface{}{} for key, val := range item.(map[string]interface{}) { clone[key] = htmlCopy(val) } return clone } else if kind == reflect.String { return template.HTML(fmt.Sprint(item)) } else { return item } }
go
func htmlCopy(item interface{}) interface{} { kind := reflect.TypeOf(item).Kind() original := reflect.ValueOf(item) if kind == reflect.Slice { clone := []interface{}{} for i := 0; i < original.Len(); i += 1 { clone = append(clone, htmlCopy(original.Index(i).Interface())) } return clone } else if kind == reflect.Map { clone := map[string]interface{}{} for key, val := range item.(map[string]interface{}) { clone[key] = htmlCopy(val) } return clone } else if kind == reflect.String { return template.HTML(fmt.Sprint(item)) } else { return item } }
[ "func", "htmlCopy", "(", "item", "interface", "{", "}", ")", "interface", "{", "}", "{", "kind", ":=", "reflect", ".", "TypeOf", "(", "item", ")", ".", "Kind", "(", ")", "\n", "original", ":=", "reflect", ".", "ValueOf", "(", "item", ")", "\n\n", "...
// copy struct and HTML all string-entries
[ "copy", "struct", "and", "HTML", "all", "string", "-", "entries" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/core/emailer.go#L220-L241
153,132
bulletind/khabar
core/parse.go
getParseKeys
func getParseKeys(appName string) khabarUtils.M { doc := khabarUtils.M{} // Set the Parse api key and id for _, parse := range parseKeys { envKey := "PARSE_" + appName + "_" + parse.Name doc[parse.Key] = os.Getenv(envKey) if len(os.Getenv(envKey)) == 0 { log.Println(envKey, "is empty. Make sure you set this env variable") } } return doc }
go
func getParseKeys(appName string) khabarUtils.M { doc := khabarUtils.M{} // Set the Parse api key and id for _, parse := range parseKeys { envKey := "PARSE_" + appName + "_" + parse.Name doc[parse.Key] = os.Getenv(envKey) if len(os.Getenv(envKey)) == 0 { log.Println(envKey, "is empty. Make sure you set this env variable") } } return doc }
[ "func", "getParseKeys", "(", "appName", "string", ")", "khabarUtils", ".", "M", "{", "doc", ":=", "khabarUtils", ".", "M", "{", "}", "\n\n", "// Set the Parse api key and id", "for", "_", ",", "parse", ":=", "range", "parseKeys", "{", "envKey", ":=", "\"", ...
// getParseKeys returns map of parse api key and app id // It gets the values from the enviroment variables
[ "getParseKeys", "returns", "map", "of", "parse", "api", "key", "and", "app", "id", "It", "gets", "the", "values", "from", "the", "enviroment", "variables" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/core/parse.go#L94-L106
153,133
bulletind/khabar
handlers/stats.go
Get
func (self *Stats) Get(request *gottp.Request) { args := statsApi.RequestArgs{} request.ConvertArguments(&args) err := gottp_utils.Validate(&args) if len(*err) > 0 { request.Raise(gottp.HttpError{ http.StatusBadRequest, ConcatenateErrors(err), }) return } stats, getErr := statsApi.Get(&args) if getErr != nil { if getErr != mgo.ErrNotFound { log.Println(getErr) request.Raise(gottp.HttpError{ http.StatusInternalServerError, "Unable to fetch data, Please try again later.", }) } else { request.Raise(gottp.HttpError{http.StatusNotFound, "Not Found."}) } return } request.Write(stats) return }
go
func (self *Stats) Get(request *gottp.Request) { args := statsApi.RequestArgs{} request.ConvertArguments(&args) err := gottp_utils.Validate(&args) if len(*err) > 0 { request.Raise(gottp.HttpError{ http.StatusBadRequest, ConcatenateErrors(err), }) return } stats, getErr := statsApi.Get(&args) if getErr != nil { if getErr != mgo.ErrNotFound { log.Println(getErr) request.Raise(gottp.HttpError{ http.StatusInternalServerError, "Unable to fetch data, Please try again later.", }) } else { request.Raise(gottp.HttpError{http.StatusNotFound, "Not Found."}) } return } request.Write(stats) return }
[ "func", "(", "self", "*", "Stats", ")", "Get", "(", "request", "*", "gottp", ".", "Request", ")", "{", "args", ":=", "statsApi", ".", "RequestArgs", "{", "}", "\n\n", "request", ".", "ConvertArguments", "(", "&", "args", ")", "\n\n", "err", ":=", "go...
// Get notification stats
[ "Get", "notification", "stats" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/handlers/stats.go#L31-L65
153,134
bulletind/khabar
core/sender.go
getCategories
func getCategories() []string { session := db.Conn.Session.Copy() defer session.Close() var categories []string db.Conn.GetCursor( session, db.AvailableTopicCollection, utils.M{}, ).Distinct("app_name", &categories) return categories }
go
func getCategories() []string { session := db.Conn.Session.Copy() defer session.Close() var categories []string db.Conn.GetCursor( session, db.AvailableTopicCollection, utils.M{}, ).Distinct("app_name", &categories) return categories }
[ "func", "getCategories", "(", ")", "[", "]", "string", "{", "session", ":=", "db", ".", "Conn", ".", "Session", ".", "Copy", "(", ")", "\n", "defer", "session", ".", "Close", "(", ")", "\n\n", "var", "categories", "[", "]", "string", "\n\n", "db", ...
// getCategories fetchs distinct available categories to which we can send notifications
[ "getCategories", "fetchs", "distinct", "available", "categories", "to", "which", "we", "can", "send", "notifications" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/core/sender.go#L89-L100
153,135
bulletind/khabar
core/sender.go
validCategory
func validCategory(category string) bool { categories := getCategories() var found bool for _, c := range categories { if c == category { found = true break } } return found }
go
func validCategory(category string) bool { categories := getCategories() var found bool for _, c := range categories { if c == category { found = true break } } return found }
[ "func", "validCategory", "(", "category", "string", ")", "bool", "{", "categories", ":=", "getCategories", "(", ")", "\n", "var", "found", "bool", "\n", "for", "_", ",", "c", ":=", "range", "categories", "{", "if", "c", "==", "category", "{", "found", ...
// validCategory checks if the category is valid for sending notification
[ "validCategory", "checks", "if", "the", "category", "is", "valid", "for", "sending", "notification" ]
00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99
https://github.com/bulletind/khabar/blob/00c5b5cf63101ea7489c8a2a0c52f8766f5f3a99/core/sender.go#L103-L113
153,136
favclip/ds2bq
example/ucon/main.go
UseAppengineContext
func UseAppengineContext(b *ucon.Bubble) error { b.Context = appengine.NewContext(b.R) return b.Next() }
go
func UseAppengineContext(b *ucon.Bubble) error { b.Context = appengine.NewContext(b.R) return b.Next() }
[ "func", "UseAppengineContext", "(", "b", "*", "ucon", ".", "Bubble", ")", "error", "{", "b", ".", "Context", "=", "appengine", ".", "NewContext", "(", "b", ".", "R", ")", "\n", "return", "b", ".", "Next", "(", ")", "\n", "}" ]
// UseAppengineContext replace context to appengine's context.
[ "UseAppengineContext", "replace", "context", "to", "appengine", "s", "context", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/example/ucon/main.go#L15-L18
153,137
kyokomi/slackbot
plugins/esa/esa.go
NewPlugin
func NewPlugin(teamName, token string) plugins.BotMessagePlugin { return &plugin{ teamName: teamName, esaClient: esa.NewClient(token), } }
go
func NewPlugin(teamName, token string) plugins.BotMessagePlugin { return &plugin{ teamName: teamName, esaClient: esa.NewClient(token), } }
[ "func", "NewPlugin", "(", "teamName", ",", "token", "string", ")", "plugins", ".", "BotMessagePlugin", "{", "return", "&", "plugin", "{", "teamName", ":", "teamName", ",", "esaClient", ":", "esa", ".", "NewClient", "(", "token", ")", ",", "}", "\n", "}" ...
// NewPlugin esa plugin
[ "NewPlugin", "esa", "plugin" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/esa/esa.go#L21-L26
153,138
kyokomi/slackbot
plugins/esa/esa.go
CheckMessage
func (p *plugin) CheckMessage(_ plugins.BotEvent, message string) (bool, string) { // esaのURLが見つかったら1件目を返す fields := plugins.DefaultUtils.QuotationOrSpaceFields(message) for _, val := range fields { u, err := url.Parse(urlMarksReplacer.Replace(val)) if err != nil || !strings.HasSuffix(u.Host, "esa.io") { continue } return true, u.String() } return false, message }
go
func (p *plugin) CheckMessage(_ plugins.BotEvent, message string) (bool, string) { // esaのURLが見つかったら1件目を返す fields := plugins.DefaultUtils.QuotationOrSpaceFields(message) for _, val := range fields { u, err := url.Parse(urlMarksReplacer.Replace(val)) if err != nil || !strings.HasSuffix(u.Host, "esa.io") { continue } return true, u.String() } return false, message }
[ "func", "(", "p", "*", "plugin", ")", "CheckMessage", "(", "_", "plugins", ".", "BotEvent", ",", "message", "string", ")", "(", "bool", ",", "string", ")", "{", "// esaのURLが見つかったら1件目を返す", "fields", ":=", "plugins", ".", "DefaultUtils", ".", "QuotationOrSpace...
// CheckMessage esa.io url is ok
[ "CheckMessage", "esa", ".", "io", "url", "is", "ok" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/esa/esa.go#L29-L40
153,139
kyokomi/slackbot
plugins/esa/esa.go
DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool { u, err := url.Parse(message) if err != nil { event.Reply(fmt.Sprintf("url.Parse error %s", err.Error())) return true } var postNumber int paths := strings.Split(u.Path, "/") for i := range paths { if paths[i] == "posts" && len(paths) >= i+1 { postNumber, _ = strconv.Atoi(paths[i+1]) break } } resp, err := p.esaClient.Post.GetPost(p.teamName, postNumber) if err != nil { event.Reply(fmt.Sprintf("GetPost error %s", err.Error())) return true } event.Reply(fmt.Sprintf("```\n%s\n```", resp.FullName+"\n"+resp.CreatedAt+"\n\n"+resp.BodyMd)) return true // next ok }
go
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool { u, err := url.Parse(message) if err != nil { event.Reply(fmt.Sprintf("url.Parse error %s", err.Error())) return true } var postNumber int paths := strings.Split(u.Path, "/") for i := range paths { if paths[i] == "posts" && len(paths) >= i+1 { postNumber, _ = strconv.Atoi(paths[i+1]) break } } resp, err := p.esaClient.Post.GetPost(p.teamName, postNumber) if err != nil { event.Reply(fmt.Sprintf("GetPost error %s", err.Error())) return true } event.Reply(fmt.Sprintf("```\n%s\n```", resp.FullName+"\n"+resp.CreatedAt+"\n\n"+resp.BodyMd)) return true // next ok }
[ "func", "(", "p", "*", "plugin", ")", "DoAction", "(", "event", "plugins", ".", "BotEvent", ",", "message", "string", ")", "bool", "{", "u", ",", "err", ":=", "url", ".", "Parse", "(", "message", ")", "\n", "if", "err", "!=", "nil", "{", "event", ...
// DoAction is replay url detail message
[ "DoAction", "is", "replay", "url", "detail", "message" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/esa/esa.go#L43-L65
153,140
ReconfigureIO/sdaccel
axi/protocol/axiprotocol.go
WriteDisable
func WriteDisable( clientAddr chan<- Addr, clientData chan<- WriteData, clientResp <-chan WriteResp) { clientAddr <- Addr{} clientData <- WriteData{Last: true} for { <-clientResp } }
go
func WriteDisable( clientAddr chan<- Addr, clientData chan<- WriteData, clientResp <-chan WriteResp) { clientAddr <- Addr{} clientData <- WriteData{Last: true} for { <-clientResp } }
[ "func", "WriteDisable", "(", "clientAddr", "chan", "<-", "Addr", ",", "clientData", "chan", "<-", "WriteData", ",", "clientResp", "<-", "chan", "WriteResp", ")", "{", "clientAddr", "<-", "Addr", "{", "}", "\n", "clientData", "<-", "WriteData", "{", "Last", ...
// // WriteDisable will disable AXI bus write transactions. Should be run once for each // unused AXI write interface. This will block the calling goroutine. //
[ "WriteDisable", "will", "disable", "AXI", "bus", "write", "transactions", ".", "Should", "be", "run", "once", "for", "each", "unused", "AXI", "write", "interface", ".", "This", "will", "block", "the", "calling", "goroutine", "." ]
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/axi/protocol/axiprotocol.go#L74-L84
153,141
kyokomi/slackbot
repository.go
NewRedisRepository
func NewRedisRepository(addr, password string, db int64) Repository { repo := &redisRepository{} repo.redisDB = redis.NewClient(&redis.Options{ Addr: addr, Password: password, DB: db, }) return repo }
go
func NewRedisRepository(addr, password string, db int64) Repository { repo := &redisRepository{} repo.redisDB = redis.NewClient(&redis.Options{ Addr: addr, Password: password, DB: db, }) return repo }
[ "func", "NewRedisRepository", "(", "addr", ",", "password", "string", ",", "db", "int64", ")", "Repository", "{", "repo", ":=", "&", "redisRepository", "{", "}", "\n", "repo", ".", "redisDB", "=", "redis", ".", "NewClient", "(", "&", "redis", ".", "Optio...
// NewRedisRepository create on redis repository
[ "NewRedisRepository", "create", "on", "redis", "repository" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/repository.go#L52-L60
153,142
ReconfigureIO/sdaccel
axi/memory/aximemory.go
WriteUInt64
func WriteUInt64( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, bufferedAccess bool, writeAddr uintptr, writeData uint64) bool { // Issue write request. go func() { clientAddr <- protocol.Addr{ Addr: writeAddr &^ uintptr(0x7), Size: [3]bool{true, true, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Perform full width 64-bit AXI write. writeStrobe := [8]bool{ true, true, true, true, true, true, true, true} clientData <- protocol.WriteData{ Data: writeData, Strb: writeStrobe, Last: true} writeResp := <-clientResp return !writeResp.Resp[1] }
go
func WriteUInt64( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, bufferedAccess bool, writeAddr uintptr, writeData uint64) bool { // Issue write request. go func() { clientAddr <- protocol.Addr{ Addr: writeAddr &^ uintptr(0x7), Size: [3]bool{true, true, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Perform full width 64-bit AXI write. writeStrobe := [8]bool{ true, true, true, true, true, true, true, true} clientData <- protocol.WriteData{ Data: writeData, Strb: writeStrobe, Last: true} writeResp := <-clientResp return !writeResp.Resp[1] }
[ "func", "WriteUInt64", "(", "clientAddr", "chan", "<-", "protocol", ".", "Addr", ",", "clientData", "chan", "<-", "protocol", ".", "WriteData", ",", "clientResp", "<-", "chan", "protocol", ".", "WriteResp", ",", "bufferedAccess", "bool", ",", "writeAddr", "uin...
// // WriteUInt64 writes a single 64-bit unsigned data value to a word aligned // address on the specified AXI memory bus, with the bottom three address bits // being ignored. The status of the write transaction is returned as the boolean // 'writeOk' flag. //
[ "WriteUInt64", "writes", "a", "single", "64", "-", "bit", "unsigned", "data", "value", "to", "a", "word", "aligned", "address", "on", "the", "specified", "AXI", "memory", "bus", "with", "the", "bottom", "three", "address", "bits", "being", "ignored", ".", ...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/axi/memory/aximemory.go#L39-L65
153,143
ReconfigureIO/sdaccel
axi/memory/aximemory.go
WriteUInt32
func WriteUInt32( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, bufferedAccess bool, writeAddr uintptr, writeData uint32) bool { // Issue write request. go func() { clientAddr <- protocol.Addr{ Addr: writeAddr &^ uintptr(0x3), Size: [3]bool{false, true, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Map write data to appropriate byte lanes. var writeData64 uint64 var writeStrobe [8]bool switch byte(writeAddr) & 0x4 { case 0x0: writeData64 = uint64(writeData) writeStrobe = [8]bool{ true, true, true, true, false, false, false, false} default: writeData64 = uint64(writeData) << 32 writeStrobe = [8]bool{ false, false, false, false, true, true, true, true} } // Perform partial width 64-bit AXI write. clientData <- protocol.WriteData{ Data: writeData64, Strb: writeStrobe, Last: true} writeResp := <-clientResp return !writeResp.Resp[1] }
go
func WriteUInt32( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, bufferedAccess bool, writeAddr uintptr, writeData uint32) bool { // Issue write request. go func() { clientAddr <- protocol.Addr{ Addr: writeAddr &^ uintptr(0x3), Size: [3]bool{false, true, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Map write data to appropriate byte lanes. var writeData64 uint64 var writeStrobe [8]bool switch byte(writeAddr) & 0x4 { case 0x0: writeData64 = uint64(writeData) writeStrobe = [8]bool{ true, true, true, true, false, false, false, false} default: writeData64 = uint64(writeData) << 32 writeStrobe = [8]bool{ false, false, false, false, true, true, true, true} } // Perform partial width 64-bit AXI write. clientData <- protocol.WriteData{ Data: writeData64, Strb: writeStrobe, Last: true} writeResp := <-clientResp return !writeResp.Resp[1] }
[ "func", "WriteUInt32", "(", "clientAddr", "chan", "<-", "protocol", ".", "Addr", ",", "clientData", "chan", "<-", "protocol", ".", "WriteData", ",", "clientResp", "<-", "chan", "protocol", ".", "WriteResp", ",", "bufferedAccess", "bool", ",", "writeAddr", "uin...
// // WriteUInt32 writes a single 32-bit unsigned data value to a word aligned // address on the specified AXI memory bus, with the bottom two address bits // being ignored. The status of the write transaction is returned as the boolean // 'writeOk' flag. //
[ "WriteUInt32", "writes", "a", "single", "32", "-", "bit", "unsigned", "data", "value", "to", "a", "word", "aligned", "address", "on", "the", "specified", "AXI", "memory", "bus", "with", "the", "bottom", "two", "address", "bits", "being", "ignored", ".", "T...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/axi/memory/aximemory.go#L100-L138
153,144
ReconfigureIO/sdaccel
axi/memory/aximemory.go
WriteUInt8
func WriteUInt8( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, bufferedAccess bool, writeAddr uintptr, writeData uint8) bool { // Issue write request. go func() { clientAddr <- protocol.Addr{ Addr: writeAddr, Size: [3]bool{false, false, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Map write data to appropriate byte lanes. var writeData64 uint64 var writeStrobe [8]bool switch byte(writeAddr) & 0x7 { case 0x0: writeData64 = uint64(writeData) writeStrobe = [8]bool{ true, false, false, false, false, false, false, false} case 0x1: writeData64 = uint64(writeData) << 8 writeStrobe = [8]bool{ false, true, false, false, false, false, false, false} case 0x2: writeData64 = uint64(writeData) << 16 writeStrobe = [8]bool{ false, false, true, false, false, false, false, false} case 0x3: writeData64 = uint64(writeData) << 24 writeStrobe = [8]bool{ false, false, false, true, false, false, false, false} case 0x4: writeData64 = uint64(writeData) << 32 writeStrobe = [8]bool{ false, false, false, false, true, false, false, false} case 0x5: writeData64 = uint64(writeData) << 40 writeStrobe = [8]bool{ false, false, false, false, false, true, false, false} case 0x6: writeData64 = uint64(writeData) << 48 writeStrobe = [8]bool{ false, false, false, false, false, false, true, false} default: writeData64 = uint64(writeData) << 56 writeStrobe = [8]bool{ false, false, false, false, false, false, false, true} } // Perform partial width 64-bit AXI write. clientData <- protocol.WriteData{ Data: writeData64, Strb: writeStrobe, Last: true} writeResp := <-clientResp return !writeResp.Resp[1] }
go
func WriteUInt8( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, bufferedAccess bool, writeAddr uintptr, writeData uint8) bool { // Issue write request. go func() { clientAddr <- protocol.Addr{ Addr: writeAddr, Size: [3]bool{false, false, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Map write data to appropriate byte lanes. var writeData64 uint64 var writeStrobe [8]bool switch byte(writeAddr) & 0x7 { case 0x0: writeData64 = uint64(writeData) writeStrobe = [8]bool{ true, false, false, false, false, false, false, false} case 0x1: writeData64 = uint64(writeData) << 8 writeStrobe = [8]bool{ false, true, false, false, false, false, false, false} case 0x2: writeData64 = uint64(writeData) << 16 writeStrobe = [8]bool{ false, false, true, false, false, false, false, false} case 0x3: writeData64 = uint64(writeData) << 24 writeStrobe = [8]bool{ false, false, false, true, false, false, false, false} case 0x4: writeData64 = uint64(writeData) << 32 writeStrobe = [8]bool{ false, false, false, false, true, false, false, false} case 0x5: writeData64 = uint64(writeData) << 40 writeStrobe = [8]bool{ false, false, false, false, false, true, false, false} case 0x6: writeData64 = uint64(writeData) << 48 writeStrobe = [8]bool{ false, false, false, false, false, false, true, false} default: writeData64 = uint64(writeData) << 56 writeStrobe = [8]bool{ false, false, false, false, false, false, false, true} } // Perform partial width 64-bit AXI write. clientData <- protocol.WriteData{ Data: writeData64, Strb: writeStrobe, Last: true} writeResp := <-clientResp return !writeResp.Resp[1] }
[ "func", "WriteUInt8", "(", "clientAddr", "chan", "<-", "protocol", ".", "Addr", ",", "clientData", "chan", "<-", "protocol", ".", "WriteData", ",", "clientResp", "<-", "chan", "protocol", ".", "WriteResp", ",", "bufferedAccess", "bool", ",", "writeAddr", "uint...
// // WriteUInt8 writes a single 8-bit unsigned data value to the specified AXI // memory bus. The status of the write transaction is returned as the boolean // 'writeOk' flag. //
[ "WriteUInt8", "writes", "a", "single", "8", "-", "bit", "unsigned", "data", "value", "to", "the", "specified", "AXI", "memory", "bus", ".", "The", "status", "of", "the", "write", "transaction", "is", "returned", "as", "the", "boolean", "writeOk", "flag", "...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/axi/memory/aximemory.go#L271-L333
153,145
ReconfigureIO/sdaccel
axi/memory/aximemory.go
ReadBurstUInt8
func ReadBurstUInt8( clientAddr chan<- protocol.Addr, clientData <-chan protocol.ReadData, bufferedAccess bool, readAddr uintptr, readLength uint32, readDataChan chan<- uint8) bool { // Get aligned address and initial read phase. alignedAddr := readAddr readPhase := byte(readAddr) // Divide the transaction into burst sequences. burstSize := byte(maxAxiBurstSize) burstOk := true for readLength != 0 { if readLength < maxAxiBurstSize { burstSize = byte(readLength) } // Perform partial width AXI burst writes. go func() { clientAddr <- protocol.Addr{ Addr: alignedAddr, Len: burstSize - 1, Size: [3]bool{false, false, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Loops until read data contains 'last' flag. Only the final // burst status is of interest. getNext := true for getNext { readData := <-clientData switch readPhase & 0x7 { case 0x0: readDataChan <- uint8(readData.Data) case 0x1: readDataChan <- uint8(readData.Data >> 8) case 0x2: readDataChan <- uint8(readData.Data >> 16) case 0x3: readDataChan <- uint8(readData.Data >> 24) case 0x4: readDataChan <- uint8(readData.Data >> 32) case 0x5: readDataChan <- uint8(readData.Data >> 40) case 0x6: readDataChan <- uint8(readData.Data >> 48) default: readDataChan <- uint8(readData.Data >> 56) } if readData.Last { burstOk = burstOk && !readData.Resp[1] } readPhase += 0x1 getNext = !readData.Last } // Update the burst counter and status flag. readLength -= uint32(burstSize) alignedAddr += uintptr(burstSize) } return burstOk }
go
func ReadBurstUInt8( clientAddr chan<- protocol.Addr, clientData <-chan protocol.ReadData, bufferedAccess bool, readAddr uintptr, readLength uint32, readDataChan chan<- uint8) bool { // Get aligned address and initial read phase. alignedAddr := readAddr readPhase := byte(readAddr) // Divide the transaction into burst sequences. burstSize := byte(maxAxiBurstSize) burstOk := true for readLength != 0 { if readLength < maxAxiBurstSize { burstSize = byte(readLength) } // Perform partial width AXI burst writes. go func() { clientAddr <- protocol.Addr{ Addr: alignedAddr, Len: burstSize - 1, Size: [3]bool{false, false, false}, Burst: [2]bool{true, false}, Cache: [4]bool{bufferedAccess, true, false, false}} }() // Loops until read data contains 'last' flag. Only the final // burst status is of interest. getNext := true for getNext { readData := <-clientData switch readPhase & 0x7 { case 0x0: readDataChan <- uint8(readData.Data) case 0x1: readDataChan <- uint8(readData.Data >> 8) case 0x2: readDataChan <- uint8(readData.Data >> 16) case 0x3: readDataChan <- uint8(readData.Data >> 24) case 0x4: readDataChan <- uint8(readData.Data >> 32) case 0x5: readDataChan <- uint8(readData.Data >> 40) case 0x6: readDataChan <- uint8(readData.Data >> 48) default: readDataChan <- uint8(readData.Data >> 56) } if readData.Last { burstOk = burstOk && !readData.Resp[1] } readPhase += 0x1 getNext = !readData.Last } // Update the burst counter and status flag. readLength -= uint32(burstSize) alignedAddr += uintptr(burstSize) } return burstOk }
[ "func", "ReadBurstUInt8", "(", "clientAddr", "chan", "<-", "protocol", ".", "Addr", ",", "clientData", "<-", "chan", "protocol", ".", "ReadData", ",", "bufferedAccess", "bool", ",", "readAddr", "uintptr", ",", "readLength", "uint32", ",", "readDataChan", "chan",...
// // ReadBurstUInt8 reads an incrementing burst of 8-bit unsigned data values // from a word aligned address on the specified AXI memory bus, with the bottom // address bit being ignored. The status of the read transaction is returned as // the boolean 'burstOk' flag. //
[ "ReadBurstUInt8", "reads", "an", "incrementing", "burst", "of", "8", "-", "bit", "unsigned", "data", "values", "from", "a", "word", "aligned", "address", "on", "the", "specified", "AXI", "memory", "bus", "with", "the", "bottom", "address", "bit", "being", "i...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/axi/memory/aximemory.go#L869-L934
153,146
cloudfoundry-community/gogobosh
api.go
GetStemcells
func (c *Client) GetStemcells() ([]Stemcell, error) { r := c.NewRequest("GET", "/stemcells") resp, err := c.DoRequest(r) defer resp.Body.Close() if err != nil { log.Printf("Error requesting stemcells %v", err) return nil, err } resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading stemcells request %v", resBody) return nil, err } stemcells := []Stemcell{} err = json.Unmarshal(resBody, &stemcells) if err != nil { log.Printf("Error unmarshaling stemcells %v", err) } return stemcells, err }
go
func (c *Client) GetStemcells() ([]Stemcell, error) { r := c.NewRequest("GET", "/stemcells") resp, err := c.DoRequest(r) defer resp.Body.Close() if err != nil { log.Printf("Error requesting stemcells %v", err) return nil, err } resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading stemcells request %v", resBody) return nil, err } stemcells := []Stemcell{} err = json.Unmarshal(resBody, &stemcells) if err != nil { log.Printf("Error unmarshaling stemcells %v", err) } return stemcells, err }
[ "func", "(", "c", "*", "Client", ")", "GetStemcells", "(", ")", "(", "[", "]", "Stemcell", ",", "error", ")", "{", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "c", ".", "DoRequest", ...
// GetStemcells from given BOSH
[ "GetStemcells", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L15-L36
153,147
cloudfoundry-community/gogobosh
api.go
GetReleases
func (c *Client) GetReleases() ([]Release, error) { r := c.NewRequest("GET", "/releases") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting releases %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading releases request %v", resBody) return nil, err } releases := []Release{} err = json.Unmarshal(resBody, &releases) if err != nil { log.Printf("Error unmarshaling releases %v", err) } return releases, err }
go
func (c *Client) GetReleases() ([]Release, error) { r := c.NewRequest("GET", "/releases") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting releases %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading releases request %v", resBody) return nil, err } releases := []Release{} err = json.Unmarshal(resBody, &releases) if err != nil { log.Printf("Error unmarshaling releases %v", err) } return releases, err }
[ "func", "(", "c", "*", "Client", ")", "GetReleases", "(", ")", "(", "[", "]", "Release", ",", "error", ")", "{", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "c", ".", "DoRequest", ...
// GetReleases from given BOSH
[ "GetReleases", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L77-L99
153,148
cloudfoundry-community/gogobosh
api.go
GetDeployments
func (c *Client) GetDeployments() ([]Deployment, error) { r := c.NewRequest("GET", "/deployments") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting deployments %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading deployments request %v", resBody) return nil, err } deployments := []Deployment{} err = json.Unmarshal(resBody, &deployments) if err != nil { log.Printf("Error unmarshaling deployments %v", err) } return deployments, err }
go
func (c *Client) GetDeployments() ([]Deployment, error) { r := c.NewRequest("GET", "/deployments") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting deployments %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading deployments request %v", resBody) return nil, err } deployments := []Deployment{} err = json.Unmarshal(resBody, &deployments) if err != nil { log.Printf("Error unmarshaling deployments %v", err) } return deployments, err }
[ "func", "(", "c", "*", "Client", ")", "GetDeployments", "(", ")", "(", "[", "]", "Deployment", ",", "error", ")", "{", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "c", ".", "DoReques...
// GetDeployments from given BOSH
[ "GetDeployments", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L140-L161
153,149
cloudfoundry-community/gogobosh
api.go
GetDeployment
func (c *Client) GetDeployment(name string) (Manifest, error) { manifest := Manifest{} r := c.NewRequest("GET", "/deployments/"+name) resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting deployment manifest %v", err) return manifest, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading deployment manifest request %v", resBody) return manifest, err } err = json.Unmarshal(resBody, &manifest) if err != nil { log.Printf("Error unmarshaling deployment manifest %v", err) } return manifest, err }
go
func (c *Client) GetDeployment(name string) (Manifest, error) { manifest := Manifest{} r := c.NewRequest("GET", "/deployments/"+name) resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting deployment manifest %v", err) return manifest, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading deployment manifest request %v", resBody) return manifest, err } err = json.Unmarshal(resBody, &manifest) if err != nil { log.Printf("Error unmarshaling deployment manifest %v", err) } return manifest, err }
[ "func", "(", "c", "*", "Client", ")", "GetDeployment", "(", "name", "string", ")", "(", "Manifest", ",", "error", ")", "{", "manifest", ":=", "Manifest", "{", "}", "\n", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "n...
// GetDeployment from given BOSH
[ "GetDeployment", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L164-L185
153,150
cloudfoundry-community/gogobosh
api.go
DeleteDeployment
func (c *Client) DeleteDeployment(name string) (Task, error) { var task Task resp, err := c.DoRequest(c.NewRequest("DELETE", "/deployments/"+name)) if err != nil { log.Printf("Error requesting deleting deployment %v", err) return task, err } defer resp.Body.Close() if resp.StatusCode == 404 { return task, fmt.Errorf("deployment %s not found", name) } b, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task response %v", err) return task, err } err = json.Unmarshal(b, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
go
func (c *Client) DeleteDeployment(name string) (Task, error) { var task Task resp, err := c.DoRequest(c.NewRequest("DELETE", "/deployments/"+name)) if err != nil { log.Printf("Error requesting deleting deployment %v", err) return task, err } defer resp.Body.Close() if resp.StatusCode == 404 { return task, fmt.Errorf("deployment %s not found", name) } b, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task response %v", err) return task, err } err = json.Unmarshal(b, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
[ "func", "(", "c", "*", "Client", ")", "DeleteDeployment", "(", "name", "string", ")", "(", "Task", ",", "error", ")", "{", "var", "task", "Task", "\n", "resp", ",", "err", ":=", "c", ".", "DoRequest", "(", "c", ".", "NewRequest", "(", "\"", "\"", ...
// DeleteDeployment from given BOSH
[ "DeleteDeployment", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L188-L211
153,151
cloudfoundry-community/gogobosh
api.go
CreateDeployment
func (c *Client) CreateDeployment(manifest string) (Task, error) { task := Task{} r := c.NewRequest("POST", "/deployments") buffer := bytes.NewBufferString(manifest) r.body = buffer r.header["Content-Type"] = "text/yaml" resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting create deployment %v", err) return task, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task response %v", resBody) return task, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
go
func (c *Client) CreateDeployment(manifest string) (Task, error) { task := Task{} r := c.NewRequest("POST", "/deployments") buffer := bytes.NewBufferString(manifest) r.body = buffer r.header["Content-Type"] = "text/yaml" resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting create deployment %v", err) return task, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task response %v", resBody) return task, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
[ "func", "(", "c", "*", "Client", ")", "CreateDeployment", "(", "manifest", "string", ")", "(", "Task", ",", "error", ")", "{", "task", ":=", "Task", "{", "}", "\n", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", ...
// CreateDeployment from given BOSH
[ "CreateDeployment", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L214-L239
153,152
cloudfoundry-community/gogobosh
api.go
GetDeploymentVMs
func (c *Client) GetDeploymentVMs(name string) ([]VM, error) { var task Task r := c.NewRequest("GET", "/deployments/"+name+"/vms?format=full") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting deployment vms %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading deployment vms request %v", resBody) return nil, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling tasks %v", err) return nil, err } for { taskStatus, err := c.GetTask(task.ID) if err != nil { log.Printf("Error getting task %v", err) } if taskStatus.State == "done" { break } time.Sleep(1 * time.Second) } vms := []VM{} output := c.GetTaskResult(task.ID) for _, value := range output { if len(value) > 0 { var vm VM err = json.Unmarshal([]byte(value), &vm) if err != nil { log.Printf("Error unmarshaling vms %v %v", value, err) return nil, err } vms = append(vms, vm) } } return vms, err }
go
func (c *Client) GetDeploymentVMs(name string) ([]VM, error) { var task Task r := c.NewRequest("GET", "/deployments/"+name+"/vms?format=full") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting deployment vms %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading deployment vms request %v", resBody) return nil, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling tasks %v", err) return nil, err } for { taskStatus, err := c.GetTask(task.ID) if err != nil { log.Printf("Error getting task %v", err) } if taskStatus.State == "done" { break } time.Sleep(1 * time.Second) } vms := []VM{} output := c.GetTaskResult(task.ID) for _, value := range output { if len(value) > 0 { var vm VM err = json.Unmarshal([]byte(value), &vm) if err != nil { log.Printf("Error unmarshaling vms %v %v", value, err) return nil, err } vms = append(vms, vm) } } return vms, err }
[ "func", "(", "c", "*", "Client", ")", "GetDeploymentVMs", "(", "name", "string", ")", "(", "[", "]", "VM", ",", "error", ")", "{", "var", "task", "Task", "\n", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "name", "+...
// GetDeploymentVMs from given BOSH
[ "GetDeploymentVMs", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L242-L288
153,153
cloudfoundry-community/gogobosh
api.go
GetTasks
func (c *Client) GetTasks() ([]Task, error) { r := c.NewRequest("GET", "/tasks") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting tasks %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading tasks request %v", resBody) return nil, err } tasks := []Task{} err = json.Unmarshal(resBody, &tasks) if err != nil { log.Printf("Error unmarshaling tasks %v", err) } return tasks, err }
go
func (c *Client) GetTasks() ([]Task, error) { r := c.NewRequest("GET", "/tasks") resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting tasks %v", err) return nil, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading tasks request %v", resBody) return nil, err } tasks := []Task{} err = json.Unmarshal(resBody, &tasks) if err != nil { log.Printf("Error unmarshaling tasks %v", err) } return tasks, err }
[ "func", "(", "c", "*", "Client", ")", "GetTasks", "(", ")", "(", "[", "]", "Task", ",", "error", ")", "{", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "c", ".", "DoRequest", "(", ...
// GetTasks from given BOSH
[ "GetTasks", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L291-L313
153,154
cloudfoundry-community/gogobosh
api.go
GetTask
func (c *Client) GetTask(id int) (Task, error) { task := Task{} stringID := strconv.Itoa(id) r := c.NewRequest("GET", "/tasks/"+stringID) resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting task %v", err) return task, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task request %v", resBody) return task, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
go
func (c *Client) GetTask(id int) (Task, error) { task := Task{} stringID := strconv.Itoa(id) r := c.NewRequest("GET", "/tasks/"+stringID) resp, err := c.DoRequest(r) if err != nil { log.Printf("Error requesting task %v", err) return task, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task request %v", resBody) return task, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
[ "func", "(", "c", "*", "Client", ")", "GetTask", "(", "id", "int", ")", "(", "Task", ",", "error", ")", "{", "task", ":=", "Task", "{", "}", "\n", "stringID", ":=", "strconv", ".", "Itoa", "(", "id", ")", "\n", "r", ":=", "c", ".", "NewRequest"...
// GetTask from given BOSH
[ "GetTask", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L316-L338
153,155
cloudfoundry-community/gogobosh
api.go
GetTaskResult
func (c *Client) GetTaskResult(id int) []string { l, _ := c.GetTaskOutput(id, "result") return l }
go
func (c *Client) GetTaskResult(id int) []string { l, _ := c.GetTaskOutput(id, "result") return l }
[ "func", "(", "c", "*", "Client", ")", "GetTaskResult", "(", "id", "int", ")", "[", "]", "string", "{", "l", ",", "_", ":=", "c", ".", "GetTaskOutput", "(", "id", ",", "\"", "\"", ")", "\n", "return", "l", "\n", "}" ]
// GetTaskResult from given BOSH
[ "GetTaskResult", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L359-L362
153,156
cloudfoundry-community/gogobosh
api.go
GetCloudConfig
func (c *Client) GetCloudConfig(latest bool) (Cfg, error) { cfg := Cfg{} qs := "?latest=true" if !latest { qs = "?latest=false" } r := c.NewRequest("GET", "/configs"+qs) resp, err := c.DoRequest(r) if err != nil { return cfg, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { return cfg, err } return cfg, json.Unmarshal(resBody, &cfg) }
go
func (c *Client) GetCloudConfig(latest bool) (Cfg, error) { cfg := Cfg{} qs := "?latest=true" if !latest { qs = "?latest=false" } r := c.NewRequest("GET", "/configs"+qs) resp, err := c.DoRequest(r) if err != nil { return cfg, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { return cfg, err } return cfg, json.Unmarshal(resBody, &cfg) }
[ "func", "(", "c", "*", "Client", ")", "GetCloudConfig", "(", "latest", "bool", ")", "(", "Cfg", ",", "error", ")", "{", "cfg", ":=", "Cfg", "{", "}", "\n\n", "qs", ":=", "\"", "\"", "\n", "if", "!", "latest", "{", "qs", "=", "\"", "\"", "\n", ...
// GetCloudConfig from given BOSH
[ "GetCloudConfig", "from", "given", "BOSH" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L382-L401
153,157
cloudfoundry-community/gogobosh
api.go
Cleanup
func (c *Client) Cleanup(removeall bool) (Task, error) { task := Task{} r := c.NewRequest("POST", "/cleanup") var requestBody struct { Config struct { RemoveAll bool `json:"remove_all"` } `json:"config"` } requestBody.Config.RemoveAll = removeall b, err := json.Marshal(&requestBody) if err != nil { return task, err } r.body = bytes.NewBuffer(b) r.header["Content-Type"] = "application/json" resp, err := c.DoRequest(r) if err != nil { return task, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task request %v", resBody) return task, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
go
func (c *Client) Cleanup(removeall bool) (Task, error) { task := Task{} r := c.NewRequest("POST", "/cleanup") var requestBody struct { Config struct { RemoveAll bool `json:"remove_all"` } `json:"config"` } requestBody.Config.RemoveAll = removeall b, err := json.Marshal(&requestBody) if err != nil { return task, err } r.body = bytes.NewBuffer(b) r.header["Content-Type"] = "application/json" resp, err := c.DoRequest(r) if err != nil { return task, err } defer resp.Body.Close() resBody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Printf("Error reading task request %v", resBody) return task, err } err = json.Unmarshal(resBody, &task) if err != nil { log.Printf("Error unmarshaling task %v", err) } return task, err }
[ "func", "(", "c", "*", "Client", ")", "Cleanup", "(", "removeall", "bool", ")", "(", "Task", ",", "error", ")", "{", "task", ":=", "Task", "{", "}", "\n", "r", ":=", "c", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "var", ...
//Cleanup will post to the cleanup endpoint of bosh, passing along the removeall flag passed in as a bool
[ "Cleanup", "will", "post", "to", "the", "cleanup", "endpoint", "of", "bosh", "passing", "along", "the", "removeall", "flag", "passed", "in", "as", "a", "bool" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/api.go#L433-L465
153,158
favclip/ds2bq
gcs_watcher_service.go
GCSWatcherWithURLs
func GCSWatcherWithURLs(apiURL, tqURL string) GCSWatcherOption { return &gcsWatcherURLOption{ APIObjectChangeNotificationURL: apiURL, ObjectToBigQueryURL: tqURL, } }
go
func GCSWatcherWithURLs(apiURL, tqURL string) GCSWatcherOption { return &gcsWatcherURLOption{ APIObjectChangeNotificationURL: apiURL, ObjectToBigQueryURL: tqURL, } }
[ "func", "GCSWatcherWithURLs", "(", "apiURL", ",", "tqURL", "string", ")", "GCSWatcherOption", "{", "return", "&", "gcsWatcherURLOption", "{", "APIObjectChangeNotificationURL", ":", "apiURL", ",", "ObjectToBigQueryURL", ":", "tqURL", ",", "}", "\n", "}" ]
// GCSWatcherWithURLs provies API endpoint URL.
[ "GCSWatcherWithURLs", "provies", "API", "endpoint", "URL", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/gcs_watcher_service.go#L39-L44
153,159
favclip/ds2bq
gcs_watcher_service.go
GCSWatcherWithAfterContext
func GCSWatcherWithAfterContext(f func(c context.Context) (GCSWatcherOption, error)) GCSWatcherOption { return &gcsWatcherWithContext{ Func: f, } }
go
func GCSWatcherWithAfterContext(f func(c context.Context) (GCSWatcherOption, error)) GCSWatcherOption { return &gcsWatcherWithContext{ Func: f, } }
[ "func", "GCSWatcherWithAfterContext", "(", "f", "func", "(", "c", "context", ".", "Context", ")", "(", "GCSWatcherOption", ",", "error", ")", ")", "GCSWatcherOption", "{", "return", "&", "gcsWatcherWithContext", "{", "Func", ":", "f", ",", "}", "\n", "}" ]
// GCSWatcherWithAfterContext can process GCSWatcherOption with context.
[ "GCSWatcherWithAfterContext", "can", "process", "GCSWatcherOption", "with", "context", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/gcs_watcher_service.go#L131-L135
153,160
favclip/ds2bq
gcs_watcher_service.go
NewGCSWatcherService
func NewGCSWatcherService(opts ...GCSWatcherOption) (GCSWatcherService, error) { s := &gcsWatcherService{ QueueName: "", BackupBucketName: "", OCNReceiveURL: "/api/gcs/object-change-notification", GCSObjectToBQJobURL: "/tq/gcs/object-to-bq", } for _, opt := range opts { opt.implements(s) } if len(s.ImportTargetKinds) == 0 && len(s.ImportTargetKindNames) == 0 { return nil, ErrInvalidState } if s.DatasetID == "" { return nil, ErrInvalidState } return s, nil }
go
func NewGCSWatcherService(opts ...GCSWatcherOption) (GCSWatcherService, error) { s := &gcsWatcherService{ QueueName: "", BackupBucketName: "", OCNReceiveURL: "/api/gcs/object-change-notification", GCSObjectToBQJobURL: "/tq/gcs/object-to-bq", } for _, opt := range opts { opt.implements(s) } if len(s.ImportTargetKinds) == 0 && len(s.ImportTargetKindNames) == 0 { return nil, ErrInvalidState } if s.DatasetID == "" { return nil, ErrInvalidState } return s, nil }
[ "func", "NewGCSWatcherService", "(", "opts", "...", "GCSWatcherOption", ")", "(", "GCSWatcherService", ",", "error", ")", "{", "s", ":=", "&", "gcsWatcherService", "{", "QueueName", ":", "\"", "\"", ",", "BackupBucketName", ":", "\"", "\"", ",", "OCNReceiveURL...
// NewGCSWatcherService returns ready to use GCSWatcherService.
[ "NewGCSWatcherService", "returns", "ready", "to", "use", "GCSWatcherService", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/gcs_watcher_service.go#L159-L179
153,161
kyokomi/slackbot
plugins/plugin.go
ArchivesURL
func (b *BotEvent) ArchivesURL() string { // Slackの仕様が変わると使えなくなるのであまり推奨しない方法 return fmt.Sprintf("https://%s.slack.com/archives/%s/p%s", b.domain, b.channelName, strings.Replace(b.timestamp, ".", "", 1)) }
go
func (b *BotEvent) ArchivesURL() string { // Slackの仕様が変わると使えなくなるのであまり推奨しない方法 return fmt.Sprintf("https://%s.slack.com/archives/%s/p%s", b.domain, b.channelName, strings.Replace(b.timestamp, ".", "", 1)) }
[ "func", "(", "b", "*", "BotEvent", ")", "ArchivesURL", "(", ")", "string", "{", "// Slackの仕様が変わると使えなくなるのであまり推奨しない方法", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "b", ".", "domain", ",", "b", ".", "channelName", ",", "strings", ".", "Replace", ...
// ArchivesURL return copy link archives url
[ "ArchivesURL", "return", "copy", "link", "archives", "url" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/plugin.go#L192-L195
153,162
kyokomi/slackbot
plugins/cron/v2/context.go
NewContext
func NewContext(repository Repository) (Context, error) { ctx := &context{ cronClient: map[string]*cron.Cron{}, repository: repository, } data, err := repository.Load() if err != nil { return nil, err } ctx.cronTaskMap = data return ctx, nil }
go
func NewContext(repository Repository) (Context, error) { ctx := &context{ cronClient: map[string]*cron.Cron{}, repository: repository, } data, err := repository.Load() if err != nil { return nil, err } ctx.cronTaskMap = data return ctx, nil }
[ "func", "NewContext", "(", "repository", "Repository", ")", "(", "Context", ",", "error", ")", "{", "ctx", ":=", "&", "context", "{", "cronClient", ":", "map", "[", "string", "]", "*", "cron", ".", "Cron", "{", "}", ",", "repository", ":", "repository"...
// NewContext create cron context
[ "NewContext", "create", "cron", "context" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/cron/v2/context.go#L55-L66
153,163
favclip/ds2bq
datastore_management_handler.go
DecodeReqListBase
func DecodeReqListBase(r io.Reader) (*ReqListBase, error) { decoder := json.NewDecoder(r) var req *ReqListBase err := decoder.Decode(&req) if err != nil { return nil, err } return req, nil }
go
func DecodeReqListBase(r io.Reader) (*ReqListBase, error) { decoder := json.NewDecoder(r) var req *ReqListBase err := decoder.Decode(&req) if err != nil { return nil, err } return req, nil }
[ "func", "DecodeReqListBase", "(", "r", "io", ".", "Reader", ")", "(", "*", "ReqListBase", ",", "error", ")", "{", "decoder", ":=", "json", ".", "NewDecoder", "(", "r", ")", "\n", "var", "req", "*", "ReqListBase", "\n", "err", ":=", "decoder", ".", "D...
// DecodeReqListBase decodes a ReqListBase from r.
[ "DecodeReqListBase", "decodes", "a", "ReqListBase", "from", "r", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_handler.go#L15-L23
153,164
favclip/ds2bq
datastore_management_handler.go
DecodeAEBackupInformationDeleteReq
func DecodeAEBackupInformationDeleteReq(r io.Reader) (*AEBackupInformationDeleteReq, error) { decoder := json.NewDecoder(r) var req *AEBackupInformationDeleteReq err := decoder.Decode(&req) if err != nil { return nil, err } return req, nil }
go
func DecodeAEBackupInformationDeleteReq(r io.Reader) (*AEBackupInformationDeleteReq, error) { decoder := json.NewDecoder(r) var req *AEBackupInformationDeleteReq err := decoder.Decode(&req) if err != nil { return nil, err } return req, nil }
[ "func", "DecodeAEBackupInformationDeleteReq", "(", "r", "io", ".", "Reader", ")", "(", "*", "AEBackupInformationDeleteReq", ",", "error", ")", "{", "decoder", ":=", "json", ".", "NewDecoder", "(", "r", ")", "\n", "var", "req", "*", "AEBackupInformationDeleteReq"...
// DecodeAEBackupInformationDeleteReq decodes a AEBackupInformationDeleteReq from r.
[ "DecodeAEBackupInformationDeleteReq", "decodes", "a", "AEBackupInformationDeleteReq", "from", "r", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_handler.go#L26-L34
153,165
favclip/ds2bq
datastore_management_handler.go
DeleteOldBackupAPIHandlerFunc
func DeleteOldBackupAPIHandlerFunc(queueName, path string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) task := &taskqueue.Task{ Method: "DELETE", Path: path, } _, err := taskqueue.Add(c, task, queueName) if err != nil { log.Errorf(c, "ds2bq: failed to add a task: %s", err) return } } }
go
func DeleteOldBackupAPIHandlerFunc(queueName, path string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) task := &taskqueue.Task{ Method: "DELETE", Path: path, } _, err := taskqueue.Add(c, task, queueName) if err != nil { log.Errorf(c, "ds2bq: failed to add a task: %s", err) return } } }
[ "func", "DeleteOldBackupAPIHandlerFunc", "(", "queueName", ",", "path", "string", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "c", ":=", "appengine", ".",...
// DeleteOldBackupAPIHandlerFunc returns a http.HandlerFunc that delegate to taskqueue. // The path is for DeleteOldBackupTask.
[ "DeleteOldBackupAPIHandlerFunc", "returns", "a", "http", ".", "HandlerFunc", "that", "delegate", "to", "taskqueue", ".", "The", "path", "is", "for", "DeleteOldBackupTask", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_handler.go#L38-L52
153,166
favclip/ds2bq
datastore_management_handler.go
DeleteOldBackupTaskHandlerFunc
func DeleteOldBackupTaskHandlerFunc(queueName, path string, expireAfter time.Duration) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) req, err := DecodeReqListBase(r.Body) if err != nil { log.Errorf(c, "ds2bq: failed to decode request: %s", err) return } defer r.Body.Close() err = addDeleteOldBackupTasks(c, r, req, queueName, path, expireAfter) if err != nil { log.Errorf(c, "ds2bq: failed to delete old backup: %s", err) return } } }
go
func DeleteOldBackupTaskHandlerFunc(queueName, path string, expireAfter time.Duration) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) req, err := DecodeReqListBase(r.Body) if err != nil { log.Errorf(c, "ds2bq: failed to decode request: %s", err) return } defer r.Body.Close() err = addDeleteOldBackupTasks(c, r, req, queueName, path, expireAfter) if err != nil { log.Errorf(c, "ds2bq: failed to delete old backup: %s", err) return } } }
[ "func", "DeleteOldBackupTaskHandlerFunc", "(", "queueName", ",", "path", "string", ",", "expireAfter", "time", ".", "Duration", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Requ...
// DeleteOldBackupTaskHandlerFunc returns a http.HandlerFunc that adds tasks to delete old AEBackupInformation. // The path is for DeleteBackupTask.
[ "DeleteOldBackupTaskHandlerFunc", "returns", "a", "http", ".", "HandlerFunc", "that", "adds", "tasks", "to", "delete", "old", "AEBackupInformation", ".", "The", "path", "is", "for", "DeleteBackupTask", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_handler.go#L56-L73
153,167
favclip/ds2bq
datastore_management_handler.go
DeleteBackupTaskHandlerFunc
func DeleteBackupTaskHandlerFunc(queueName string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) req, err := DecodeAEBackupInformationDeleteReq(r.Body) if err != nil { log.Errorf(c, "ds2bq: failed to decode request: %s", err) return } defer r.Body.Close() err = deleteBackup(c, r, req, queueName) if err != nil { log.Warningf(c, "ds2bq: failed to delete appengine backup information: %s", err) return } } }
go
func DeleteBackupTaskHandlerFunc(queueName string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) req, err := DecodeAEBackupInformationDeleteReq(r.Body) if err != nil { log.Errorf(c, "ds2bq: failed to decode request: %s", err) return } defer r.Body.Close() err = deleteBackup(c, r, req, queueName) if err != nil { log.Warningf(c, "ds2bq: failed to delete appengine backup information: %s", err) return } } }
[ "func", "DeleteBackupTaskHandlerFunc", "(", "queueName", "string", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "c", ":=", "appengine", ".", "NewContext", ...
// DeleteBackupTaskHandlerFunc returns a http.HandlerFunc that removes all child entities about AEBackupInformation or AEDatastoreAdminOperation kinds.
[ "DeleteBackupTaskHandlerFunc", "returns", "a", "http", ".", "HandlerFunc", "that", "removes", "all", "child", "entities", "about", "AEBackupInformation", "or", "AEDatastoreAdminOperation", "kinds", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_handler.go#L76-L93
153,168
kyokomi/slackbot
plugins/utils.go
CheckMessageKeyword
func CheckMessageKeyword(message string, keyword string) (bool, string) { return CheckMessageKeywords(message, keyword) }
go
func CheckMessageKeyword(message string, keyword string) (bool, string) { return CheckMessageKeywords(message, keyword) }
[ "func", "CheckMessageKeyword", "(", "message", "string", ",", "keyword", "string", ")", "(", "bool", ",", "string", ")", "{", "return", "CheckMessageKeywords", "(", "message", ",", "keyword", ")", "\n", "}" ]
// CheckMessageKeyword is Deprecated
[ "CheckMessageKeyword", "is", "Deprecated" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/utils.go#L10-L12
153,169
kyokomi/slackbot
plugins/utils.go
NewUtils
func NewUtils(replacer *strings.Replacer) *Utils { if replacer == nil { replacer = strings.NewReplacer("'", "", `"`, "") } return &Utils{ replacer: replacer, } }
go
func NewUtils(replacer *strings.Replacer) *Utils { if replacer == nil { replacer = strings.NewReplacer("'", "", `"`, "") } return &Utils{ replacer: replacer, } }
[ "func", "NewUtils", "(", "replacer", "*", "strings", ".", "Replacer", ")", "*", "Utils", "{", "if", "replacer", "==", "nil", "{", "replacer", "=", "strings", ".", "NewReplacer", "(", "\"", "\"", ",", "\"", "\"", ",", "`\"`", ",", "\"", "\"", ")", "...
// NewUtils return a utils
[ "NewUtils", "return", "a", "utils" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/utils.go#L57-L64
153,170
favclip/ds2bq
datastore_management_service.go
ManagementWithURLs
func ManagementWithURLs(apiDeleteBackupURL, deleteOldBackupURL, deleteUnitOfBackupURL string) ManagementOption { return &managementURLOption{ APIDeleteBackupsURL: apiDeleteBackupURL, DeleteOldBackupURL: deleteOldBackupURL, DeleteUnitOfBackupURL: deleteUnitOfBackupURL, } }
go
func ManagementWithURLs(apiDeleteBackupURL, deleteOldBackupURL, deleteUnitOfBackupURL string) ManagementOption { return &managementURLOption{ APIDeleteBackupsURL: apiDeleteBackupURL, DeleteOldBackupURL: deleteOldBackupURL, DeleteUnitOfBackupURL: deleteUnitOfBackupURL, } }
[ "func", "ManagementWithURLs", "(", "apiDeleteBackupURL", ",", "deleteOldBackupURL", ",", "deleteUnitOfBackupURL", "string", ")", "ManagementOption", "{", "return", "&", "managementURLOption", "{", "APIDeleteBackupsURL", ":", "apiDeleteBackupURL", ",", "DeleteOldBackupURL", ...
// ManagementWithURLs provides API endpoint URL.
[ "ManagementWithURLs", "provides", "API", "endpoint", "URL", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_service.go#L37-L43
153,171
favclip/ds2bq
datastore_management_service.go
NewDatastoreManagementService
func NewDatastoreManagementService(opts ...ManagementOption) DatastoreManagementService { s := &datastoreManagementService{ QueueName: "exec-rm-old-datastore-backups", ExpireAfter: 30 * 24 * time.Hour, APIDeleteBackupsURL: "/api/datastore-management/delete-old-backups", DeleteOldBackupURL: "/tq/datastore-management/delete-old-backups", DeleteUnitOfBackupURL: "/tq/datastore-management/delete-backup", } for _, opt := range opts { opt.implements(s) } return s }
go
func NewDatastoreManagementService(opts ...ManagementOption) DatastoreManagementService { s := &datastoreManagementService{ QueueName: "exec-rm-old-datastore-backups", ExpireAfter: 30 * 24 * time.Hour, APIDeleteBackupsURL: "/api/datastore-management/delete-old-backups", DeleteOldBackupURL: "/tq/datastore-management/delete-old-backups", DeleteUnitOfBackupURL: "/tq/datastore-management/delete-backup", } for _, opt := range opts { opt.implements(s) } return s }
[ "func", "NewDatastoreManagementService", "(", "opts", "...", "ManagementOption", ")", "DatastoreManagementService", "{", "s", ":=", "&", "datastoreManagementService", "{", "QueueName", ":", "\"", "\"", ",", "ExpireAfter", ":", "30", "*", "24", "*", "time", ".", ...
// NewDatastoreManagementService returns ready to use DatastoreManagementService.
[ "NewDatastoreManagementService", "returns", "ready", "to", "use", "DatastoreManagementService", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_service.go#L94-L108
153,172
favclip/ds2bq
datastore_management_service.go
SetupWithUconSwagger
func (s *datastoreManagementService) SetupWithUconSwagger(swPlugin *swagger.Plugin) { tag := swPlugin.AddTag(&swagger.Tag{Name: "DatastoreManagement", Description: ""}) info := swagger.NewHandlerInfo(s.HandlePostTQ) ucon.Handle("DELETE", s.APIDeleteBackupsURL, info) info.Description, info.Tags = "Remove old Datastore backups", []string{tag.Name} ucon.HandleFunc("GET,DELETE", s.DeleteOldBackupURL, s.HandlePostDeleteList) ucon.HandleFunc("GET,DELETE", s.DeleteUnitOfBackupURL, s.HandleDeleteAEBackupInformation) }
go
func (s *datastoreManagementService) SetupWithUconSwagger(swPlugin *swagger.Plugin) { tag := swPlugin.AddTag(&swagger.Tag{Name: "DatastoreManagement", Description: ""}) info := swagger.NewHandlerInfo(s.HandlePostTQ) ucon.Handle("DELETE", s.APIDeleteBackupsURL, info) info.Description, info.Tags = "Remove old Datastore backups", []string{tag.Name} ucon.HandleFunc("GET,DELETE", s.DeleteOldBackupURL, s.HandlePostDeleteList) ucon.HandleFunc("GET,DELETE", s.DeleteUnitOfBackupURL, s.HandleDeleteAEBackupInformation) }
[ "func", "(", "s", "*", "datastoreManagementService", ")", "SetupWithUconSwagger", "(", "swPlugin", "*", "swagger", ".", "Plugin", ")", "{", "tag", ":=", "swPlugin", ".", "AddTag", "(", "&", "swagger", ".", "Tag", "{", "Name", ":", "\"", "\"", ",", "Descr...
// SetupWithUconSwagger setup handlers to ucon mux.
[ "SetupWithUconSwagger", "setup", "handlers", "to", "ucon", "mux", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_service.go#L111-L121
153,173
favclip/ds2bq
misc.go
ExecQuery
func ExecQuery(c context.Context, q *datastore.Query, ldr QueryListLoader) error { g := goon.FromContext(c) req := ldr.ReqListBase() if req.Limit == 0 { req.Limit = 10 } if req.Limit != -1 { q = q.Limit(req.Limit + 1) // get 1 more, fill blank to cursor when next one is not exists. } if req.Offset > 0 { q = q.Offset(req.Offset) } if req.Cursor != "" { cursor, err := datastore.DecodeCursor(req.Cursor) if err != nil { return err } q = q.Start(cursor) } q = q.KeysOnly() log.Debugf(c, "%#v", q) t := g.Run(q) count := 0 hasNext := false var cursor datastore.Cursor for { key, err := t.Next(nil) if err == datastore.Done { break } if err != nil { return err } count++ if req.Limit != -1 && req.Limit < count { // +1 hasNext = true break } inst, err := ldr.LoadInstance(c, key) if err != nil { return err } err = ldr.Append(inst) if err != nil { return err } if req.Limit == count { // store cursor at reach to limit. cursor, err = t.Cursor() if err != nil { return err } } } err := ldr.PostProcess(c) if err != nil { return err } resp := ldr.RespListBase() if hasNext { resp.Cursor = cursor.String() } return nil }
go
func ExecQuery(c context.Context, q *datastore.Query, ldr QueryListLoader) error { g := goon.FromContext(c) req := ldr.ReqListBase() if req.Limit == 0 { req.Limit = 10 } if req.Limit != -1 { q = q.Limit(req.Limit + 1) // get 1 more, fill blank to cursor when next one is not exists. } if req.Offset > 0 { q = q.Offset(req.Offset) } if req.Cursor != "" { cursor, err := datastore.DecodeCursor(req.Cursor) if err != nil { return err } q = q.Start(cursor) } q = q.KeysOnly() log.Debugf(c, "%#v", q) t := g.Run(q) count := 0 hasNext := false var cursor datastore.Cursor for { key, err := t.Next(nil) if err == datastore.Done { break } if err != nil { return err } count++ if req.Limit != -1 && req.Limit < count { // +1 hasNext = true break } inst, err := ldr.LoadInstance(c, key) if err != nil { return err } err = ldr.Append(inst) if err != nil { return err } if req.Limit == count { // store cursor at reach to limit. cursor, err = t.Cursor() if err != nil { return err } } } err := ldr.PostProcess(c) if err != nil { return err } resp := ldr.RespListBase() if hasNext { resp.Cursor = cursor.String() } return nil }
[ "func", "ExecQuery", "(", "c", "context", ".", "Context", ",", "q", "*", "datastore", ".", "Query", ",", "ldr", "QueryListLoader", ")", "error", "{", "g", ":=", "goon", ".", "FromContext", "(", "c", ")", "\n\n", "req", ":=", "ldr", ".", "ReqListBase", ...
// ExecQuery with QueryListLoader.
[ "ExecQuery", "with", "QueryListLoader", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/misc.go#L46-L122
153,174
favclip/ds2bq
datastore_management_model.go
GetAEDatastoreAdminOperation
func (store *AEDatastoreStore) GetAEDatastoreAdminOperation(c context.Context, id int64) (*AEDatastoreAdminOperation, error) { if id == 0 { return nil, ErrInvalidID } g := goon.FromContext(c) entity := &AEDatastoreAdminOperation{ID: id} err := g.Get(entity) if err != nil { log.Infof(c, "on Get AEDatastoreAdminOperation: %s", err.Error()) return nil, err } err = entity.FetchChildren(c) if err != nil { log.Infof(c, "on AEDatastoreAdminOperation.FetchChildren: %s", err.Error()) return nil, err } return entity, nil }
go
func (store *AEDatastoreStore) GetAEDatastoreAdminOperation(c context.Context, id int64) (*AEDatastoreAdminOperation, error) { if id == 0 { return nil, ErrInvalidID } g := goon.FromContext(c) entity := &AEDatastoreAdminOperation{ID: id} err := g.Get(entity) if err != nil { log.Infof(c, "on Get AEDatastoreAdminOperation: %s", err.Error()) return nil, err } err = entity.FetchChildren(c) if err != nil { log.Infof(c, "on AEDatastoreAdminOperation.FetchChildren: %s", err.Error()) return nil, err } return entity, nil }
[ "func", "(", "store", "*", "AEDatastoreStore", ")", "GetAEDatastoreAdminOperation", "(", "c", "context", ".", "Context", ",", "id", "int64", ")", "(", "*", "AEDatastoreAdminOperation", ",", "error", ")", "{", "if", "id", "==", "0", "{", "return", "nil", ",...
// GetAEDatastoreAdminOperation returns AEDatastoreAdminOperation that specified by id.
[ "GetAEDatastoreAdminOperation", "returns", "AEDatastoreAdminOperation", "that", "specified", "by", "id", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_model.go#L102-L122
153,175
favclip/ds2bq
datastore_management_model.go
ListAEDatastoreAdminOperation
func (store *AEDatastoreStore) ListAEDatastoreAdminOperation(c context.Context, req *ReqListBase) ([]*AEDatastoreAdminOperation, *RespListBase, error) { if req.Limit == 0 { req.Limit = 10 } qb := newAEDatastoreAdminOperationQueryBuilder() qb.ID.Asc() q := qb.Query() ldr := &AEDatastoreAdminOperationListLoader{ List: make([]*AEDatastoreAdminOperation, 0, req.Limit), Req: *req, RespList: &RespListBase{}, } err := ExecQuery(c, q, ldr) if err != nil { return nil, nil, err } return ldr.List, ldr.RespListBase(), nil }
go
func (store *AEDatastoreStore) ListAEDatastoreAdminOperation(c context.Context, req *ReqListBase) ([]*AEDatastoreAdminOperation, *RespListBase, error) { if req.Limit == 0 { req.Limit = 10 } qb := newAEDatastoreAdminOperationQueryBuilder() qb.ID.Asc() q := qb.Query() ldr := &AEDatastoreAdminOperationListLoader{ List: make([]*AEDatastoreAdminOperation, 0, req.Limit), Req: *req, RespList: &RespListBase{}, } err := ExecQuery(c, q, ldr) if err != nil { return nil, nil, err } return ldr.List, ldr.RespListBase(), nil }
[ "func", "(", "store", "*", "AEDatastoreStore", ")", "ListAEDatastoreAdminOperation", "(", "c", "context", ".", "Context", ",", "req", "*", "ReqListBase", ")", "(", "[", "]", "*", "AEDatastoreAdminOperation", ",", "*", "RespListBase", ",", "error", ")", "{", ...
// ListAEDatastoreAdminOperation return list of AEDatastoreAdminOperation.
[ "ListAEDatastoreAdminOperation", "return", "list", "of", "AEDatastoreAdminOperation", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_model.go#L125-L144
153,176
favclip/ds2bq
datastore_management_model.go
GetAEBackupInformation
func (store *AEDatastoreStore) GetAEBackupInformation(c context.Context, parentKey *datastore.Key, id int64) (*AEBackupInformation, error) { if id == 0 { return nil, ErrInvalidID } g := goon.FromContext(c) entity := &AEBackupInformation{ParentKey: parentKey, ID: id} err := g.Get(entity) if err != nil { log.Infof(c, "on Get AEBackupInformation: %s", err.Error()) return nil, err } err = entity.FetchChildren(c) if err != nil { log.Infof(c, "on AEBackupInformation.FetchChildren: %s", err.Error()) return nil, err } return entity, nil }
go
func (store *AEDatastoreStore) GetAEBackupInformation(c context.Context, parentKey *datastore.Key, id int64) (*AEBackupInformation, error) { if id == 0 { return nil, ErrInvalidID } g := goon.FromContext(c) entity := &AEBackupInformation{ParentKey: parentKey, ID: id} err := g.Get(entity) if err != nil { log.Infof(c, "on Get AEBackupInformation: %s", err.Error()) return nil, err } err = entity.FetchChildren(c) if err != nil { log.Infof(c, "on AEBackupInformation.FetchChildren: %s", err.Error()) return nil, err } return entity, nil }
[ "func", "(", "store", "*", "AEDatastoreStore", ")", "GetAEBackupInformation", "(", "c", "context", ".", "Context", ",", "parentKey", "*", "datastore", ".", "Key", ",", "id", "int64", ")", "(", "*", "AEBackupInformation", ",", "error", ")", "{", "if", "id",...
// GetAEBackupInformation returns AEBackupInformation that specified id.
[ "GetAEBackupInformation", "returns", "AEBackupInformation", "that", "specified", "id", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_model.go#L147-L167
153,177
favclip/ds2bq
datastore_management_model.go
ListAEBackupInformation
func (store *AEDatastoreStore) ListAEBackupInformation(c context.Context, req *ReqListBase) ([]*AEBackupInformation, *RespListBase, error) { if req.Limit == 0 { req.Limit = 10 } qb := newAEBackupInformationQueryBuilder() qb.ID.Asc() q := qb.Query() ldr := &AEBackupInformationListLoader{ List: make([]*AEBackupInformation, 0, req.Limit), Req: *req, RespList: &RespListBase{}, } err := ExecQuery(c, q, ldr) if err != nil { return nil, nil, err } return ldr.List, ldr.RespListBase(), nil }
go
func (store *AEDatastoreStore) ListAEBackupInformation(c context.Context, req *ReqListBase) ([]*AEBackupInformation, *RespListBase, error) { if req.Limit == 0 { req.Limit = 10 } qb := newAEBackupInformationQueryBuilder() qb.ID.Asc() q := qb.Query() ldr := &AEBackupInformationListLoader{ List: make([]*AEBackupInformation, 0, req.Limit), Req: *req, RespList: &RespListBase{}, } err := ExecQuery(c, q, ldr) if err != nil { return nil, nil, err } return ldr.List, ldr.RespListBase(), nil }
[ "func", "(", "store", "*", "AEDatastoreStore", ")", "ListAEBackupInformation", "(", "c", "context", ".", "Context", ",", "req", "*", "ReqListBase", ")", "(", "[", "]", "*", "AEBackupInformation", ",", "*", "RespListBase", ",", "error", ")", "{", "if", "req...
// ListAEBackupInformation return list of AEBackupInformation.
[ "ListAEBackupInformation", "return", "list", "of", "AEBackupInformation", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_model.go#L170-L189
153,178
favclip/ds2bq
datastore_management_model.go
DeleteAEBackupInformationAndRelatedData
func (store *AEDatastoreStore) DeleteAEBackupInformationAndRelatedData(c context.Context, key *datastore.Key) error { g := goon.FromContext(c) if key.Kind() != "_AE_Backup_Information" { return fmt.Errorf("invalid kind: %s", key.Kind()) } rootKey := key if key.Parent() != nil { rootKey = key.Parent() } log.Infof(c, "rootKey: %s", rootKey.String()) q := datastore.NewQuery("").Ancestor(rootKey).KeysOnly() keys, err := g.GetAll(q, nil) if err != nil { return err } for _, key := range keys { log.Infof(c, "remove target key: %s", key.String()) } return g.DeleteMulti(keys) }
go
func (store *AEDatastoreStore) DeleteAEBackupInformationAndRelatedData(c context.Context, key *datastore.Key) error { g := goon.FromContext(c) if key.Kind() != "_AE_Backup_Information" { return fmt.Errorf("invalid kind: %s", key.Kind()) } rootKey := key if key.Parent() != nil { rootKey = key.Parent() } log.Infof(c, "rootKey: %s", rootKey.String()) q := datastore.NewQuery("").Ancestor(rootKey).KeysOnly() keys, err := g.GetAll(q, nil) if err != nil { return err } for _, key := range keys { log.Infof(c, "remove target key: %s", key.String()) } return g.DeleteMulti(keys) }
[ "func", "(", "store", "*", "AEDatastoreStore", ")", "DeleteAEBackupInformationAndRelatedData", "(", "c", "context", ".", "Context", ",", "key", "*", "datastore", ".", "Key", ")", "error", "{", "g", ":=", "goon", ".", "FromContext", "(", "c", ")", "\n\n", "...
// DeleteAEBackupInformationAndRelatedData removes all child entities about AEBackupInformation or AEDatastoreAdminOperation kinds.
[ "DeleteAEBackupInformationAndRelatedData", "removes", "all", "child", "entities", "about", "AEBackupInformation", "or", "AEDatastoreAdminOperation", "kinds", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_model.go#L192-L217
153,179
favclip/ds2bq
datastore_management_model.go
PostProcess
func (ldr *AEBackupInformationListLoader) PostProcess(c context.Context) error { for _, entity := range ldr.List { if err := entity.FetchChildren(c); err != nil { return err } } return nil }
go
func (ldr *AEBackupInformationListLoader) PostProcess(c context.Context) error { for _, entity := range ldr.List { if err := entity.FetchChildren(c); err != nil { return err } } return nil }
[ "func", "(", "ldr", "*", "AEBackupInformationListLoader", ")", "PostProcess", "(", "c", "context", ".", "Context", ")", "error", "{", "for", "_", ",", "entity", ":=", "range", "ldr", ".", "List", "{", "if", "err", ":=", "entity", ".", "FetchChildren", "(...
// PostProcess internal list.
[ "PostProcess", "internal", "list", "." ]
73bc787eb607dae80eb1dd085a37e3a4123a77bb
https://github.com/favclip/ds2bq/blob/73bc787eb607dae80eb1dd085a37e3a4123a77bb/datastore_management_model.go#L417-L424
153,180
ReconfigureIO/sdaccel
smi/protocol.go
manageUpstreamPort
func manageUpstreamPort( upstreamRequest <-chan Flit64, upstreamResponse chan<- Flit64, taggedRequest chan<- Flit64, taggedResponse <-chan Flit64, transferReq chan<- uint8, portId uint8) { // Split the tags into upper and lower bytes for efficient access. // TODO: The array and channel sizes here should be set using the // SmiMemInFlightLimit constant once supported by the compiler. var tagTableLower [4]uint8 var tagTableUpper [4]uint8 tagFifo := make(chan uint8, 4) // Set up the local tag values. for tagInit := uint8(0); tagInit != 4; tagInit++ { tagFifo <- tagInit } // Start goroutine for tag replacement on requests. go func() { for { // Do tag replacement on header. headerFlit := <-upstreamRequest tagId := <-tagFifo tagTableLower[tagId] = headerFlit.Data[2] tagTableUpper[tagId] = headerFlit.Data[3] headerFlit.Data[2] = portId headerFlit.Data[3] = tagId transferReq <- portId taggedRequest <- headerFlit // Copy remaining flits from upstream to downstream. moreFlits := headerFlit.Eofc == 0 for moreFlits { bodyFlit := <-upstreamRequest moreFlits = bodyFlit.Eofc == 0 taggedRequest <- bodyFlit } } }() // Carry out tag replacement on responses. for { // Extract tag ID from header and use it to look up replacement. headerFlit := <-taggedResponse tagId := headerFlit.Data[3] headerFlit.Data[2] = tagTableLower[tagId] headerFlit.Data[3] = tagTableUpper[tagId] tagFifo <- tagId upstreamResponse <- headerFlit // Copy remaining flits from downstream to upstream. moreFlits := headerFlit.Eofc == 0 for moreFlits { bodyFlit := <-taggedResponse moreFlits = bodyFlit.Eofc == 0 upstreamResponse <- bodyFlit } } }
go
func manageUpstreamPort( upstreamRequest <-chan Flit64, upstreamResponse chan<- Flit64, taggedRequest chan<- Flit64, taggedResponse <-chan Flit64, transferReq chan<- uint8, portId uint8) { // Split the tags into upper and lower bytes for efficient access. // TODO: The array and channel sizes here should be set using the // SmiMemInFlightLimit constant once supported by the compiler. var tagTableLower [4]uint8 var tagTableUpper [4]uint8 tagFifo := make(chan uint8, 4) // Set up the local tag values. for tagInit := uint8(0); tagInit != 4; tagInit++ { tagFifo <- tagInit } // Start goroutine for tag replacement on requests. go func() { for { // Do tag replacement on header. headerFlit := <-upstreamRequest tagId := <-tagFifo tagTableLower[tagId] = headerFlit.Data[2] tagTableUpper[tagId] = headerFlit.Data[3] headerFlit.Data[2] = portId headerFlit.Data[3] = tagId transferReq <- portId taggedRequest <- headerFlit // Copy remaining flits from upstream to downstream. moreFlits := headerFlit.Eofc == 0 for moreFlits { bodyFlit := <-upstreamRequest moreFlits = bodyFlit.Eofc == 0 taggedRequest <- bodyFlit } } }() // Carry out tag replacement on responses. for { // Extract tag ID from header and use it to look up replacement. headerFlit := <-taggedResponse tagId := headerFlit.Data[3] headerFlit.Data[2] = tagTableLower[tagId] headerFlit.Data[3] = tagTableUpper[tagId] tagFifo <- tagId upstreamResponse <- headerFlit // Copy remaining flits from downstream to upstream. moreFlits := headerFlit.Eofc == 0 for moreFlits { bodyFlit := <-taggedResponse moreFlits = bodyFlit.Eofc == 0 upstreamResponse <- bodyFlit } } }
[ "func", "manageUpstreamPort", "(", "upstreamRequest", "<-", "chan", "Flit64", ",", "upstreamResponse", "chan", "<-", "Flit64", ",", "taggedRequest", "chan", "<-", "Flit64", ",", "taggedResponse", "<-", "chan", "Flit64", ",", "transferReq", "chan", "<-", "uint8", ...
// // Package arbitrate provides reusable arbitrators for SMI transactions. // // // manageUpstreamPort provides transaction management for the arbitrated // upstream ports. This includes header tag switching to allow request and // response message pairs to be matched up. //
[ "Package", "arbitrate", "provides", "reusable", "arbitrators", "for", "SMI", "transactions", ".", "manageUpstreamPort", "provides", "transaction", "management", "for", "the", "arbitrated", "upstream", "ports", ".", "This", "includes", "header", "tag", "switching", "to...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L143-L206
153,181
ReconfigureIO/sdaccel
smi/protocol.go
writeSingleBurstUInt64
func writeSingleBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddr uintptr, writeOptions uint8, writeLength uint16, writeDataChan <-chan uint64) bool { // Set up the initial flit data. firstFlit := Flit64{ Eofc: 0, Data: [8]uint8{ uint8(SmiMemWriteReq), uint8(writeOptions), uint8(0), uint8(0), uint8(writeAddr), uint8(writeAddr >> 8), uint8(writeAddr >> 16), uint8(writeAddr >> 24)}} flitData := [6]uint8{ uint8(writeAddr >> 32), uint8(writeAddr >> 40), uint8(writeAddr >> 48), uint8(writeAddr >> 56), uint8(writeLength), uint8(writeLength >> 8)} // Transmit the initial request flit. smiRequest <- firstFlit // Pull the requested number of words from the write data channel and // write the updated flit data to the request output. for i := (writeLength >> 3); i != 0; i-- { writeData := <-writeDataChan outputFlit := Flit64{ Eofc: 0, Data: [8]uint8{ flitData[0], flitData[1], flitData[2], flitData[3], flitData[4], flitData[5], uint8(writeData), uint8(writeData >> 8)}} flitData[0] = uint8(writeData >> 16) flitData[1] = uint8(writeData >> 24) flitData[2] = uint8(writeData >> 32) flitData[3] = uint8(writeData >> 40) flitData[4] = uint8(writeData >> 48) flitData[5] = uint8(writeData >> 56) smiRequest <- outputFlit } // Send the final flit. smiRequest <- Flit64{ Eofc: 6, Data: [8]uint8{ flitData[0], flitData[1], flitData[2], flitData[3], flitData[4], flitData[5], uint8(0), uint8(0)}} // Accept the response message. respFlit := <-smiResponse var writeOk bool if (respFlit.Data[1] & 0x02) == uint8(0x00) { writeOk = true } else { writeOk = false } return writeOk }
go
func writeSingleBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddr uintptr, writeOptions uint8, writeLength uint16, writeDataChan <-chan uint64) bool { // Set up the initial flit data. firstFlit := Flit64{ Eofc: 0, Data: [8]uint8{ uint8(SmiMemWriteReq), uint8(writeOptions), uint8(0), uint8(0), uint8(writeAddr), uint8(writeAddr >> 8), uint8(writeAddr >> 16), uint8(writeAddr >> 24)}} flitData := [6]uint8{ uint8(writeAddr >> 32), uint8(writeAddr >> 40), uint8(writeAddr >> 48), uint8(writeAddr >> 56), uint8(writeLength), uint8(writeLength >> 8)} // Transmit the initial request flit. smiRequest <- firstFlit // Pull the requested number of words from the write data channel and // write the updated flit data to the request output. for i := (writeLength >> 3); i != 0; i-- { writeData := <-writeDataChan outputFlit := Flit64{ Eofc: 0, Data: [8]uint8{ flitData[0], flitData[1], flitData[2], flitData[3], flitData[4], flitData[5], uint8(writeData), uint8(writeData >> 8)}} flitData[0] = uint8(writeData >> 16) flitData[1] = uint8(writeData >> 24) flitData[2] = uint8(writeData >> 32) flitData[3] = uint8(writeData >> 40) flitData[4] = uint8(writeData >> 48) flitData[5] = uint8(writeData >> 56) smiRequest <- outputFlit } // Send the final flit. smiRequest <- Flit64{ Eofc: 6, Data: [8]uint8{ flitData[0], flitData[1], flitData[2], flitData[3], flitData[4], flitData[5], uint8(0), uint8(0)}} // Accept the response message. respFlit := <-smiResponse var writeOk bool if (respFlit.Data[1] & 0x02) == uint8(0x00) { writeOk = true } else { writeOk = false } return writeOk }
[ "func", "writeSingleBurstUInt64", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "writeAddr", "uintptr", ",", "writeOptions", "uint8", ",", "writeLength", "uint16", ",", "writeDataChan", "<-", "chan", "uint64", ")", "...
// // writeSingleBurstUInt64 is the core logic for writing a single incrementing // burst of 64-bit unsigned data. Requires validated and word aligned input // parameters. //
[ "writeSingleBurstUInt64", "is", "the", "core", "logic", "for", "writing", "a", "single", "incrementing", "burst", "of", "64", "-", "bit", "unsigned", "data", ".", "Requires", "validated", "and", "word", "aligned", "input", "parameters", "." ]
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L926-L1004
153,182
ReconfigureIO/sdaccel
smi/protocol.go
WritePagedBurstUInt64
func WritePagedBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint64) bool { // TODO: Page boundary validation. // Force word alignment. writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFF8 writeLength := writeLengthIn << 3 return writeSingleBurstUInt64( smiRequest, smiResponse, writeAddr, writeOptions, writeLength, writeDataChan) }
go
func WritePagedBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint64) bool { // TODO: Page boundary validation. // Force word alignment. writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFF8 writeLength := writeLengthIn << 3 return writeSingleBurstUInt64( smiRequest, smiResponse, writeAddr, writeOptions, writeLength, writeDataChan) }
[ "func", "WritePagedBurstUInt64", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "writeAddrIn", "uintptr", ",", "writeOptions", "uint8", ",", "writeLengthIn", "uint16", ",", "writeDataChan", "<-", "chan", "uint64", ")", ...
// // WritePagedBurstUInt64 writes an incrementing burst of 64-bit unsigned data // values to a word aligned address on the specified SMI memory endpoint, with // the bottom three address bits being ignored. The supplied burst length // specifies the number of 64-bit values to be transferred. The overall burst // must be contained within a single 4096 byte page and must not cross page // boundaries. In order to ensure optimum performance, the write data channel // should be a buffered channel that already contains all the data to be // written prior to invoking this function. The status of the write transaction // is returned as the boolean 'writeOk' flag. //
[ "WritePagedBurstUInt64", "writes", "an", "incrementing", "burst", "of", "64", "-", "bit", "unsigned", "data", "values", "to", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "three", "address", ...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1283-L1298
153,183
ReconfigureIO/sdaccel
smi/protocol.go
WritePagedBurstUInt32
func WritePagedBurstUInt32( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint32) bool { // TODO: Page boundary validation. // Force word alignment. writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFFC writeLength := writeLengthIn << 2 return writeSingleBurstUInt32( smiRequest, smiResponse, writeAddr, writeOptions, writeLength, writeDataChan) }
go
func WritePagedBurstUInt32( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint32) bool { // TODO: Page boundary validation. // Force word alignment. writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFFC writeLength := writeLengthIn << 2 return writeSingleBurstUInt32( smiRequest, smiResponse, writeAddr, writeOptions, writeLength, writeDataChan) }
[ "func", "WritePagedBurstUInt32", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "writeAddrIn", "uintptr", ",", "writeOptions", "uint8", ",", "writeLengthIn", "uint16", ",", "writeDataChan", "<-", "chan", "uint32", ")", ...
// // WritePagedBurstUInt32 writes an incrementing burst of 32-bit unsigned data // values to a word aligned address on the specified SMI memory endpoint, with // the bottom two address bits being ignored. The supplied burst length // specifies the number of 32-bit values to be transferred. The overall burst // must be contained within a single 4096 byte page and must not cross page // boundaries. In order to ensure optimum performance, the write data channel // should be a buffered channel that already contains all the data to be // written prior to invoking this function. The status of the write transaction // is returned as the boolean 'writeOk' flag. //
[ "WritePagedBurstUInt32", "writes", "an", "incrementing", "burst", "of", "32", "-", "bit", "unsigned", "data", "values", "to", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "two", "address", "...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1311-L1326
153,184
ReconfigureIO/sdaccel
smi/protocol.go
WritePagedBurstUInt16
func WritePagedBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint16) bool { // TODO: Page boundary validation. // Force word alignment. writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFFE writeLength := writeLengthIn << 1 return writeSingleBurstUInt16( smiRequest, smiResponse, writeAddr, writeOptions, writeLength, writeDataChan) }
go
func WritePagedBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint16) bool { // TODO: Page boundary validation. // Force word alignment. writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFFE writeLength := writeLengthIn << 1 return writeSingleBurstUInt16( smiRequest, smiResponse, writeAddr, writeOptions, writeLength, writeDataChan) }
[ "func", "WritePagedBurstUInt16", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "writeAddrIn", "uintptr", ",", "writeOptions", "uint8", ",", "writeLengthIn", "uint16", ",", "writeDataChan", "<-", "chan", "uint16", ")", ...
// // WritePagedBurstUInt16 writes an incrementing burst of 16-bit unsigned data // values to a word aligned address on the specified SMI memory endpoint, with // the bottom address bit being ignored. The supplied burst length specifies // the number of 16-bit values to be transferred. The overall burst must be // contained within a single 4096 byte page and must not cross page boundaries. // In order to ensure optimum performance, the write data channel should be a // buffered channel that already contains all the data to be written prior to // invoking this function. The status of the write transaction is returned as // the boolean 'writeOk' flag. //
[ "WritePagedBurstUInt16", "writes", "an", "incrementing", "burst", "of", "16", "-", "bit", "unsigned", "data", "values", "to", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "address", "bit", "...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1339-L1354
153,185
ReconfigureIO/sdaccel
smi/protocol.go
WritePagedBurstUInt8
func WritePagedBurstUInt8( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint8) bool { // TODO: Page boundary validation. return writeSingleBurstUInt8( smiRequest, smiResponse, writeAddrIn, writeOptions, writeLengthIn, writeDataChan) }
go
func WritePagedBurstUInt8( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint16, writeDataChan <-chan uint8) bool { // TODO: Page boundary validation. return writeSingleBurstUInt8( smiRequest, smiResponse, writeAddrIn, writeOptions, writeLengthIn, writeDataChan) }
[ "func", "WritePagedBurstUInt8", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "writeAddrIn", "uintptr", ",", "writeOptions", "uint8", ",", "writeLengthIn", "uint16", ",", "writeDataChan", "<-", "chan", "uint8", ")", ...
// // WritePagedBurstUInt8 writes an incrementing burst of 8-bit unsigned data // values to a byte aligned address on the specified SMI memory endpoint. The // burst must be contained within a single 4096 byte page and must not cross // page boundaries. In order to ensure optimum performance, the write data // channel should be a buffered channel that already contains all the data to // be written prior to invoking this function. The status of the write // transaction is returned as the boolean 'writeOk' flag. //
[ "WritePagedBurstUInt8", "writes", "an", "incrementing", "burst", "of", "8", "-", "bit", "unsigned", "data", "values", "to", "a", "byte", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", ".", "The", "burst", "must", "be", "contained"...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1365-L1377
153,186
ReconfigureIO/sdaccel
smi/protocol.go
WriteBurstUInt64
func WriteBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint32, writeDataChan <-chan uint64) bool { writeOk := true writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFF8 writeLength := writeLengthIn << 3 burstOffset := uint16(writeAddr) & uint16(SmiMemBurstSize-1) burstSize := uint16(SmiMemBurstSize) - burstOffset smiWriteChan := make(chan Flit64, 1) asmReqChan := make(chan bool, 1) asmDoneChan := make(chan bool, 1) go AssembleFrame64(asmReqChan, smiWriteChan, smiRequest, asmDoneChan) for writeLength != 0 { asmReqChan <- true if writeLength < uint32(burstSize) { burstSize = uint16(writeLength) } thisWriteOk := writeSingleBurstUInt64( smiWriteChan, smiResponse, writeAddr, writeOptions, burstSize, writeDataChan) writeOk = writeOk && thisWriteOk writeAddr += uintptr(burstSize) writeLength -= uint32(burstSize) burstSize = uint16(SmiMemBurstSize) <-asmDoneChan } asmReqChan <- false return writeOk }
go
func WriteBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, writeAddrIn uintptr, writeOptions uint8, writeLengthIn uint32, writeDataChan <-chan uint64) bool { writeOk := true writeAddr := writeAddrIn & 0xFFFFFFFFFFFFFFF8 writeLength := writeLengthIn << 3 burstOffset := uint16(writeAddr) & uint16(SmiMemBurstSize-1) burstSize := uint16(SmiMemBurstSize) - burstOffset smiWriteChan := make(chan Flit64, 1) asmReqChan := make(chan bool, 1) asmDoneChan := make(chan bool, 1) go AssembleFrame64(asmReqChan, smiWriteChan, smiRequest, asmDoneChan) for writeLength != 0 { asmReqChan <- true if writeLength < uint32(burstSize) { burstSize = uint16(writeLength) } thisWriteOk := writeSingleBurstUInt64( smiWriteChan, smiResponse, writeAddr, writeOptions, burstSize, writeDataChan) writeOk = writeOk && thisWriteOk writeAddr += uintptr(burstSize) writeLength -= uint32(burstSize) burstSize = uint16(SmiMemBurstSize) <-asmDoneChan } asmReqChan <- false return writeOk }
[ "func", "WriteBurstUInt64", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "writeAddrIn", "uintptr", ",", "writeOptions", "uint8", ",", "writeLengthIn", "uint32", ",", "writeDataChan", "<-", "chan", "uint64", ")", "bo...
// // WriteBurstUInt64 writes an incrementing burst of 64-bit unsigned data // values to a word aligned address on the specified SMI memory endpoint, with // the bottom three address bits being ignored. The supplied burst length // specifies the number of 64-bit values to be transferred, up to a maximum of // 2^29-1. The burst is automatically segmented to respect page boundaries and // avoid blocking other transactions. In order to ensure optimum performance, // the write data channel should be a buffered channel that already contains // all the data to be written prior to invoking this function. The status of // the write transaction is returned as the boolean 'writeOk' flag. //
[ "WriteBurstUInt64", "writes", "an", "incrementing", "burst", "of", "64", "-", "bit", "unsigned", "data", "values", "to", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "three", "address", "bit...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1390-L1423
153,187
ReconfigureIO/sdaccel
smi/protocol.go
readSingleBurstUInt64
func readSingleBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddr uintptr, readOptions uint8, readLength uint16, readDataChan chan<- uint64) bool { // Set up the request flit data. reqFlit1 := Flit64{ Eofc: 0, Data: [8]uint8{ uint8(SmiMemReadReq), uint8(readOptions), uint8(0), uint8(0), uint8(readAddr), uint8(readAddr >> 8), uint8(readAddr >> 16), uint8(readAddr >> 24)}} reqFlit2 := Flit64{ Eofc: 6, Data: [8]uint8{ uint8(readAddr >> 32), uint8(readAddr >> 40), uint8(readAddr >> 48), uint8(readAddr >> 56), uint8(readLength), uint8(readLength >> 8), uint8(0), uint8(0)}} // Transmit the request flits. smiRequest <- reqFlit1 smiRequest <- reqFlit2 // Pull the response header flit from the response channel respFlit1 := <-smiResponse flitData := [4]uint8{ respFlit1.Data[4], respFlit1.Data[5], respFlit1.Data[6], respFlit1.Data[7]} moreFlits := respFlit1.Eofc == 0 var readOk bool if (respFlit1.Data[1] & 0x02) == uint8(0x00) { readOk = true } else { readOk = false } // Pull all the payload flits from the response channel and copy the data // to the output channel. for moreFlits { respFlitN := <-smiResponse readDataVal := ((uint64(flitData[0]) | (uint64(flitData[1]) << 8)) | ((uint64(flitData[2]) << 16) | (uint64(flitData[3]) << 24))) | (((uint64(respFlitN.Data[0]) << 32) | (uint64(respFlitN.Data[1]) << 40)) | ((uint64(respFlitN.Data[2]) << 48) | (uint64(respFlitN.Data[3]) << 56))) flitData = [4]uint8{ respFlitN.Data[4], respFlitN.Data[5], respFlitN.Data[6], respFlitN.Data[7]} moreFlits = respFlitN.Eofc == 0 readDataChan <- readDataVal } return readOk }
go
func readSingleBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddr uintptr, readOptions uint8, readLength uint16, readDataChan chan<- uint64) bool { // Set up the request flit data. reqFlit1 := Flit64{ Eofc: 0, Data: [8]uint8{ uint8(SmiMemReadReq), uint8(readOptions), uint8(0), uint8(0), uint8(readAddr), uint8(readAddr >> 8), uint8(readAddr >> 16), uint8(readAddr >> 24)}} reqFlit2 := Flit64{ Eofc: 6, Data: [8]uint8{ uint8(readAddr >> 32), uint8(readAddr >> 40), uint8(readAddr >> 48), uint8(readAddr >> 56), uint8(readLength), uint8(readLength >> 8), uint8(0), uint8(0)}} // Transmit the request flits. smiRequest <- reqFlit1 smiRequest <- reqFlit2 // Pull the response header flit from the response channel respFlit1 := <-smiResponse flitData := [4]uint8{ respFlit1.Data[4], respFlit1.Data[5], respFlit1.Data[6], respFlit1.Data[7]} moreFlits := respFlit1.Eofc == 0 var readOk bool if (respFlit1.Data[1] & 0x02) == uint8(0x00) { readOk = true } else { readOk = false } // Pull all the payload flits from the response channel and copy the data // to the output channel. for moreFlits { respFlitN := <-smiResponse readDataVal := ((uint64(flitData[0]) | (uint64(flitData[1]) << 8)) | ((uint64(flitData[2]) << 16) | (uint64(flitData[3]) << 24))) | (((uint64(respFlitN.Data[0]) << 32) | (uint64(respFlitN.Data[1]) << 40)) | ((uint64(respFlitN.Data[2]) << 48) | (uint64(respFlitN.Data[3]) << 56))) flitData = [4]uint8{ respFlitN.Data[4], respFlitN.Data[5], respFlitN.Data[6], respFlitN.Data[7]} moreFlits = respFlitN.Eofc == 0 readDataChan <- readDataVal } return readOk }
[ "func", "readSingleBurstUInt64", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddr", "uintptr", ",", "readOptions", "uint8", ",", "readLength", "uint16", ",", "readDataChan", "chan", "<-", "uint64", ")", "bool"...
// // readSingleBurstUInt64 is the core logic for reading a single incrementing // burst of 64-bit unsigned data. Requires validated and word aligned input // parameters. //
[ "readSingleBurstUInt64", "is", "the", "core", "logic", "for", "reading", "a", "single", "incrementing", "burst", "of", "64", "-", "bit", "unsigned", "data", ".", "Requires", "validated", "and", "word", "aligned", "input", "parameters", "." ]
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1566-L1641
153,188
ReconfigureIO/sdaccel
smi/protocol.go
readSingleBurstUInt16
func readSingleBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddr uintptr, readOptions uint8, readLength uint16, readDataChan chan<- uint16) bool { // Set up the request flit data. reqFlit1 := Flit64{ Eofc: 0, Data: [8]uint8{ uint8(SmiMemReadReq), uint8(readOptions), uint8(0), uint8(0), uint8(readAddr), uint8(readAddr >> 8), uint8(readAddr >> 16), uint8(readAddr >> 24)}} reqFlit2 := Flit64{ Eofc: 6, Data: [8]uint8{ uint8(readAddr >> 32), uint8(readAddr >> 40), uint8(readAddr >> 48), uint8(readAddr >> 56), uint8(readLength), uint8(readLength >> 8), uint8(0), uint8(0)}} // Transmit the request flits. smiRequest <- reqFlit1 smiRequest <- reqFlit2 // Pull the response header flit from the response channel respFlit1 := <-smiResponse flitData := [6]uint8{ uint8(0), uint8(0), respFlit1.Data[4], respFlit1.Data[5], respFlit1.Data[6], respFlit1.Data[7]} readOffset := uint8(4) var readOk bool if (respFlit1.Data[1] & 0x02) == uint8(0x00) { readOk = true } else { readOk = false } // Pull all the payload flits from the response channel and copy the data // to the output channel. for i := (readLength >> 1); i != 0; i-- { var readData uint16 switch readOffset { case 2: readData = (uint16(flitData[0])) | (uint16(flitData[1]) << 8) readOffset = 4 case 4: readData = (uint16(flitData[2])) | (uint16(flitData[3]) << 8) readOffset = 6 case 6: readData = (uint16(flitData[4])) | (uint16(flitData[5]) << 8) readOffset = 0 default: respFlitN := <-smiResponse flitData = [6]uint8{ respFlitN.Data[2], respFlitN.Data[3], respFlitN.Data[4], respFlitN.Data[5], respFlitN.Data[6], respFlitN.Data[7]} readData = (uint16(respFlitN.Data[0])) | (uint16(respFlitN.Data[1]) << 8) readOffset = 2 } readDataChan <- readData } return readOk }
go
func readSingleBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddr uintptr, readOptions uint8, readLength uint16, readDataChan chan<- uint16) bool { // Set up the request flit data. reqFlit1 := Flit64{ Eofc: 0, Data: [8]uint8{ uint8(SmiMemReadReq), uint8(readOptions), uint8(0), uint8(0), uint8(readAddr), uint8(readAddr >> 8), uint8(readAddr >> 16), uint8(readAddr >> 24)}} reqFlit2 := Flit64{ Eofc: 6, Data: [8]uint8{ uint8(readAddr >> 32), uint8(readAddr >> 40), uint8(readAddr >> 48), uint8(readAddr >> 56), uint8(readLength), uint8(readLength >> 8), uint8(0), uint8(0)}} // Transmit the request flits. smiRequest <- reqFlit1 smiRequest <- reqFlit2 // Pull the response header flit from the response channel respFlit1 := <-smiResponse flitData := [6]uint8{ uint8(0), uint8(0), respFlit1.Data[4], respFlit1.Data[5], respFlit1.Data[6], respFlit1.Data[7]} readOffset := uint8(4) var readOk bool if (respFlit1.Data[1] & 0x02) == uint8(0x00) { readOk = true } else { readOk = false } // Pull all the payload flits from the response channel and copy the data // to the output channel. for i := (readLength >> 1); i != 0; i-- { var readData uint16 switch readOffset { case 2: readData = (uint16(flitData[0])) | (uint16(flitData[1]) << 8) readOffset = 4 case 4: readData = (uint16(flitData[2])) | (uint16(flitData[3]) << 8) readOffset = 6 case 6: readData = (uint16(flitData[4])) | (uint16(flitData[5]) << 8) readOffset = 0 default: respFlitN := <-smiResponse flitData = [6]uint8{ respFlitN.Data[2], respFlitN.Data[3], respFlitN.Data[4], respFlitN.Data[5], respFlitN.Data[6], respFlitN.Data[7]} readData = (uint16(respFlitN.Data[0])) | (uint16(respFlitN.Data[1]) << 8) readOffset = 2 } readDataChan <- readData } return readOk }
[ "func", "readSingleBurstUInt16", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddr", "uintptr", ",", "readOptions", "uint8", ",", "readLength", "uint16", ",", "readDataChan", "chan", "<-", "uint16", ")", "bool"...
// // readSingleBurstUInt16 is the core logic for reading a single incrementing // burst of 16-bit unsigned data. Requires validated and word aligned input // parameters. //
[ "readSingleBurstUInt16", "is", "the", "core", "logic", "for", "reading", "a", "single", "incrementing", "burst", "of", "16", "-", "bit", "unsigned", "data", ".", "Requires", "validated", "and", "word", "aligned", "input", "parameters", "." ]
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1736-L1828
153,189
ReconfigureIO/sdaccel
smi/protocol.go
ReadPagedBurstUInt64
func ReadPagedBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint64) bool { // TODO: Page boundary validation. // Force word alignment. readAddr := readAddrIn & 0xFFFFFFFFFFFFFFF8 readLength := readLengthIn << 3 return readSingleBurstUInt64( smiRequest, smiResponse, readAddr, readOptions, readLength, readDataChan) }
go
func ReadPagedBurstUInt64( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint64) bool { // TODO: Page boundary validation. // Force word alignment. readAddr := readAddrIn & 0xFFFFFFFFFFFFFFF8 readLength := readLengthIn << 3 return readSingleBurstUInt64( smiRequest, smiResponse, readAddr, readOptions, readLength, readDataChan) }
[ "func", "ReadPagedBurstUInt64", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddrIn", "uintptr", ",", "readOptions", "uint8", ",", "readLengthIn", "uint16", ",", "readDataChan", "chan", "<-", "uint64", ")", "bo...
// // ReadPagedBurstUInt64 reads an incrementing burst of 64-bit unsigned data // values from a word aligned address on the specified SMI memory endpoint, // with the bottom three address bits being ignored. The supplied burst length // specifies the number of 64-bit values to be transferred. The overall burst // must be contained within a single 4096 byte page and must not cross page // boundaries. In order to ensure optimum performance, the read data channel // should be a buffered channel that has sufficient free space to hold all the // data to be transferred. The status of the read transaction is returned as // the boolean 'readOk' flag. //
[ "ReadPagedBurstUInt64", "reads", "an", "incrementing", "burst", "of", "64", "-", "bit", "unsigned", "data", "values", "from", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "three", "address", ...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1946-L1961
153,190
ReconfigureIO/sdaccel
smi/protocol.go
ReadPagedBurstUInt32
func ReadPagedBurstUInt32( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint32) bool { // TODO: Page boundary validation. // Force word alignment. readAddr := readAddrIn & 0xFFFFFFFFFFFFFFFC readLength := readLengthIn << 2 return readSingleBurstUInt32( smiRequest, smiResponse, readAddr, readOptions, readLength, readDataChan) }
go
func ReadPagedBurstUInt32( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint32) bool { // TODO: Page boundary validation. // Force word alignment. readAddr := readAddrIn & 0xFFFFFFFFFFFFFFFC readLength := readLengthIn << 2 return readSingleBurstUInt32( smiRequest, smiResponse, readAddr, readOptions, readLength, readDataChan) }
[ "func", "ReadPagedBurstUInt32", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddrIn", "uintptr", ",", "readOptions", "uint8", ",", "readLengthIn", "uint16", ",", "readDataChan", "chan", "<-", "uint32", ")", "bo...
// // ReadPagedBurstUInt32 reads an incrementing burst of 32-bit unsigned data // values from a word aligned address on the specified SMI memory endpoint, // with the bottom two address bits being ignored. The supplied burst length // specifies the number of 32-bit values to be transferred. The overall burst // must be contained within a single 4096 byte page and must not cross page // boundaries. In order to ensure optimum performance, the read data channel // should be a buffered channel that has sufficient free space to hold all the // data to be transferred. The status of the read transaction is returned as // the boolean 'readOk' flag. //
[ "ReadPagedBurstUInt32", "reads", "an", "incrementing", "burst", "of", "32", "-", "bit", "unsigned", "data", "values", "from", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "two", "address", "...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L1974-L1989
153,191
ReconfigureIO/sdaccel
smi/protocol.go
ReadPagedBurstUInt16
func ReadPagedBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint16) bool { // TODO: Page boundary validation. // Force word alignment. readAddr := readAddrIn & 0xFFFFFFFFFFFFFFFE readLength := readLengthIn << 1 return readSingleBurstUInt16( smiRequest, smiResponse, readAddr, readOptions, readLength, readDataChan) }
go
func ReadPagedBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint16) bool { // TODO: Page boundary validation. // Force word alignment. readAddr := readAddrIn & 0xFFFFFFFFFFFFFFFE readLength := readLengthIn << 1 return readSingleBurstUInt16( smiRequest, smiResponse, readAddr, readOptions, readLength, readDataChan) }
[ "func", "ReadPagedBurstUInt16", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddrIn", "uintptr", ",", "readOptions", "uint8", ",", "readLengthIn", "uint16", ",", "readDataChan", "chan", "<-", "uint16", ")", "bo...
// // ReadPagedBurstUInt16 reads an incrementing burst of 16-bit unsigned data // values from a word aligned address on the specified SMI memory endpoint, // with the bottom address bit being ignored. The supplied burst length // specifies the number of 16-bit values to be transferred. The overall burst // must be contained within a single 4096 byte page and must not cross page // boundaries. In order to ensure optimum performance, the read data channel // should be a buffered channel that has sufficient free space to hold all the // data to be transferred. The status of the read transaction is returned as // the boolean 'readOk' flag. //
[ "ReadPagedBurstUInt16", "reads", "an", "incrementing", "burst", "of", "16", "-", "bit", "unsigned", "data", "values", "from", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "address", "bit", "...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L2002-L2017
153,192
ReconfigureIO/sdaccel
smi/protocol.go
ReadPagedBurstUInt8
func ReadPagedBurstUInt8( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint8) bool { // TODO: Page boundary validation. return readSingleBurstUInt8( smiRequest, smiResponse, readAddrIn, readOptions, readLengthIn, readDataChan) }
go
func ReadPagedBurstUInt8( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint16, readDataChan chan<- uint8) bool { // TODO: Page boundary validation. return readSingleBurstUInt8( smiRequest, smiResponse, readAddrIn, readOptions, readLengthIn, readDataChan) }
[ "func", "ReadPagedBurstUInt8", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddrIn", "uintptr", ",", "readOptions", "uint8", ",", "readLengthIn", "uint16", ",", "readDataChan", "chan", "<-", "uint8", ")", "bool...
// // ReadPagedBurstUInt8 reads an incrementing burst of 8-bit unsigned data // values from a byte aligned address on the specified SMI memory endpoint. // The burst must be contained within a single 4096 byte page and must not // cross page boundaries. In order to ensure optimum performance, the read // data channel should be a buffered channel that has sufficient free space to // hold all the data to be transferred. The status of the read transaction is // returned as the boolean 'readOk' flag. //
[ "ReadPagedBurstUInt8", "reads", "an", "incrementing", "burst", "of", "8", "-", "bit", "unsigned", "data", "values", "from", "a", "byte", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", ".", "The", "burst", "must", "be", "contained"...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L2028-L2040
153,193
ReconfigureIO/sdaccel
smi/protocol.go
ReadBurstUInt16
func ReadBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint32, readDataChan chan<- uint16) bool { readOk := true readAddr := readAddrIn & 0xFFFFFFFFFFFFFFFE readLength := readLengthIn << 1 burstOffset := uint16(readAddr) & uint16(SmiMemBurstSize-1) burstSize := uint16(SmiMemBurstSize) - burstOffset smiReadChan := make(chan Flit64, 1) fwdReqChan := make(chan bool, 1) fwdDoneChan := make(chan bool, 1) go ForwardFrame64(fwdReqChan, smiResponse, smiReadChan, fwdDoneChan) for readLength != 0 { fwdReqChan <- true if readLength < uint32(burstSize) { burstSize = uint16(readLength) } thisReadOk := readSingleBurstUInt16( smiRequest, smiReadChan, readAddr, readOptions, burstSize, readDataChan) readOk = readOk && thisReadOk readAddr += uintptr(burstSize) readLength -= uint32(burstSize) burstSize = uint16(SmiMemBurstSize) <-fwdDoneChan } fwdReqChan <- false return readOk }
go
func ReadBurstUInt16( smiRequest chan<- Flit64, smiResponse <-chan Flit64, readAddrIn uintptr, readOptions uint8, readLengthIn uint32, readDataChan chan<- uint16) bool { readOk := true readAddr := readAddrIn & 0xFFFFFFFFFFFFFFFE readLength := readLengthIn << 1 burstOffset := uint16(readAddr) & uint16(SmiMemBurstSize-1) burstSize := uint16(SmiMemBurstSize) - burstOffset smiReadChan := make(chan Flit64, 1) fwdReqChan := make(chan bool, 1) fwdDoneChan := make(chan bool, 1) go ForwardFrame64(fwdReqChan, smiResponse, smiReadChan, fwdDoneChan) for readLength != 0 { fwdReqChan <- true if readLength < uint32(burstSize) { burstSize = uint16(readLength) } thisReadOk := readSingleBurstUInt16( smiRequest, smiReadChan, readAddr, readOptions, burstSize, readDataChan) readOk = readOk && thisReadOk readAddr += uintptr(burstSize) readLength -= uint32(burstSize) burstSize = uint16(SmiMemBurstSize) <-fwdDoneChan } fwdReqChan <- false return readOk }
[ "func", "ReadBurstUInt16", "(", "smiRequest", "chan", "<-", "Flit64", ",", "smiResponse", "<-", "chan", "Flit64", ",", "readAddrIn", "uintptr", ",", "readOptions", "uint8", ",", "readLengthIn", "uint32", ",", "readDataChan", "chan", "<-", "uint16", ")", "bool", ...
// // ReadBurstUInt16 reads an incrementing burst of 16-bit unsigned data // values from a word aligned address on the specified SMI memory endpoint, // with the bottom address bit being ignored. The supplied burst length // specifies the number of 16-bit values to be transferred, up to a maximum of // 2^31-1. The burst is automatically segmented to respect page boundaries and // avoid blocking other transactions. In order to ensure optimum performance, // the read data channel should be a buffered channel that has sufficient free // space to hold all the data to be transferred. The status of the read // transaction is returned as the boolean 'readOk' flag. //
[ "ReadBurstUInt16", "reads", "an", "incrementing", "burst", "of", "16", "-", "bit", "unsigned", "data", "values", "from", "a", "word", "aligned", "address", "on", "the", "specified", "SMI", "memory", "endpoint", "with", "the", "bottom", "address", "bit", "being...
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/smi/protocol.go#L2145-L2178
153,194
mwitkow/go-etcd-harness
harness.go
New
func New(etcdErrWriter io.Writer) (*Harness, error) { s := &Harness{errWriter: etcdErrWriter} endpointAddress, err := allocateLocalAddress() if err != nil { return nil, fmt.Errorf("failed allocating endpoint addr: %v", err) } peerAddress, err := allocateLocalAddress() if err != nil { return nil, fmt.Errorf("failed allocating peer addr: %v", err) } etcdBinary, err := exec.LookPath("etcd") if err != nil { return nil, err } s.etcdDir, err = ioutil.TempDir("/tmp", "etcd_testserver") if err != nil { return nil, fmt.Errorf("failed allocating new dir: %v", err) } endpoint := "http://" + endpointAddress peer := "http://" + peerAddress s.etcdServer = exec.Command( etcdBinary, "--log-package-levels=etcdmain=WARNING,etcdserver=WARNING,raft=WARNING", "--force-new-cluster="+"true", "--data-dir="+s.etcdDir, "--listen-peer-urls="+peer, "--initial-cluster="+"default="+peer+"", "--initial-advertise-peer-urls="+peer, "--advertise-client-urls="+endpoint, "--listen-client-urls="+endpoint) s.etcdServer.Stderr = s.errWriter s.etcdServer.Stdout = ioutil.Discard s.Endpoint = endpoint if err := s.etcdServer.Start(); err != nil { s.Stop() return nil, fmt.Errorf("cannot start etcd: %v, will clean up", err) } s.Client, err = etcd.New(etcd.Config{Endpoints: []string{endpoint}}) if err != nil { s.Stop() return s, fmt.Errorf("failed allocating client: %v, will clean up", err) } if err := s.pollEtcdForReadiness(); err != nil { s.Stop() return nil, fmt.Errorf("%v, will clean up", err) } return s, nil }
go
func New(etcdErrWriter io.Writer) (*Harness, error) { s := &Harness{errWriter: etcdErrWriter} endpointAddress, err := allocateLocalAddress() if err != nil { return nil, fmt.Errorf("failed allocating endpoint addr: %v", err) } peerAddress, err := allocateLocalAddress() if err != nil { return nil, fmt.Errorf("failed allocating peer addr: %v", err) } etcdBinary, err := exec.LookPath("etcd") if err != nil { return nil, err } s.etcdDir, err = ioutil.TempDir("/tmp", "etcd_testserver") if err != nil { return nil, fmt.Errorf("failed allocating new dir: %v", err) } endpoint := "http://" + endpointAddress peer := "http://" + peerAddress s.etcdServer = exec.Command( etcdBinary, "--log-package-levels=etcdmain=WARNING,etcdserver=WARNING,raft=WARNING", "--force-new-cluster="+"true", "--data-dir="+s.etcdDir, "--listen-peer-urls="+peer, "--initial-cluster="+"default="+peer+"", "--initial-advertise-peer-urls="+peer, "--advertise-client-urls="+endpoint, "--listen-client-urls="+endpoint) s.etcdServer.Stderr = s.errWriter s.etcdServer.Stdout = ioutil.Discard s.Endpoint = endpoint if err := s.etcdServer.Start(); err != nil { s.Stop() return nil, fmt.Errorf("cannot start etcd: %v, will clean up", err) } s.Client, err = etcd.New(etcd.Config{Endpoints: []string{endpoint}}) if err != nil { s.Stop() return s, fmt.Errorf("failed allocating client: %v, will clean up", err) } if err := s.pollEtcdForReadiness(); err != nil { s.Stop() return nil, fmt.Errorf("%v, will clean up", err) } return s, nil }
[ "func", "New", "(", "etcdErrWriter", "io", ".", "Writer", ")", "(", "*", "Harness", ",", "error", ")", "{", "s", ":=", "&", "Harness", "{", "errWriter", ":", "etcdErrWriter", "}", "\n", "endpointAddress", ",", "err", ":=", "allocateLocalAddress", "(", ")...
// New initializes and returns a new Harness. // Failures here will be indicated as errors.
[ "New", "initializes", "and", "returns", "a", "new", "Harness", ".", "Failures", "here", "will", "be", "indicated", "as", "errors", "." ]
4dc1cb3e1ff9e2edb0241bb0a7e78aa63db35a07
https://github.com/mwitkow/go-etcd-harness/blob/4dc1cb3e1ff9e2edb0241bb0a7e78aa63db35a07/harness.go#L37-L84
153,195
mwitkow/go-etcd-harness
harness.go
Stop
func (s *Harness) Stop() { var err error if s.etcdServer != nil { if err := s.etcdServer.Process.Kill(); err != nil { fmt.Printf("failed killing etcd process: %v", err) } // Just to make sure we actually finish it before continuing. s.etcdServer.Wait() } if s.etcdDir != "" { if err = os.RemoveAll(s.etcdDir); err != nil { fmt.Printf("failed clearing temporary dir: %v", err) } } }
go
func (s *Harness) Stop() { var err error if s.etcdServer != nil { if err := s.etcdServer.Process.Kill(); err != nil { fmt.Printf("failed killing etcd process: %v", err) } // Just to make sure we actually finish it before continuing. s.etcdServer.Wait() } if s.etcdDir != "" { if err = os.RemoveAll(s.etcdDir); err != nil { fmt.Printf("failed clearing temporary dir: %v", err) } } }
[ "func", "(", "s", "*", "Harness", ")", "Stop", "(", ")", "{", "var", "err", "error", "\n", "if", "s", ".", "etcdServer", "!=", "nil", "{", "if", "err", ":=", "s", ".", "etcdServer", ".", "Process", ".", "Kill", "(", ")", ";", "err", "!=", "nil"...
// Stop kills the harnessed etcd server and cleans up the data directory.
[ "Stop", "kills", "the", "harnessed", "etcd", "server", "and", "cleans", "up", "the", "data", "directory", "." ]
4dc1cb3e1ff9e2edb0241bb0a7e78aa63db35a07
https://github.com/mwitkow/go-etcd-harness/blob/4dc1cb3e1ff9e2edb0241bb0a7e78aa63db35a07/harness.go#L105-L119
153,196
kyokomi/slackbot
plugins/cron/v2/repository_redis.go
NewRedisRepository
func NewRedisRepository(addr, password string, db int64, redisKeyFmt string) Repository { if redisKeyFmt == "" { redisKeyFmt = defaultRedisCronTaskKey } return &redisRepository{ redisKeyFmt: redisKeyFmt, redisDB: redis.NewClient(&redis.Options{ Addr: addr, Password: password, DB: db, }), } }
go
func NewRedisRepository(addr, password string, db int64, redisKeyFmt string) Repository { if redisKeyFmt == "" { redisKeyFmt = defaultRedisCronTaskKey } return &redisRepository{ redisKeyFmt: redisKeyFmt, redisDB: redis.NewClient(&redis.Options{ Addr: addr, Password: password, DB: db, }), } }
[ "func", "NewRedisRepository", "(", "addr", ",", "password", "string", ",", "db", "int64", ",", "redisKeyFmt", "string", ")", "Repository", "{", "if", "redisKeyFmt", "==", "\"", "\"", "{", "redisKeyFmt", "=", "defaultRedisCronTaskKey", "\n", "}", "\n", "return"...
// NewRedisRepository create redis repository
[ "NewRedisRepository", "create", "redis", "repository" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/cron/v2/repository_redis.go#L30-L42
153,197
cloudfoundry-community/gogobosh
deployment.go
HasRelease
func (d *Deployment) HasRelease(name string) bool { for _, release := range d.Releases { if release.Name == name { return true } } return false }
go
func (d *Deployment) HasRelease(name string) bool { for _, release := range d.Releases { if release.Name == name { return true } } return false }
[ "func", "(", "d", "*", "Deployment", ")", "HasRelease", "(", "name", "string", ")", "bool", "{", "for", "_", ",", "release", ":=", "range", "d", ".", "Releases", "{", "if", "release", ".", "Name", "==", "name", "{", "return", "true", "\n", "}", "\n...
// HasRelease if deployment has release
[ "HasRelease", "if", "deployment", "has", "release" ]
8c9e0d747e480a6373564c51f14d62252c0ef4e5
https://github.com/cloudfoundry-community/gogobosh/blob/8c9e0d747e480a6373564c51f14d62252c0ef4e5/deployment.go#L4-L11
153,198
kyokomi/slackbot
plugins/router/command.go
Message
func (c Command) Message() string { return fmt.Sprintf("FilterArgs = [%s] ID = [%s]", c.FilterArgs, c.RouterID) }
go
func (c Command) Message() string { return fmt.Sprintf("FilterArgs = [%s] ID = [%s]", c.FilterArgs, c.RouterID) }
[ "func", "(", "c", "Command", ")", "Message", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "FilterArgs", ",", "c", ".", "RouterID", ")", "\n", "}" ]
// Message return a reply message
[ "Message", "return", "a", "reply", "message" ]
892540d8979144609b1c749693086bc781c78d43
https://github.com/kyokomi/slackbot/blob/892540d8979144609b1c749693086bc781c78d43/plugins/router/command.go#L69-L71
153,199
ReconfigureIO/sdaccel
axi/arbitrate/axiarbitrate.go
WriteArbitrateX3
func WriteArbitrateX3( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, serverAddr0 <-chan protocol.Addr, serverData0 <-chan protocol.WriteData, serverResp0 chan<- protocol.WriteResp, serverAddr1 <-chan protocol.Addr, serverData1 <-chan protocol.WriteData, serverResp1 chan<- protocol.WriteResp, serverAddr2 <-chan protocol.Addr, serverData2 <-chan protocol.WriteData, serverResp2 chan<- protocol.WriteResp) { // Specify the input selection channels. dataChanSelect := make(chan byte) respChanSelect := make(chan byte) // Run write data channel handler. go func() { for { var writeData protocol.WriteData chanSelect := <-dataChanSelect // Terminate transfers on write data channel 'last' flag. isLast := false for !isLast { switch chanSelect { case 0: writeData = <-serverData0 case 1: writeData = <-serverData1 default: writeData = <-serverData2 } clientData <- writeData isLast = writeData.Last } } }() // Run response channel handler. go func() { for { chanSelect := <-respChanSelect writeResp := <-clientResp switch chanSelect { case 0: serverResp0 <- writeResp case 1: serverResp1 <- writeResp default: serverResp2 <- writeResp } } }() // Use intermediate variables for efficient implementation. var writeAddr protocol.Addr var dataChanId byte for { select { case writeAddr = <-serverAddr0: dataChanId = 0 case writeAddr = <-serverAddr1: dataChanId = 1 case writeAddr = <-serverAddr2: dataChanId = 2 } clientAddr <- writeAddr dataChanSelect <- dataChanId respChanSelect <- dataChanId } }
go
func WriteArbitrateX3( clientAddr chan<- protocol.Addr, clientData chan<- protocol.WriteData, clientResp <-chan protocol.WriteResp, serverAddr0 <-chan protocol.Addr, serverData0 <-chan protocol.WriteData, serverResp0 chan<- protocol.WriteResp, serverAddr1 <-chan protocol.Addr, serverData1 <-chan protocol.WriteData, serverResp1 chan<- protocol.WriteResp, serverAddr2 <-chan protocol.Addr, serverData2 <-chan protocol.WriteData, serverResp2 chan<- protocol.WriteResp) { // Specify the input selection channels. dataChanSelect := make(chan byte) respChanSelect := make(chan byte) // Run write data channel handler. go func() { for { var writeData protocol.WriteData chanSelect := <-dataChanSelect // Terminate transfers on write data channel 'last' flag. isLast := false for !isLast { switch chanSelect { case 0: writeData = <-serverData0 case 1: writeData = <-serverData1 default: writeData = <-serverData2 } clientData <- writeData isLast = writeData.Last } } }() // Run response channel handler. go func() { for { chanSelect := <-respChanSelect writeResp := <-clientResp switch chanSelect { case 0: serverResp0 <- writeResp case 1: serverResp1 <- writeResp default: serverResp2 <- writeResp } } }() // Use intermediate variables for efficient implementation. var writeAddr protocol.Addr var dataChanId byte for { select { case writeAddr = <-serverAddr0: dataChanId = 0 case writeAddr = <-serverAddr1: dataChanId = 1 case writeAddr = <-serverAddr2: dataChanId = 2 } clientAddr <- writeAddr dataChanSelect <- dataChanId respChanSelect <- dataChanId } }
[ "func", "WriteArbitrateX3", "(", "clientAddr", "chan", "<-", "protocol", ".", "Addr", ",", "clientData", "chan", "<-", "protocol", ".", "WriteData", ",", "clientResp", "<-", "chan", "protocol", ".", "WriteResp", ",", "serverAddr0", "<-", "chan", "protocol", "....
// // Goroutine which implements AXI arbitration between three AXI write interfaces. //
[ "Goroutine", "which", "implements", "AXI", "arbitration", "between", "three", "AXI", "write", "interfaces", "." ]
26602ba933e27e55e04d18f65b3bb16a12950350
https://github.com/ReconfigureIO/sdaccel/blob/26602ba933e27e55e04d18f65b3bb16a12950350/axi/arbitrate/axiarbitrate.go#L97-L170