query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
/ PlaceholdersApiServiceTests Read slide placeholder info. Test for PlaceholdersApi.GetSlidesPlaceholder method with invalid password
func TestGetSlidesPlaceholderInvalidpassword(t *testing.T) { request := createGetSlidesPlaceholderRequest() request.password = invalidizeTestParamValue(request.password, "password", "string").(string) e := initializeTest("GetSlidesPlaceholder", "password", request.password) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholder(request) assertError(t, "GetSlidesPlaceholder", "password", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.7652924", "0.7421789", "0.7289619", "0.68647504", "0.6750458", "0.6741826", "0.66836923", "0.66452175", "0.6531085", "0.6525193", "0.6021881", "0.58610797", "0.5860749", "0.5745081", "0.5602761", "0.54451406", "0.5432458", "0.5377808", "0.53628707", "0.5281325", "0.5242934...
0.7558047
1
/ PlaceholdersApiServiceTests Read slide placeholder info. Test for PlaceholdersApi.GetSlidesPlaceholder method with invalid folder
func TestGetSlidesPlaceholderInvalidfolder(t *testing.T) { request := createGetSlidesPlaceholderRequest() request.folder = invalidizeTestParamValue(request.folder, "folder", "string").(string) e := initializeTest("GetSlidesPlaceholder", "folder", request.folder) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholder(request) assertError(t, "GetSlidesPlaceholder", "folder", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.76464593", "0.72734094", "0.7080963", "0.6891407", "0.6787595", "0.6741639", "0.66689736", "0.6606851", "0.6552247", "0.6500187", "0.5653815", "0.5614688", "0.56072116", "0.55183643", "0.55057096", "0.5492853", "0.5474268", "0.53080195", "0.5119933", "0.5092713", "0.505522...
0.72583574
2
/ PlaceholdersApiServiceTests Read slide placeholder info. Test for PlaceholdersApi.GetSlidesPlaceholder method with invalid storage
func TestGetSlidesPlaceholderInvalidstorage(t *testing.T) { request := createGetSlidesPlaceholderRequest() request.storage = invalidizeTestParamValue(request.storage, "storage", "string").(string) e := initializeTest("GetSlidesPlaceholder", "storage", request.storage) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholder(request) assertError(t, "GetSlidesPlaceholder", "storage", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.74726236", "0.7126834", "0.70229375", "0.68586266", "0.6796716", "0.6593342", "0.6591677", "0.63682663", "0.5907808", "0.57252765", "0.5694311", "0.5644454", "0.5521583", "0.5447631", "0.5353179", "0.53521675", "0.5343926", "0.5180545", "0.50608325", "0.4972183", "0.495961...
0.7261586
1
/ PlaceholdersApiServiceTests Read slide placeholders info. Test for PlaceholdersApi.GetSlidesPlaceholders method
func TestGetSlidesPlaceholders(t *testing.T) { request := createGetSlidesPlaceholdersRequest() e := initializeTest("GetSlidesPlaceholders", "", "") if e != nil { t.Errorf("Error: %v.", e) return } c := getTestApiClient() r, _, e := c.PlaceholdersApi.GetSlidesPlaceholders(request) if e != nil { t.Errorf("Error: %v.", e) return } if r.Code != 200 && r.Code != 201 { t.Errorf("Wrong response code: %d.", r.Code) return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.7704114", "0.6871591", "0.6780877", "0.671483", "0.652047", "0.6493789", "0.6349376", "0.61045045", "0.60587233", "0.545175", "0.54515827", "0.54466987", "0.53990364", "0.5260586", "0.518971", "0.50221723", "0.49513692", "0.4901056", "0.48680988", "0.48502937", "0.4768092"...
0.7565972
1
/ PlaceholdersApiServiceTests Read slide placeholders info. Test for PlaceholdersApi.GetSlidesPlaceholders method with invalid name
func TestGetSlidesPlaceholdersInvalidname(t *testing.T) { request := createGetSlidesPlaceholdersRequest() request.name = invalidizeTestParamValue(request.name, "name", "string").(string) e := initializeTest("GetSlidesPlaceholders", "name", request.name) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholders(request) assertError(t, "GetSlidesPlaceholders", "name", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.78701633", "0.77192426", "0.7473006", "0.7237844", "0.719496", "0.714362", "0.65373975", "0.6516911", "0.60483634", "0.59266204", "0.5902661", "0.5873059", "0.58692646", "0.54373795", "0.5361756", "0.5286803", "0.5104948", "0.5078878", "0.49831194", "0.49682426", "0.494138...
0.7449051
3
/ PlaceholdersApiServiceTests Read slide placeholders info. Test for PlaceholdersApi.GetSlidesPlaceholders method with invalid slideIndex
func TestGetSlidesPlaceholdersInvalidslideIndex(t *testing.T) { request := createGetSlidesPlaceholdersRequest() request.slideIndex = invalidizeTestParamValue(request.slideIndex, "slideIndex", "int32").(int32) e := initializeTest("GetSlidesPlaceholders", "slideIndex", request.slideIndex) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholders(request) assertError(t, "GetSlidesPlaceholders", "slideIndex", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholderInvalidslideIndex(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"GetSlidesPlaceholder\", \"slideIndex\", request.slideIndex)\n if...
[ "0.789043", "0.768191", "0.73846763", "0.7246314", "0.6686254", "0.6661206", "0.6190447", "0.6152584", "0.5833082", "0.55808973", "0.5539054", "0.55371183", "0.5535584", "0.5124074", "0.505782", "0.49641368", "0.49254712", "0.4887113", "0.4809203", "0.48038286", "0.47290307",...
0.78194296
1
/ PlaceholdersApiServiceTests Read slide placeholders info. Test for PlaceholdersApi.GetSlidesPlaceholders method with invalid password
func TestGetSlidesPlaceholdersInvalidpassword(t *testing.T) { request := createGetSlidesPlaceholdersRequest() request.password = invalidizeTestParamValue(request.password, "password", "string").(string) e := initializeTest("GetSlidesPlaceholders", "password", request.password) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholders(request) assertError(t, "GetSlidesPlaceholders", "password", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.7568427", "0.75655067", "0.7456097", "0.68667454", "0.6854863", "0.6844978", "0.6800352", "0.67774934", "0.65686285", "0.65163094", "0.59247226", "0.5911065", "0.58952093", "0.58202726", "0.58169687", "0.5706522", "0.5582681", "0.5534366", "0.5391632", "0.5373874", "0.5353...
0.7578236
0
/ PlaceholdersApiServiceTests Read slide placeholders info. Test for PlaceholdersApi.GetSlidesPlaceholders method with invalid folder
func TestGetSlidesPlaceholdersInvalidfolder(t *testing.T) { request := createGetSlidesPlaceholdersRequest() request.folder = invalidizeTestParamValue(request.folder, "folder", "string").(string) e := initializeTest("GetSlidesPlaceholders", "folder", request.folder) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholders(request) assertError(t, "GetSlidesPlaceholders", "folder", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.7604284", "0.74669325", "0.7198721", "0.7010964", "0.6935921", "0.6886619", "0.6829144", "0.67974365", "0.6581863", "0.65339565", "0.57475835", "0.5734493", "0.5731555", "0.5625898", "0.55383325", "0.5520894", "0.5437583", "0.5401256", "0.50881577", "0.50740385", "0.504635...
0.71627915
3
/ PlaceholdersApiServiceTests Read slide placeholders info. Test for PlaceholdersApi.GetSlidesPlaceholders method with invalid storage
func TestGetSlidesPlaceholdersInvalidstorage(t *testing.T) { request := createGetSlidesPlaceholdersRequest() request.storage = invalidizeTestParamValue(request.storage, "storage", "string").(string) e := initializeTest("GetSlidesPlaceholders", "storage", request.storage) if e != nil { t.Errorf("Error: %v.", e) return } r, _, e := getTestApiClient().PlaceholdersApi.GetSlidesPlaceholders(request) assertError(t, "GetSlidesPlaceholders", "storage", r.Code, e) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetSlidesPlaceholder(t *testing.T) {\n request := createGetSlidesPlaceholderRequest()\n e := initializeTest(\"GetSlidesPlaceholder\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.PlaceholdersApi.GetSlidesPlace...
[ "0.7387686", "0.7229926", "0.7180191", "0.6929156", "0.684331", "0.6842511", "0.6622056", "0.6592053", "0.6116676", "0.58174914", "0.5777632", "0.5731948", "0.5561834", "0.555739", "0.5531502", "0.5316684", "0.5177551", "0.51758355", "0.49506363", "0.49411616", "0.49282283", ...
0.72392267
1
LoadHTTPS returns the HTTP routes and middleware
func LoadHTTPS() http.Handler { return middleware(routes()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func LoadHTTP() http.Handler {\r\n\treturn middleware(routes())\r\n\r\n\t// Uncomment this and comment out the line above to always redirect to HTTPS\r\n\t//return http.HandlerFunc(redirectToHTTPS)\r\n}", "func (r *Router) HTTPS() *Router {\n\tif r.root != nil {\n\t\treturn r.root.HTTPS()\n\t}\n\tr.mu.Lock()\n\t...
[ "0.7620313", "0.6640508", "0.5939723", "0.58823115", "0.5862642", "0.58205837", "0.5755872", "0.57449174", "0.563193", "0.5490669", "0.5442681", "0.53498137", "0.53085417", "0.52618444", "0.5251495", "0.5232304", "0.51856405", "0.5175074", "0.5157146", "0.5120161", "0.5120161...
0.8867957
0
LoadHTTP returns the HTTPS routes and middleware
func LoadHTTP() http.Handler { return middleware(routes()) // Uncomment this and comment out the line above to always redirect to HTTPS //return http.HandlerFunc(redirectToHTTPS) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func LoadHTTPS() http.Handler {\r\n\treturn middleware(routes())\r\n}", "func (serv *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {\n host := strings.Split(req.Host, \":\")[0]\n port := strings.Split(serv.config.HttpsAddr, \":\")[1]\n path := req.URL.Path\n\n // Redirect Non-HTTPS re...
[ "0.8452031", "0.623786", "0.6061106", "0.59489584", "0.56998134", "0.5677931", "0.56284374", "0.5602687", "0.5563809", "0.5530905", "0.5520147", "0.5491471", "0.548736", "0.54592586", "0.545489", "0.5441791", "0.54187936", "0.54186827", "0.54052526", "0.5372337", "0.5362694",...
0.81919795
1
Less returns true if o < oo; Lender < Owner
func (o OwnershipLevel) Less(oo OwnershipLevel) bool { if o == OwnershipLevels.Lender && oo == OwnershipLevels.Owner { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p User) Less(e goset.Element) bool {\n\tv := e.(User)\n\tif p.Age == v.Age {\n\t\treturn p.Name < v.Name\n\t}\n\treturn p.Age < v.Age\n}", "func (t ByAnnualizedLossExpectancy) Less(i, j int) bool {\n\treturn t.Threats[i].AnnualizedLossExpectancy() > t.Threats[j].AnnualizedLossExpectancy()\n}", "func (o o...
[ "0.6683345", "0.65017235", "0.64846736", "0.6377962", "0.62778103", "0.61876047", "0.6102869", "0.6074075", "0.60731626", "0.60593045", "0.6011533", "0.6002058", "0.5997032", "0.5971584", "0.5964099", "0.59586275", "0.59539175", "0.59464127", "0.59429693", "0.5921777", "0.588...
0.7938558
0
String returns string fmt
func (o OwnershipLevel) String() string { return string(o) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s PathFormat) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v *View) FormatString(f format.Formatter) string {\n\tv.Format(f)\n\treturn f.Output()\n}", "func (t DataFormat) String() string {\n\treturn dataFormatToString[t]\n}", "func FormatString(format string, v ...any) string {\n\tretur...
[ "0.68352205", "0.67740613", "0.67567044", "0.6749148", "0.6620536", "0.6601565", "0.65879726", "0.6543854", "0.6530955", "0.64874923", "0.64732456", "0.6437474", "0.6430952", "0.63896984", "0.63797545", "0.6355425", "0.63504195", "0.6343408", "0.63346064", "0.6311207", "0.630...
0.0
-1
All checks if action matches any
func (a Action) All() bool { return a.String() == "*" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (actionSet ActionSet) Match(action authorizer.Action) bool {\n\tfor r := range actionSet {\n\t\tif wildcard.Match(string(r), string(action)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func allowed(actions []game.Action, action game.Action) bool {\n\tfor _, v := range actions {\n\t\tif v == act...
[ "0.7208854", "0.6927319", "0.6485091", "0.6412657", "0.6296537", "0.6039117", "0.60081935", "0.5978657", "0.5819046", "0.5730246", "0.5680649", "0.565837", "0.5655692", "0.5653189", "0.56326115", "0.56240875", "0.5583718", "0.5560375", "0.554394", "0.5502022", "0.5498448", ...
0.68802994
2
String returns string representation
func (a Action) String() string { return string(a) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Library) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ID: \" + reform.Inspect(s.ID, true)\n\tres[1] = \"UserID: \" + reform.Inspect(s.UserID, true)\n\tres[2] = \"VolumeID: \" + reform.Inspect(s.VolumeID, true)\n\tres[3] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[4] = \"Upda...
[ "0.7153938", "0.7055958", "0.7038721", "0.70264554", "0.70264554", "0.70228845", "0.6990835", "0.6985673", "0.697657", "0.6932796", "0.69297034", "0.69205225", "0.69179523", "0.6897726", "0.6892526", "0.6892423", "0.6886584", "0.6871274", "0.6870672", "0.6862762", "0.6852569"...
0.0
-1
BuildResourceHierarchy returns an instance of ResourceHierarchy from a string
func BuildResourceHierarchy(rh string) ResourceHierarchy { return ResourceHierarchy(rh) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func createCRDObject(s string) (*extensionsobj.CustomResourceDefinition, error) {\n\tsr := strings.NewReader(s)\n\td := yaml.NewYAMLOrJSONDecoder(sr, len(s))\n\tcrdVar := &extensionsobj.CustomResourceDefinition{}\n\tif err := d.Decode(crdVar); err != nil {\n\t\treturn nil, err\n\t}\n\treturn crdVar, nil\n\n}", "...
[ "0.507879", "0.5039281", "0.50200814", "0.49269527", "0.4922568", "0.4892943", "0.47613272", "0.47513244", "0.47110483", "0.46693277", "0.45954028", "0.45792127", "0.45540985", "0.448423", "0.44429144", "0.441587", "0.43907326", "0.43813485", "0.4369978", "0.43691695", "0.435...
0.6775448
0
All checks if rh matches any
func (rh ResourceHierarchy) All() bool { return string(rh) == "*" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func matchColloquy(co *Colloquy, fs []Filter) bool {\n\tfor _, f := range fs {\n\t\tif f.TagRegex() != nil {\n\t\t\tif ok := matchTag(co.Tags, f.TagRegex(), f.TagNegate()); !ok {\n\t\t\t\tklog.V(4).Infof(\"#%d did not pass matchTag: %s vs %s %s\", co.ID, co.Tags, f.TagRegex, f.TagNegate)\n\t\t\t\treturn false\n\t\...
[ "0.5643037", "0.54212755", "0.54111886", "0.53816277", "0.5353122", "0.53459245", "0.53430265", "0.53348094", "0.5305223", "0.52373517", "0.5167246", "0.515484", "0.5134236", "0.5077138", "0.50459546", "0.5011737", "0.5011177", "0.5003973", "0.49994996", "0.4992482", "0.49867...
0.5070216
14
PermissionMatches returns a slice of all possible ways to check if a service account has any level of permission over this ResourceHierarchy Example: rh = "x::y::z".PermissionMatches() = ["", "x::", "x::y::", "x::y::z"]
func (rh ResourceHierarchy) PermissionMatches() []string { whole := string(rh) if whole == "*" { return []string{whole} } parts := strings.Split(whole, "::") ret := []string{"*"} for i := 1; i < len(parts); i++ { if parts[i] == "*" { break } match := strings.Join(parts[:i], "::") ret = append(ret, match+"::*") } return append(ret, whole) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o LookupPermissionsResultOutput) Permissions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupPermissionsResult) []string { return v.Permissions }).(pulumi.StringArrayOutput)\n}", "func (*Privilege) Match(toks sayori.Toks) (string, bool) {\n\talias, ok := toks.Get(0)\n\tif !ok {\n\t\treturn \"\...
[ "0.51741725", "0.5107898", "0.5098851", "0.49879822", "0.49865288", "0.49036857", "0.48702577", "0.48579472", "0.48500648", "0.48429", "0.48233873", "0.48210967", "0.48192152", "0.481192", "0.48104265", "0.48098037", "0.48078558", "0.4795026", "0.4789801", "0.47863105", "0.47...
0.84667057
0
Contains checks whether rh.Hierarchy contains orh.Hierarchy
func (rh ResourceHierarchy) Contains(orh ResourceHierarchy) bool { rhh := buildResourceHierarchy(rh) orhh := buildResourceHierarchy(orh) if rhh.size > orhh.size { return false } for i := range orhh.hierarchy { if i >= len(rhh.hierarchy) { return false } if rhh.hierarchy[i] == "*" { return true } if orhh.hierarchy[i] != rhh.hierarchy[i] { return false } } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Contains(ancestor, descendant Reader) bool {\n\tcurrent := descendant.Parent()\n\tfor current != nil {\n\t\tif current == ancestor {\n\t\t\treturn true\n\t\t}\n\t\tcurrent = current.Parent()\n\t}\n\n\treturn false\n}", "func (s *baseNode) Contains(node Node) bool {\n\tfor _, p := range node.Parents() {\n\t\...
[ "0.58287984", "0.57673496", "0.5746496", "0.5666999", "0.5619743", "0.56080854", "0.5541025", "0.55393964", "0.5500818", "0.5498922", "0.5489444", "0.54562813", "0.5421652", "0.5415308", "0.5391012", "0.53899676", "0.5372071", "0.5365434", "0.53255564", "0.5322515", "0.531257...
0.76979774
0
String returns string representation
func (rh ResourceHierarchy) String() string { return string(rh) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Library) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ID: \" + reform.Inspect(s.ID, true)\n\tres[1] = \"UserID: \" + reform.Inspect(s.UserID, true)\n\tres[2] = \"VolumeID: \" + reform.Inspect(s.VolumeID, true)\n\tres[3] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[4] = \"Upda...
[ "0.7153938", "0.7055958", "0.7038721", "0.70264554", "0.70264554", "0.70228845", "0.6990835", "0.6985673", "0.697657", "0.6932796", "0.69297034", "0.69205225", "0.69179523", "0.6897726", "0.6892526", "0.6892423", "0.6886584", "0.6871274", "0.6870672", "0.6862762", "0.6852569"...
0.0
-1
ValidatePermission validates a permission in string format
func ValidatePermission(str string) (bool, error) { // Format: OwnershipLevel::Action::Service::{ResourceHierarchy} parts := strings.Split(str, "::") if len(parts) < 4 { return false, fmt.Errorf( "Incomplete permission. Expected format: " + "Service::OwnershipLevel::Action::{ResourceHierarchy}", ) } ol := OwnershipLevel(parts[1]) if ol != OwnershipLevels.Owner && ol != OwnershipLevels.Lender { return false, fmt.Errorf("OwnershipLevel needs to be RO or RL") } for _, part := range parts { if part == "" { return false, fmt.Errorf("No parts can be empty") } } return true, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *DomainPermission) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeVa...
[ "0.6404555", "0.60949326", "0.6047413", "0.5835476", "0.58148205", "0.5664851", "0.56536216", "0.5593093", "0.5573626", "0.5363021", "0.53566784", "0.53501135", "0.53122586", "0.52669644", "0.52610296", "0.5231673", "0.51672333", "0.5162554", "0.5130689", "0.51153505", "0.509...
0.7913592
0
BuildPermission transforms a string into struct
func BuildPermission(str string) (Permission, error) { if valid, err := ValidatePermission(str); !valid { return Permission{}, err } parts := strings.Split(str, "::") service := parts[0] ol := OwnershipLevel(parts[1]) action := BuildAction(parts[2]) rh := ResourceHierarchy(strings.Join(parts[3:], "::")) return Permission{ Service: service, OwnershipLevel: ol, Action: action, ResourceHierarchy: rh, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func stringToAccessPerm(perm string) accessPerms {\n\tvar policy accessPerms\n\tswitch perm {\n\tcase \"none\":\n\t\tpolicy = accessNone\n\tcase \"readonly\":\n\t\tpolicy = accessDownload\n\tcase \"writeonly\":\n\t\tpolicy = accessUpload\n\tcase \"readwrite\":\n\t\tpolicy = accessPublic\n\tcase \"custom\":\n\t\tpo...
[ "0.5839843", "0.5700419", "0.5461124", "0.5454174", "0.5453382", "0.544734", "0.5423187", "0.5319005", "0.5234207", "0.5212339", "0.52105266", "0.5135809", "0.49947426", "0.4993767", "0.4993717", "0.49889344", "0.48975605", "0.486518", "0.48615107", "0.48504975", "0.48403347"...
0.7998979
0
BuildPermissions calls BuildPermission for all strings
func BuildPermissions(ps []string) ([]Permission, error) { pSl := make([]Permission, len(ps)) var err error for i := range ps { pSl[i], err = BuildPermission(ps[i]) if err != nil { return nil, err } } return pSl, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func BuildPermission(str string) (Permission, error) {\n\tif valid, err := ValidatePermission(str); !valid {\n\t\treturn Permission{}, err\n\t}\n\tparts := strings.Split(str, \"::\")\n\tservice := parts[0]\n\tol := OwnershipLevel(parts[1])\n\taction := BuildAction(parts[2])\n\trh := ResourceHierarchy(strings.Join(...
[ "0.61422247", "0.58243364", "0.57130516", "0.5584584", "0.55698204", "0.55643183", "0.5468975", "0.54473794", "0.5446696", "0.53778183", "0.53583544", "0.534465", "0.5277537", "0.5268672", "0.52311164", "0.52256125", "0.5176818", "0.5174343", "0.51502186", "0.5128421", "0.511...
0.6409221
0
IsPresent checks if a permission is satisfied in a slice
func (p Permission) IsPresent(permissions []Permission) bool { for _, pp := range permissions { if (pp.Service != "*" && pp.Service != p.Service) || (pp.Action != "*" && pp.Action != p.Action) || pp.OwnershipLevel.Less(p.OwnershipLevel) { continue } if pp.ResourceHierarchy.Contains(p.ResourceHierarchy) { return true } } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Presence(slice interface{}, val interface{}, startoptional ...int) (bool, int, error) {\n\tvar (\n\t\tpresent bool\n\t\terrs error\n\t\tindex int\n\t)\n\tsv := reflect.ValueOf(slice)\n\tf := 0\n\tpresent = false\n\tindex = -1\n\tEnd := sv.Len()\n\tStart := 0\n\terrs = nil\n\tif len(startoptional) == 0 {\...
[ "0.64717233", "0.59599364", "0.58938664", "0.58781785", "0.57898533", "0.57694185", "0.5768751", "0.575387", "0.5686415", "0.562705", "0.5605818", "0.56009513", "0.55991375", "0.5584934", "0.5582092", "0.5565374", "0.55639386", "0.5557865", "0.5539009", "0.55292684", "0.54988...
0.69256485
0
String converts a permission to it's equivalent string format
func (p Permission) String() string { return fmt.Sprintf( "%s::%s::%s::%s", p.Service, p.OwnershipLevel, p.Action, string(p.ResourceHierarchy), ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Permission) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Permission) String() string {\n\treturn awsutil.Prettify(s)\n}", "func accessPermToString(perm accessPerms) string {\n\tpolicy := \"\"\n\tswitch perm {\n\tcase accessNone:\n\t\tpolicy = \"none\"\n\tcase accessDownload:\n\t\tpolic...
[ "0.75426996", "0.75426996", "0.75243884", "0.7431164", "0.72277147", "0.70106864", "0.6913734", "0.6840892", "0.6763522", "0.67401725", "0.6732706", "0.67065585", "0.6612664", "0.65239304", "0.64879215", "0.64764166", "0.645415", "0.6335772", "0.6335772", "0.6266849", "0.6247...
0.73073184
4
HasServiceFullAccess checks if permission allows it's role to execute any action over any resourch hierarchy under it's service
func (p Permission) HasServiceFullAccess() bool { if !p.Action.All() { return false } return p.ResourceHierarchy.All() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p Permission) HasServiceFullOwnership() bool {\n\treturn p.HasServiceFullAccess() && p.OwnershipLevel == OwnershipLevels.Owner\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) HasAccessRight(opts *bind.CallOpts, candidate common.Address, mgr bool) (bool, error) {\n\tvar out []interface{}\...
[ "0.72099286", "0.6301949", "0.6280848", "0.62513363", "0.62197244", "0.61665964", "0.61636025", "0.612532", "0.61158013", "0.6114883", "0.6099294", "0.60276836", "0.60020816", "0.5968976", "0.5878543", "0.5869554", "0.5858302", "0.5846315", "0.5843763", "0.583212", "0.5821522...
0.8546371
0
HasServiceFullOwnership checks if permission allows it's role to execute any action over any resourch hierarchy under it's service and it's RO
func (p Permission) HasServiceFullOwnership() bool { return p.HasServiceFullAccess() && p.OwnershipLevel == OwnershipLevels.Owner }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p Permission) HasServiceFullAccess() bool {\n\tif !p.Action.All() {\n\t\treturn false\n\t}\n\treturn p.ResourceHierarchy.All()\n}", "func (o *Object) CheckOwnership(creds *auth.Credentials) bool {\n\tif o.OwnerUID == creds.EffectiveKUID || o.CreatorUID == creds.EffectiveKUID {\n\t\treturn true\n\t}\n\n\t//...
[ "0.7686756", "0.6273822", "0.5878802", "0.58571726", "0.57293135", "0.5714139", "0.56667215", "0.5657168", "0.56242394", "0.5592213", "0.557942", "0.55735743", "0.554896", "0.5547838", "0.5539956", "0.5528922", "0.5505817", "0.55002993", "0.54608864", "0.5444543", "0.5428721"...
0.81397253
0
buildWillIAMPermission builds a permission in the format expected by WillIAM handlers
func buildWillIAMPermission(ro OwnershipLevel, action, rh string) string { return fmt.Sprintf( "%s::%s::%s::%s", constants.AppInfo.Name, string(ro), action, rh, ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func BuildWillIAMPermissionLender(action, rh string) string {\n\treturn buildWillIAMPermission(OwnershipLevels.Lender, action, rh)\n}", "func BuildPermission(str string) (Permission, error) {\n\tif valid, err := ValidatePermission(str); !valid {\n\t\treturn Permission{}, err\n\t}\n\tparts := strings.Split(str, \...
[ "0.61293143", "0.60217214", "0.55547345", "0.55313754", "0.54605144", "0.5390645", "0.5291528", "0.5145955", "0.5132717", "0.51083726", "0.50734323", "0.50478834", "0.50233483", "0.50014144", "0.49916154", "0.49643424", "0.49455625", "0.49168488", "0.49072856", "0.48820496", ...
0.73270255
0
BuildWillIAMPermissionLender builds a permission in the format expected by WillIAM handlers
func BuildWillIAMPermissionLender(action, rh string) string { return buildWillIAMPermission(OwnershipLevels.Lender, action, rh) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func buildWillIAMPermission(ro OwnershipLevel, action, rh string) string {\n\treturn fmt.Sprintf(\n\t\t\"%s::%s::%s::%s\", constants.AppInfo.Name, string(ro), action, rh,\n\t)\n}", "func BuildPermission(str string) (Permission, error) {\n\tif valid, err := ValidatePermission(str); !valid {\n\t\treturn Permission...
[ "0.686174", "0.5530684", "0.528286", "0.52364534", "0.5216645", "0.50240797", "0.49938017", "0.49281764", "0.49012905", "0.48950514", "0.48472267", "0.48319396", "0.48298955", "0.47690165", "0.47651926", "0.47402197", "0.46901163", "0.46634328", "0.46449637", "0.46423373", "0...
0.701724
0
BuildWillIAMPermissionOwner builds a permission in the format expected by WillIAM handlers
func BuildWillIAMPermissionOwner(action, rh string) string { return buildWillIAMPermission(OwnershipLevels.Owner, action, rh) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func buildWillIAMPermission(ro OwnershipLevel, action, rh string) string {\n\treturn fmt.Sprintf(\n\t\t\"%s::%s::%s::%s\", constants.AppInfo.Name, string(ro), action, rh,\n\t)\n}", "func BuildWillIAMPermissionLender(action, rh string) string {\n\treturn buildWillIAMPermission(OwnershipLevels.Lender, action, rh)\...
[ "0.71533847", "0.5904081", "0.5537427", "0.5298134", "0.526634", "0.5226084", "0.49826637", "0.49684238", "0.4791071", "0.478035", "0.4727254", "0.46865475", "0.46777892", "0.4661595", "0.46341136", "0.46195966", "0.46175325", "0.46106666", "0.46081975", "0.45975724", "0.4587...
0.7287224
0
BulkInsertTrades inserts a slice of trades in the database. Trades that are already in the database (i.e. horizon_id already exists) are ignored.
func (s *TickerSession) BulkInsertTrades(ctx context.Context, trades []Trade) (err error) { if len(trades) <= 50 { return performInsertTrades(ctx, s, trades) } chunks := chunkifyDBTrades(trades, 50) for _, chunk := range chunks { err = performInsertTrades(ctx, s, chunk) if err != nil { return } } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (database *Database) bulkInsert(tx *sql.Tx, unsavedRows []StatsEntry) error {\n\tvalueStrings := make([]string, 0, 1000)\n\tvalueArgs := make([]interface{}, 0, 12000)\n\ti := 0\n\tvar prep *sql.Stmt\n\tvar err error\n\tfor _, row := range unsavedRows {\n\t\tif prep == nil {\n\t\t\tvalueStrings = append(valueS...
[ "0.66325265", "0.6429947", "0.6108372", "0.60332817", "0.58947533", "0.587759", "0.56211597", "0.56208146", "0.56136876", "0.55765676", "0.5526365", "0.5512351", "0.5472505", "0.546174", "0.5440162", "0.5404001", "0.5396643", "0.5329541", "0.5284762", "0.5267658", "0.5267159"...
0.7601864
0
GetLastTrade returns the newest Trade object in the database.
func (s *TickerSession) GetLastTrade(ctx context.Context) (trade Trade, err error) { err = s.GetRaw(ctx, &trade, "SELECT * FROM trades ORDER BY ledger_close_time DESC LIMIT 1") return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (h *HUOBI) GetLastTrade(ctx context.Context, code currency.Pair) (LastTradeData, error) {\n\tvar resp LastTradeData\n\tcodeValue, err := h.FormatSymbol(code, asset.CoinMarginedFutures)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tparams := url.Values{}\n\tparams.Set(\"contract_code\", codeValue)\n\tpath :...
[ "0.68756187", "0.59373677", "0.59064734", "0.57652515", "0.57638764", "0.5652808", "0.56303495", "0.5626168", "0.5551367", "0.5427623", "0.540684", "0.534508", "0.53236514", "0.5318616", "0.5307247", "0.52589756", "0.52236503", "0.51877254", "0.51866764", "0.51714575", "0.516...
0.7395649
0
DeleteOldTrades deletes trades in the database older than minDate.
func (s *TickerSession) DeleteOldTrades(ctx context.Context, minDate time.Time) error { _, err := s.ExecRaw(ctx, "DELETE FROM trades WHERE ledger_close_time < ?", minDate) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *NewsyDAO) deleteOld() (int, error) {\n\tm.connect()\n\tinfo, err := db.C(m.Database).RemoveAll(bson.M{\"time\": bson.M{\"$lt\": time.Now().Add(-time.Hour * 24 * 30)}})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn info.Removed, err\n}", "func (e *elephant) deleteOldRaws(before int64) error {\n...
[ "0.6019266", "0.597073", "0.58227867", "0.54857105", "0.5434066", "0.54014707", "0.5395646", "0.53301513", "0.5298872", "0.5189107", "0.517596", "0.5134746", "0.5104006", "0.5081436", "0.50796914", "0.5040801", "0.5013909", "0.49733227", "0.49027574", "0.48886272", "0.4884154...
0.8504664
0
chunkifyDBTrades transforms a slice into a slice of chunks (also slices) of chunkSize e.g.: Chunkify([b, c, d, e, f], 2) = [[b c] [d e] [f]]
func chunkifyDBTrades(sl []Trade, chunkSize int) [][]Trade { var chunkedSlice [][]Trade numChunks := int(math.Ceil(float64(len(sl)) / float64(chunkSize))) start := 0 length := len(sl) for i := 0; i < numChunks; i++ { end := start + chunkSize if end > length { end = length } chunk := sl[start:end] chunkedSlice = append(chunkedSlice, chunk) start = end } return chunkedSlice }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Chunk[T any](collection []T, size int) [][]T {\n\tif size <= 0 {\n\t\tpanic(\"Second parameter must be greater than 0\")\n\t}\n\n\tresult := make([][]T, 0, len(collection)/2+1)\n\tlength := len(collection)\n\n\tfor i := 0; i < length; i++ {\n\t\tchunk := i / size\n\n\t\tif i%size == 0 {\n\t\t\tresult = append...
[ "0.6250978", "0.6039344", "0.5996696", "0.58535403", "0.58295757", "0.5801346", "0.5676788", "0.56612074", "0.56340796", "0.5479971", "0.54364383", "0.5423836", "0.540924", "0.54092264", "0.54058325", "0.53808355", "0.5275819", "0.5270938", "0.5244062", "0.5224602", "0.521059...
0.84048146
0
Your code here RPC handlers for the worker to call.
func (m *Master) Echo(req *VRequest, resp *VResponse) error { status := req.JobStatus pid := req.Pid if m.getDoneReduceTaskNum() == m.NReduce { //Job finished resp.JobType = JOB_TYPE_EXIT m.ExitChan <- 1 return nil } if status == -999 { //task error if info, ok := m.MapTask[req.TaskNum]; ok && info.Pid == req.Pid { //Redo the task m.MapLock.Lock() m.TodoMapTask = append(m.TodoMapTask, req.TaskNum) delete(m.MapTask, req.TaskNum) m.MapLock.Unlock() } status = 0 //set back to free worker } if status == JOB_STATUS_MAP { //get res of Map task log.Printf("Pid: %v, Map task: %v", pid, req.TaskNum) m.MapLock.Lock() m.DoneMapTask = append(m.DoneMapTask, req.TaskNum) delete(m.MapTask, req.TaskNum) m.MapLock.Unlock() } else if status == JOB_STATUS_REDUCE { //get res of Reduce task m.ReduceLock.Lock() m.DoneReduceTask = append(m.DoneReduceTask, req.TaskNum) delete(m.ReduceTask, req.TaskNum) m.ReduceLock.Unlock() } // assign new task if m.getDoneMapTaskNum() < m.NMap { //Map taskNum := m.getTodoMapTask() if taskNum != -1 { m.prepareMapTask(taskNum, pid, resp) log.Printf("Assign Map task %v to Pid %v", taskNum, pid) return nil } } else if m.getDoneReduceTaskNum() < m.NReduce { //Reduce resp.JobType = 2 taskNum := m.getTodoReduceTask() if taskNum != -1 { m.prepareReduceTask(taskNum, pid, resp) log.Printf("Assign Reduce task %v to Pid %v", taskNum, pid) return nil } } resp.JobType = JOB_STATUS_STUB log.Print("Assign nothing") return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func callWorker(worker, name string, args interface{}, reply interface{}) bool {\n\treturn call(worker, \"RPCWorker.\"+name, args, reply)\n}", "func (rm *REKTManager) worker(req http.Request) Response {\n\tresp, err := rm.client.Do(&req)\n\tif err != nil {\n\t\treturn Response{make([]byte, 0), err}\n\t}\n\tdefer...
[ "0.68124545", "0.67386556", "0.6538588", "0.64412796", "0.63820744", "0.6331834", "0.6312795", "0.6229725", "0.62133926", "0.620732", "0.61875457", "0.61756396", "0.61652946", "0.61633956", "0.61487836", "0.61311626", "0.61278206", "0.61274767", "0.60870486", "0.6065647", "0....
0.0
-1
an example RPC handler. the RPC argument and reply types are defined in rpc.go.
func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error { reply.Y = args.X + 1 time.Sleep(time.Second * 3) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *Backend) RPC(choice uint64, body []byte, v interface{}) error {\n\tconn, err := b.Dial()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer conn.Close()\n\n\tchoiceBuf := make([]byte, binary.MaxVarintLen64)\n\tbinary.PutUvarint(choiceBuf, choice)\n\t_, err = conn.conn.Write(choiceBuf)\n\tif err != nil {\n...
[ "0.68129766", "0.6796958", "0.650533", "0.6480653", "0.64089096", "0.64069104", "0.63528615", "0.6294185", "0.6282052", "0.6235586", "0.62237513", "0.6207886", "0.6188606", "0.61750627", "0.6160879", "0.6106869", "0.61000663", "0.5946692", "0.59224355", "0.5914379", "0.591099...
0.0
-1
start a thread that listens for RPCs from worker.go
func (m *Master) server() { rpc.Register(m) rpc.HandleHTTP() //l, e := net.Listen("tcp", ":1234") sockname := masterSock() os.Remove(sockname) l, e := net.Listen("unix", sockname) if e != nil { log.Fatal("listen error:", e) } go http.Serve(l, nil) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (wk *Worker) startRPCServer() {\n\t// TODO: implement me\n\t// Hint: Refer to how the driver's startRPCServer is implemented.\n\t// TODO TODO TODO\n\t//\n\n\t//\n\t// Once shutdown is closed, should the following statement be\n\t// called, meaning the worker RPC server is existing.\n\tserverless.Debug(\"Worke...
[ "0.64237857", "0.63124293", "0.6109769", "0.60422313", "0.5865199", "0.58389354", "0.583757", "0.5834663", "0.58046454", "0.5800697", "0.5778423", "0.5769884", "0.57659143", "0.5764688", "0.57607377", "0.5753001", "0.5745076", "0.5744342", "0.57366085", "0.5727261", "0.571949...
0.0
-1
main/mrmaster.go calls Done() periodically to find out if the entire job has finished.
func (m *Master) Done() bool { ret := false // Your code here. if len(m.DoneReduceTask) == m.NReduce { ret = true } return ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Master) Done() bool {\n\tret := false\n\tfmt.Printf(\"MapTasks: %v\\n\", m.mapTasks)\n\tfmt.Printf(\"RedTasks: %v\\n\", m.reduceTasks)\n\tfmt.Printf(\"nReduce: %d, nMap: %d\\n\", m.nReduce, m.nMap)\n\t// Your code here.\n\t// all tasks have finished\n\tif m.hasGenerateReduceTasks && m.nReduce <= 0 && m.nM...
[ "0.78244966", "0.76445293", "0.76165444", "0.74860924", "0.7423259", "0.73622495", "0.73428744", "0.73375666", "0.730773", "0.73054695", "0.7262134", "0.7249725", "0.7239067", "0.721362", "0.72051764", "0.7198871", "0.7190688", "0.7186202", "0.7177774", "0.71742016", "0.71372...
0.70151204
23
create a Master. main/mrmaster.go calls this function. nReduce is the number of reduce tasks to use.
func MakeMaster(files []string, nReduce int) *Master { m := Master{ NMap: len(files), NReduce: nReduce, files: files, MapTask: make(map[int]*TaskInfo), ReduceTask: make(map[int]*TaskInfo), DoneMapTask: []int{}, DoneReduceTask: []int{}, ExitChan: make(chan int), } // Your code here. for idx, _ := range files { m.TodoMapTask = append(m.TodoMapTask, idx) } for idx := 0; idx < nReduce; idx++ { m.TodoReduceTask = append(m.TodoReduceTask, idx) } go m.countTime() m.server() return &m }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MakeMaster(files []string, nReduce int) *Master {\n\t// TODO: figure out better place to setup log flags\n\tlog.SetFlags(log.Ltime) // | log.Lshortfile)\n\n\tm := Master{nReduce: nReduce}\n\n\t// Your code here.\n\t// Generating Map tasks\n\tlogger.Debug(\"Generating Map tasks...\")\n\tfor i, fn := range file...
[ "0.8003093", "0.799659", "0.7984637", "0.796298", "0.79392916", "0.7939283", "0.7936007", "0.7906597", "0.78813976", "0.78519106", "0.7835691", "0.7799476", "0.77814615", "0.7772914", "0.77464867", "0.77463424", "0.7656915", "0.7648694", "0.7534488", "0.7528681", "0.7495396",...
0.7673505
16
ReadResponse reads a server response into the received o.
func (o *SetAmountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewSetAmountOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewSetAmountUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewSetAmountForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("unknown error", response, response.Code()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *ResourceHandler) ReadResponse(dataOut unsafe.Pointer, bytesToRead int32, bytesRead *int32, callback *Callback) int32 {\n\treturn lookupResourceHandlerProxy(d.Base()).ReadResponse(d, dataOut, bytesToRead, bytesRead, callback)\n}", "func (o *GetServerReader) ReadResponse(response runtime.ClientResponse, c...
[ "0.7640225", "0.7607834", "0.75210214", "0.7509121", "0.74803215", "0.74724656", "0.7433606", "0.74244606", "0.7375357", "0.7367311", "0.73589337", "0.73551553", "0.7350114", "0.7347274", "0.7346054", "0.733966", "0.7336042", "0.73239547", "0.7315819", "0.73155594", "0.731019...
0.0
-1
NewSetAmountOK creates a SetAmountOK with default headers values
func NewSetAmountOK() *SetAmountOK { return &SetAmountOK{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateMintRequest(args *SendArguments) []byte {\n\tsigners := GetSigners()\n\n\tconv := convert.NewConvert()\n\n\tif args.Party == \"\" {\n\t\tlog.Error(\"Missing Party information\", \"args\", args)\n\t\treturn nil\n\t}\n\n\t// TODO: Can't convert identities to accounts, this way!\n\tparty := GetAccountKey(a...
[ "0.5207237", "0.51316726", "0.48634335", "0.48437864", "0.4811924", "0.47807398", "0.47625837", "0.4710125", "0.4689143", "0.4676157", "0.4663853", "0.46498233", "0.4643923", "0.4643528", "0.46327043", "0.46291775", "0.46220052", "0.4562653", "0.45471358", "0.4539772", "0.453...
0.7121063
0
NewSetAmountUnauthorized creates a SetAmountUnauthorized with default headers values
func NewSetAmountUnauthorized() *SetAmountUnauthorized { return &SetAmountUnauthorized{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewSetAmountForbidden() *SetAmountForbidden {\n\treturn &SetAmountForbidden{}\n}", "func NewUnauthorized(cause error) Unauthorized { return Unauthorized(cause.Error()) }", "func setAuthorization(req *http.Request, apiKey string) {\n\treq.SetBasicAuth(apiKey, \"\")\n}", "func (rrc *ReserveRoomCreate) Set...
[ "0.5448316", "0.5128722", "0.5054955", "0.49919808", "0.4912029", "0.48164645", "0.47888353", "0.477642", "0.47480595", "0.47142124", "0.466739", "0.46673635", "0.46585533", "0.46378735", "0.46362117", "0.46158162", "0.458719", "0.45479572", "0.45391664", "0.45384142", "0.450...
0.7436876
0
NewSetAmountForbidden creates a SetAmountForbidden with default headers values
func NewSetAmountForbidden() *SetAmountForbidden { return &SetAmountForbidden{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewSetAmountUnauthorized() *SetAmountUnauthorized {\n\treturn &SetAmountUnauthorized{}\n}", "func (transaction *TokenMintTransaction) SetAmount(amount uint64) *TokenMintTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.pb.Amount = amount\n\treturn transaction\n}", "func (sc *StockCreate) SetA...
[ "0.6096427", "0.53221464", "0.52059275", "0.51483727", "0.5126698", "0.50462794", "0.5024853", "0.5021318", "0.49100164", "0.49038866", "0.4885792", "0.48382547", "0.48157752", "0.47899404", "0.47881573", "0.47840023", "0.47426653", "0.47335622", "0.47298658", "0.4721344", "0...
0.78111184
0
NewHandler makes a set of endpoints available as a gRPC Server. NOTE: At some point, request tracing support needs to be added. And since much of this service used example code from gokit, the place to start for tracing support is probably here:
func NewHandler(ctx context.Context, endpoints endpoints.Endpoints, tracer stdopentracing.Tracer, logger log.Logger) pb.VaultServer { options := []grpctransport.ServerOption{ grpctransport.ServerErrorLogger(logger), } return &grpcServer{ initstatus: grpctransport.NewServer( ctx, endpoints.InitStatusEndpoint, DecodeInitStatusRequest, EncodeInitStatusResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "InitStatus", logger)))..., ), init: grpctransport.NewServer( ctx, endpoints.InitEndpoint, DecodeInitRequest, EncodeInitResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "Init", logger)))..., ), sealstatus: grpctransport.NewServer( ctx, endpoints.SealStatusEndpoint, DecodeSealStatusRequest, EncodeSealStatusResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "SealStatus", logger)))..., ), unseal: grpctransport.NewServer( ctx, endpoints.UnsealEndpoint, DecodeUnsealRequest, EncodeUnsealResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "Unseal", logger)))..., ), configure: grpctransport.NewServer( ctx, endpoints.ConfigureEndpoint, DecodeConfigureRequest, EncodeConfigureResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "Configure", logger)))..., ), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Server(l log.Logger) middleware.Middleware {\n\tlogger := log.NewHelper(\"middleware/logging\", l)\n\treturn func(handler middleware.Handler) middleware.Handler {\n\t\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\tvar (\n\t\t\t\tpath string\n\t\t\t\tmethod string\n\t\...
[ "0.6556951", "0.64450943", "0.63754344", "0.624347", "0.6240815", "0.61856514", "0.6153799", "0.61345536", "0.6077497", "0.6069888", "0.60464805", "0.6020708", "0.60102236", "0.59864646", "0.5958692", "0.5957291", "0.5948522", "0.59407914", "0.591217", "0.59005606", "0.589742...
0.66910815
0
DecodeInitStatusRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC initstatus request to a userdomain initstatus request. Primarily useful in a server.
func DecodeInitStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { return endpoints.InitStatusRequest{}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeInitRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.InitRequest)\n\topts := service.InitOptions{\n\t\tSecretShares: int(req.SecretShares),\n\t\tSecretThreshold: int(req.SecretThreshold),\n\t\tStoredShares: int(req.StoredShares),\n\t\t...
[ "0.7129382", "0.6976945", "0.6869651", "0.6422795", "0.6369893", "0.63555247", "0.6338161", "0.6306145", "0.6297056", "0.62524295", "0.61499935", "0.61132085", "0.59392864", "0.593118", "0.591802", "0.58783144", "0.58117044", "0.5801168", "0.5756792", "0.5703512", "0.5683426"...
0.8717294
0
DecodeInitStatusResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC initstatus reply to a userdomain initstatus response. Primarily useful in a client.
func DecodeInitStatusResponse(_ context.Context, grpcReply interface{}) (interface{}, error) { reply := grpcReply.(*pb.InitStatusResponse) return endpoints.InitStatusResponse{Initialized: bool(reply.Status.Initialized), Err: service.String2Error(reply.Err)}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeInitStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treturn endpoints.InitStatusRequest{}, nil\n}", "func DecodeInitResponse(_ context.Context, grpcReply interface{}) (interface{}, error) {\n\treply := grpcReply.(*pb.InitResponse)\n\tinit := service.InitKeys{\n\t\tKeys: ...
[ "0.69784266", "0.6842123", "0.678531", "0.6287609", "0.6072695", "0.6056219", "0.5958254", "0.5863092", "0.5836156", "0.5796046", "0.5773608", "0.57431483", "0.5683764", "0.5647684", "0.56337595", "0.559996", "0.55869573", "0.557601", "0.5556611", "0.54934984", "0.54814804", ...
0.8493457
0
EncodeInitStatusResponse is a transport/grpc.EncodeResponseFunc that converts a userdomain initstatus response to a gRPC initstatus reply. Primarily useful in a server.
func EncodeInitStatusResponse(_ context.Context, response interface{}) (interface{}, error) { resp := response.(endpoints.InitStatusResponse) status := &pb.Status{Initialized: bool(resp.Initialized)} return &pb.InitStatusResponse{Status: status, Err: service.Error2String(resp.Err)}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeInitStatusResponse(_ context.Context, grpcReply interface{}) (interface{}, error) {\n\treply := grpcReply.(*pb.InitStatusResponse)\n\treturn endpoints.InitStatusResponse{Initialized: bool(reply.Status.Initialized), Err: service.String2Error(reply.Err)}, nil\n}", "func EncodeGRPCStatusResponse(_ contex...
[ "0.71989673", "0.6871065", "0.6724791", "0.6619698", "0.60995674", "0.6052052", "0.6019687", "0.6016102", "0.59115225", "0.5891892", "0.58844995", "0.58737874", "0.5775363", "0.57499516", "0.5598026", "0.5456248", "0.5428055", "0.5369682", "0.53624517", "0.53622776", "0.53223...
0.83921474
0
EncodeInitStatusRequest is a transport/grpc.EncodeRequestFunc that converts a userdomain initstatus request to a gRPC initstatus request. Primarily useful in a client.
func EncodeInitStatusRequest(_ context.Context, request interface{}) (interface{}, error) { return &pb.InitStatusRequest{}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeInitStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treturn endpoints.InitStatusRequest{}, nil\n}", "func EncodeInitRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(endpoints.InitRequest)\n\treturn &pb.InitRequest{\n\t\tSecretShar...
[ "0.7524147", "0.688146", "0.65024054", "0.63949585", "0.63794583", "0.6364447", "0.6268314", "0.6267921", "0.6221888", "0.6094067", "0.60649824", "0.5962428", "0.5908938", "0.5879699", "0.58383524", "0.5804806", "0.5628846", "0.55176324", "0.54532355", "0.5335997", "0.5333527...
0.8563548
0
DecodeInitRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC init request to a userdomain init request. Primarily useful in a server.
func DecodeInitRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { req := grpcReq.(*pb.InitRequest) opts := service.InitOptions{ SecretShares: int(req.SecretShares), SecretThreshold: int(req.SecretThreshold), StoredShares: int(req.StoredShares), PGPKeys: req.PgpKeys, RecoveryShares: int(req.RecoveryShares), RecoveryThreshold: int(req.RecoveryThreshold), RecoveryPGPKeys: req.RecoveryPgpKeys, RootTokenPGPKey: req.RootTokenPgpKey, RootTokenHolderEmail: req.RootTokenHolderEmail, SecretKeyHolderEmails: req.SecretKeyHolderEmails, } return &endpoints.InitRequest{Opts: opts}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeInitStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treturn endpoints.InitStatusRequest{}, nil\n}", "func DecodeGRPCInitBridgeRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.InitBridgeRequest)\n\tip, err := abstraction.NewIne...
[ "0.74419457", "0.68830794", "0.6435474", "0.6361506", "0.62232393", "0.59333706", "0.5925991", "0.59195656", "0.59115005", "0.58275574", "0.574241", "0.5740645", "0.57364815", "0.5721771", "0.5620997", "0.55863464", "0.5575288", "0.5564788", "0.5537456", "0.5528624", "0.55200...
0.8064943
0
DecodeInitResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC init reply to a userdomain init response. Primarily useful in a client.
func DecodeInitResponse(_ context.Context, grpcReply interface{}) (interface{}, error) { reply := grpcReply.(*pb.InitResponse) init := service.InitKeys{ Keys: reply.Keys, KeysB64: reply.KeysBase64, RecoveryKeys: reply.RecoveryKeys, RecoveryKeysB64: reply.RecoveryKeysBase64, RootToken: reply.RootToken, } return endpoints.InitResponse{Init: init, Err: service.String2Error(reply.Err)}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeInitStatusResponse(_ context.Context, grpcReply interface{}) (interface{}, error) {\n\treply := grpcReply.(*pb.InitStatusResponse)\n\treturn endpoints.InitStatusResponse{Initialized: bool(reply.Status.Initialized), Err: service.String2Error(reply.Err)}, nil\n}", "func EncodeInitResponse(_ context.Cont...
[ "0.7352298", "0.66213375", "0.6391019", "0.62874204", "0.61212754", "0.5974801", "0.59635955", "0.59630775", "0.593531", "0.5925777", "0.58184564", "0.57664007", "0.56916213", "0.5670297", "0.5663285", "0.5661075", "0.56440115", "0.56324476", "0.5629992", "0.56150544", "0.560...
0.8047387
0
EncodeInitResponse is a transport/grpc.EncodeResponseFunc that converts a userdomain init response to a gRPC init reply. Primarily useful in a server.
func EncodeInitResponse(_ context.Context, response interface{}) (interface{}, error) { resp := response.(endpoints.InitResponse) return &pb.InitResponse{ Keys: resp.Init.Keys, KeysBase64: resp.Init.KeysB64, RecoveryKeys: resp.Init.RecoveryKeys, RecoveryKeysBase64: resp.Init.RecoveryKeysB64, RootToken: resp.Init.RootToken, Err: service.Error2String(resp.Err), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EncodeInitStatusResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.InitStatusResponse)\n\tstatus := &pb.Status{Initialized: bool(resp.Initialized)}\n\treturn &pb.InitStatusResponse{Status: status, Err: service.Error2String(resp.Err)}, nil\n}", "func Encod...
[ "0.69735706", "0.68085706", "0.6666967", "0.61809444", "0.5985854", "0.5924313", "0.58425695", "0.5840831", "0.5746398", "0.56999594", "0.56354076", "0.55579066", "0.55238557", "0.54866993", "0.5448932", "0.54269874", "0.5421233", "0.5407433", "0.53737605", "0.536424", "0.535...
0.7878448
0
EncodeInitRequest is a transport/grpc.EncodeRequestFunc that converts a userdomain init request to a gRPC init request. Primarily useful in a client.
func EncodeInitRequest(_ context.Context, request interface{}) (interface{}, error) { req := request.(endpoints.InitRequest) return &pb.InitRequest{ SecretShares: uint32(req.Opts.SecretShares), SecretThreshold: uint32(req.Opts.SecretThreshold), StoredShares: uint32(req.Opts.StoredShares), PgpKeys: req.Opts.PGPKeys, RecoveryShares: uint32(req.Opts.RecoveryShares), RecoveryThreshold: uint32(req.Opts.RecoveryThreshold), RecoveryPgpKeys: req.Opts.RecoveryPGPKeys, RootTokenPgpKey: req.Opts.RootTokenPGPKey, RootTokenHolderEmail: req.Opts.RootTokenHolderEmail, SecretKeyHolderEmails: req.Opts.SecretKeyHolderEmails, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EncodeInitStatusRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treturn &pb.InitStatusRequest{}, nil\n}", "func DecodeInitRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.InitRequest)\n\topts := service.InitOptions{\n\t\tSecretShares: ...
[ "0.71396", "0.6861393", "0.6196955", "0.5671533", "0.5668844", "0.55841213", "0.55677044", "0.5559038", "0.55398405", "0.55146986", "0.5485892", "0.54847926", "0.54730076", "0.54648185", "0.54332685", "0.5390209", "0.53850895", "0.53697085", "0.5350257", "0.53281355", "0.5297...
0.80858845
0
DecodeSealStatusRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC sealstatus request to a userdomain sealstatus request. Primarily useful in a server.
func DecodeSealStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { return endpoints.SealStatusRequest{}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EncodeSealStatusRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treturn &pb.SealStatusRequest{}, nil\n}", "func DecodeGrpcReqPropagationStatus(ctx context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*PropagationStatus)\n\treturn req, nil\n}", "func Deco...
[ "0.68879247", "0.6282473", "0.62601626", "0.62122816", "0.6178334", "0.6161537", "0.5837773", "0.57606804", "0.572651", "0.57119286", "0.5696331", "0.56947005", "0.55792344", "0.55391794", "0.5515782", "0.54229045", "0.5415276", "0.53905034", "0.5370787", "0.52295345", "0.519...
0.8666395
0
DecodeSealStatusResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC sealstatus reply to a userdomain sealstatus response. Primarily useful in a client.
func DecodeSealStatusResponse(_ context.Context, grpcReply interface{}) (interface{}, error) { reply := grpcReply.(*pb.SealStatusResponse) status := endpoints.SealStatusResponse{ Sealed: reply.SealStatus.Sealed, T: int(reply.SealStatus.T), N: int(reply.SealStatus.N), Progress: int(reply.SealStatus.Progress), Version: reply.SealStatus.Version, ClusterName: reply.SealStatus.ClusterName, ClusterID: reply.SealStatus.ClusterId, Err: service.String2Error(reply.Err), } return status, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeSealStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treturn endpoints.SealStatusRequest{}, nil\n}", "func DecodeUnsealResponse(_ context.Context, grpcReply interface{}) (interface{}, error) {\n\treply := grpcReply.(*pb.UnsealResponse)\n\tstatus := endpoints.UnsealRespons...
[ "0.69686687", "0.6629207", "0.64158314", "0.60307133", "0.59389246", "0.5696591", "0.56734985", "0.5633695", "0.5624199", "0.5619674", "0.5603296", "0.5589424", "0.5571292", "0.55586493", "0.5446506", "0.54243785", "0.54193884", "0.54072326", "0.538677", "0.53299624", "0.5327...
0.8337024
0
EncodeSealStatusResponse is a transport/grpc.EncodeResponseFunc that converts a userdomain sealstatus response to a gRPC sealstatus reply. Primarily useful in a server.
func EncodeSealStatusResponse(_ context.Context, response interface{}) (interface{}, error) { resp := response.(endpoints.SealStatusResponse) status := &pb.SealStatus{ Sealed: resp.Sealed, T: uint32(resp.T), N: uint32(resp.N), Progress: uint32(resp.Progress), Version: resp.Version, ClusterName: resp.ClusterName, ClusterId: resp.ClusterID, } return &pb.SealStatusResponse{ SealStatus: status, Err: service.Error2String(resp.Err), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeSealStatusResponse(_ context.Context, grpcReply interface{}) (interface{}, error) {\n\treply := grpcReply.(*pb.SealStatusResponse)\n\tstatus := endpoints.SealStatusResponse{\n\t\tSealed: reply.SealStatus.Sealed,\n\t\tT: int(reply.SealStatus.T),\n\t\tN: int(reply.SealStatus.N),\n...
[ "0.70623535", "0.64098006", "0.62919486", "0.59212404", "0.5872281", "0.5816939", "0.571567", "0.57044536", "0.5671326", "0.5625205", "0.55804116", "0.5545528", "0.55432314", "0.551112", "0.5511113", "0.5450678", "0.54478246", "0.5418886", "0.54108524", "0.54108524", "0.52873...
0.8174475
0
EncodeSealStatusRequest is a transport/grpc.EncodeRequestFunc that converts a userdomain sealstatus request to a gRPC sealstatus request. Primarily useful in a client.
func EncodeSealStatusRequest(_ context.Context, request interface{}) (interface{}, error) { return &pb.SealStatusRequest{}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeSealStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treturn endpoints.SealStatusRequest{}, nil\n}", "func EncodeSealStatusResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.SealStatusResponse)\n\n\tstatus := &pb.SealSt...
[ "0.76378393", "0.6283251", "0.61115307", "0.5937746", "0.5923187", "0.5863172", "0.58038557", "0.5720901", "0.5712661", "0.5675275", "0.56752735", "0.5631426", "0.5261032", "0.5145586", "0.51382375", "0.50512904", "0.49910277", "0.4978164", "0.4916106", "0.49155042", "0.49059...
0.8510512
0
DecodeUnsealRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC unseal request to a userdomain unseal request. Primarily useful in a server.
func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { req := grpcReq.(*pb.UnsealRequest) return &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EncodeUnsealRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(endpoints.UnsealRequest)\n\treturn &pb.UnsealRequest{\n\t\tKey: req.Key,\n\t\tReset_: req.Reset,\n\t}, nil\n}", "func decodeDeleteIndustryRequest(_ context.Context, request interface{}) (interface{}, err...
[ "0.7280741", "0.5844734", "0.5756811", "0.5706875", "0.566887", "0.56676745", "0.56396073", "0.56286395", "0.56273174", "0.56095016", "0.5571078", "0.55685455", "0.55680245", "0.5558892", "0.5547583", "0.55451274", "0.55109066", "0.5507091", "0.5495625", "0.5492653", "0.54662...
0.83825207
0
DecodeUnsealResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC unseal reply to a userdomain unseal response. Primarily useful in a client.
func DecodeUnsealResponse(_ context.Context, grpcReply interface{}) (interface{}, error) { reply := grpcReply.(*pb.UnsealResponse) status := endpoints.UnsealResponse{ Sealed: reply.SealStatus.Sealed, T: int(reply.SealStatus.T), N: int(reply.SealStatus.N), Progress: int(reply.SealStatus.Progress), Version: reply.SealStatus.Version, ClusterName: reply.SealStatus.ClusterName, ClusterID: reply.SealStatus.ClusterId, Err: service.String2Error(reply.Err), } return status, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EncodeUnsealResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.UnsealResponse)\n\n\tstatus := &pb.SealStatus{\n\t\tSealed: resp.Sealed,\n\t\tT: uint32(resp.T),\n\t\tN: uint32(resp.N),\n\t\tProgress: uint32(resp.Progress),\n\t\tVe...
[ "0.6951401", "0.663803", "0.5849642", "0.5703922", "0.570088", "0.5603579", "0.55406016", "0.5519809", "0.5514987", "0.5489018", "0.5483218", "0.545862", "0.5448766", "0.5431185", "0.5408081", "0.5398663", "0.53911364", "0.5359621", "0.5354117", "0.53493816", "0.534481", "0...
0.80364317
0
EncodeUnsealResponse is a transport/grpc.EncodeResponseFunc that converts a userdomain unseal response to a gRPC sealstatus reply. Primarily useful in a server.
func EncodeUnsealResponse(_ context.Context, response interface{}) (interface{}, error) { resp := response.(endpoints.UnsealResponse) status := &pb.SealStatus{ Sealed: resp.Sealed, T: uint32(resp.T), N: uint32(resp.N), Progress: uint32(resp.Progress), Version: resp.Version, ClusterName: resp.ClusterName, ClusterId: resp.ClusterID, } return &pb.UnsealResponse{ SealStatus: status, Err: service.Error2String(resp.Err), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeUnsealResponse(_ context.Context, grpcReply interface{}) (interface{}, error) {\n\treply := grpcReply.(*pb.UnsealResponse)\n\tstatus := endpoints.UnsealResponse{\n\t\tSealed: reply.SealStatus.Sealed,\n\t\tT: int(reply.SealStatus.T),\n\t\tN: int(reply.SealStatus.N),\n\t\tProgress...
[ "0.68511176", "0.60471827", "0.6003619", "0.5851205", "0.5676236", "0.5624162", "0.549162", "0.5342651", "0.5327939", "0.53194475", "0.53164035", "0.5255484", "0.5237665", "0.5174125", "0.5081887", "0.50810015", "0.5039617", "0.5007958", "0.49988678", "0.4996362", "0.4984836"...
0.7886225
0
EncodeUnsealRequest is a transport/grpc.EncodeRequestFunc that converts a userdomain unseal request to a gRPC unseal request. Primarily useful in a client.
func EncodeUnsealRequest(_ context.Context, request interface{}) (interface{}, error) { req := request.(endpoints.UnsealRequest) return &pb.UnsealRequest{ Key: req.Key, Reset_: req.Reset, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UnsealRequest)\n\treturn &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil\n}", "func EncodeUnfollowRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) err...
[ "0.7176126", "0.56582075", "0.5631412", "0.5143132", "0.5062907", "0.50418043", "0.49451452", "0.49227485", "0.48891357", "0.4881726", "0.48450512", "0.48357892", "0.4811212", "0.47776994", "0.47764227", "0.47634947", "0.47544217", "0.473586", "0.47289753", "0.47256556", "0.4...
0.81784874
0
DecodeConfigureRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC configure request to a userdomain configure request. Primarily useful in a server.
func DecodeConfigureRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { req := grpcReq.(*pb.ConfigureRequest) return &endpoints.ConfigureRequest{URL: req.Url, Token: req.Token}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeGRPCGetUserConfigRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.GetUserConfigParams)\n\treturn req, nil\n}", "func DecodeGrpcReqEVPNConfig(ctx context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*EVPNConfig)\n\treturn req, nil\...
[ "0.6687782", "0.63867176", "0.6278261", "0.6191763", "0.5764469", "0.56433535", "0.560411", "0.55609053", "0.5510862", "0.5496248", "0.5399069", "0.5376619", "0.5376162", "0.5357248", "0.53152686", "0.52657986", "0.52462775", "0.5222324", "0.5200303", "0.5197415", "0.5194945"...
0.8385086
0
DecodeConfigureResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC configure reply to a userdomain configure response. Primarily useful in a client.
func DecodeConfigureResponse(_ context.Context, grpcReply interface{}) (interface{}, error) { reply := grpcReply.(*pb.ConfigureResponse) var mounts map[string]endpoints.MountOutput var auths map[string]endpoints.AuthMountOutput var policies []string if reply.ConfigStatus != nil { // mounts if (reply.ConfigStatus.Mounts != nil) && (len(reply.ConfigStatus.Mounts) > 0) { mounts = make(map[string]endpoints.MountOutput) for k, v := range reply.ConfigStatus.Mounts { mountCfgOut := endpoints.MountConfigOutput{ DefaultLeaseTTL: int(v.Config.DefaultLeaseTtl), MaxLeaseTTL: int(v.Config.MaxLeaseTtl), } mountOut := endpoints.MountOutput{ Type: v.Type, Description: v.Description, Config: mountCfgOut, } mounts[k] = mountOut } } // auths if (reply.ConfigStatus.Auths != nil) && (len(reply.ConfigStatus.Auths) > 0) { auths = make(map[string]endpoints.AuthMountOutput) for k, v := range reply.ConfigStatus.Auths { authCfgOut := endpoints.AuthConfigOutput{ DefaultLeaseTTL: int(v.Config.DefaultLeaseTtl), MaxLeaseTTL: int(v.Config.MaxLeaseTtl), } authMountOut := endpoints.AuthMountOutput{ Type: v.Type, Description: v.Description, Config: authCfgOut, } auths[k] = authMountOut } } } // policies if (reply.ConfigStatus.Policies != nil) && (len(reply.ConfigStatus.Policies) > 0) { policies = reply.ConfigStatus.Policies } status := endpoints.ConfigureResponse{ ConfigID: reply.ConfigStatus.ConfigId, Mounts: mounts, Auths: auths, Policies: policies, Err: service.String2Error(reply.Err), } return status, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeConfigureRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.ConfigureRequest)\n\treturn &endpoints.ConfigureRequest{URL: req.Url, Token: req.Token}, nil\n}", "func DecodeGrpcRespEVPNConfig(ctx context.Context, response interface{}) (interface{}, error) {\n\tr...
[ "0.68375146", "0.6325345", "0.63173586", "0.5951232", "0.5838574", "0.5710962", "0.5689829", "0.56053424", "0.55993205", "0.55852973", "0.55329514", "0.5519299", "0.55016005", "0.5492543", "0.54854184", "0.54769915", "0.54669756", "0.5466868", "0.5417491", "0.5408496", "0.537...
0.72897947
0
EncodeConfigureResponse is a transport/grpc.EncodeResponseFunc that converts a userdomain configure response to a gRPC configstatus reply. Primarily useful in a server.
func EncodeConfigureResponse(_ context.Context, response interface{}) (interface{}, error) { resp := response.(endpoints.ConfigureResponse) // mounts var mounts map[string]*pb.MountOutput if (resp.Mounts != nil) && (len(resp.Mounts) > 0) { mounts = make(map[string]*pb.MountOutput) for k, v := range resp.Mounts { mountCfgOut := &pb.MountConfigOutput{ DefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL), MaxLeaseTtl: uint32(v.Config.MaxLeaseTTL), } mountOut := &pb.MountOutput{ Type: v.Type, Description: v.Description, Config: mountCfgOut, } mounts[k] = mountOut } } // auths var auths map[string]*pb.AuthMountOutput if (resp.Auths != nil) && (len(resp.Auths) > 0) { auths = make(map[string]*pb.AuthMountOutput) for k, v := range resp.Auths { authCfgOut := &pb.AuthConfigOutput{ DefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL), MaxLeaseTtl: uint32(v.Config.MaxLeaseTTL), } authMountOut := &pb.AuthMountOutput{ Type: v.Type, Description: v.Description, Config: authCfgOut, } auths[k] = authMountOut } } // policies var policies []string if (resp.Policies != nil) && (len(resp.Policies) > 0) { policies = resp.Policies } status := &pb.ConfigStatus{ ConfigId: resp.ConfigID, Mounts: mounts, Auths: auths, Policies: policies, } return &pb.ConfigureResponse{ ConfigStatus: status, Err: service.Error2String(resp.Err), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EncodeGRPCGetUserConfigResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(*pb.UserCofing)\n\treturn resp, nil\n}", "func EncodeGRPCSetUserConfigResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(*pb.ErrCode)\n\treturn resp...
[ "0.6805108", "0.64093673", "0.63989437", "0.62021506", "0.5963501", "0.57790315", "0.57141113", "0.5680766", "0.56776494", "0.56058156", "0.5554134", "0.55113727", "0.5406613", "0.5395892", "0.52978784", "0.5225278", "0.52014214", "0.5201189", "0.5191209", "0.5125898", "0.511...
0.7218883
0
EncodeConfigureRequest is a transport/grpc.EncodeRequestFunc that converts a userdomain configure request to a gRPC configure request. Primarily useful in a client.
func EncodeConfigureRequest(_ context.Context, request interface{}) (interface{}, error) { req := request.(endpoints.ConfigureRequest) return &pb.ConfigureRequest{ Url: req.URL, Token: req.Token, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeConfigureRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.ConfigureRequest)\n\treturn &endpoints.ConfigureRequest{URL: req.Url, Token: req.Token}, nil\n}", "func EncodeGrpcReqEVPNConfig(ctx context.Context, request interface{}) (interface{}, error) {\n\treq...
[ "0.6559339", "0.6361221", "0.58737475", "0.5830498", "0.56752956", "0.5668946", "0.55751467", "0.5566848", "0.5555993", "0.5520367", "0.5438022", "0.541237", "0.52907526", "0.51902467", "0.5178918", "0.5141556", "0.51373947", "0.51363564", "0.5130922", "0.51298547", "0.512061...
0.8034952
0
join appends a bunch of Go Code together, each on their own line.
func join(s []jen.Code) *jen.Statement { r := jen.Empty() for i, stmt := range s { if i > 0 { r.Line() } r.Add(stmt) } return r }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func join(sep string, a ...string) string {\n\tswitch len(a) {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn a[0]\n\t}\n\n\tres := bytes.NewBufferString(a[0])\n\tfor _, s := range a[1:] {\n\t\tres.WriteString(sep + s)\n\t}\n\n\treturn res.String()\n}", "func join(ins []rune, c rune) (result []string) {\n\tf...
[ "0.6462607", "0.6456748", "0.64263934", "0.63524187", "0.62919945", "0.6290557", "0.6175297", "0.6172926", "0.61727154", "0.61235195", "0.61195123", "0.6094888", "0.60728055", "0.60475653", "0.5980173", "0.5955701", "0.5937746", "0.5909189", "0.5848211", "0.5846472", "0.58450...
0.72968787
0
packageName returns the name of the package for the property to be generated.
func (p *PropertyGenerator) packageName() string { return p.Package }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Settings) PackageName() string {\n\treturn naming.SnakeCase(s.packageName)\n}", "func (c *common) PackageName() string { return uniquePackageOf(c.file) }", "func (g *Generator) DefaultPackageName(obj Object) string {\n\tpkg := obj.PackageName()\n\tif pkg == g.packageName {\n\t\treturn \"\"\n\t}\n\tretu...
[ "0.6334045", "0.62505615", "0.6240149", "0.6029561", "0.59824127", "0.5801714", "0.5786217", "0.576325", "0.57259697", "0.57223594", "0.5695394", "0.5659194", "0.5643675", "0.5636759", "0.56273156", "0.5618324", "0.5617834", "0.56154764", "0.56086415", "0.5593599", "0.5592304...
0.838583
0
StructName returns the name of the type, which may or may not be a struct, to generate.
func (p *PropertyGenerator) StructName() string { if p.asIterator { return p.Name.CamelName } return fmt.Sprintf("%sProperty", p.Name.CamelName) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (op *Options) StructName() string {\n\tname := op.structName\n\tif name == \"\" {\n\t\tname = \"AutoGenerated\"\n\t}\n\treturn name\n}", "func (t *typeStruct) Name() string {\n\treturn t.name\n}", "func (t *Table) StructName() string {\n\tif t.structName == \"\" {\n\t\tt.structName = t.Name.ToCamel()\n\t}...
[ "0.7464585", "0.7440104", "0.71085715", "0.69838834", "0.65917873", "0.65784574", "0.6504498", "0.6440659", "0.6369878", "0.63357544", "0.6319041", "0.6307408", "0.6283176", "0.6267489", "0.6229999", "0.61658555", "0.6117011", "0.6110303", "0.6110303", "0.61003494", "0.606666...
0.74763453
0
PropertyName returns the name of this property, as defined in specifications. It is not suitable for use in generated code function identifiers.
func (p *PropertyGenerator) PropertyName() string { return p.Name.LowerName }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error) {\n\treturn PyName(p.Name), nil\n}", "func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error) {\n\treturn p.Name, nil\n}", "func propertyName(name string) string {\n\treturn makeValidIdentifier(Title(name))\n}...
[ "0.8008688", "0.7862032", "0.741721", "0.6724723", "0.67157304", "0.6606673", "0.65028703", "0.63482594", "0.61136585", "0.61080045", "0.610107", "0.6085882", "0.60559255", "0.6050332", "0.60107625", "0.59004015", "0.58642846", "0.58588517", "0.5833226", "0.57711846", "0.5756...
0.7632998
2
deserializeFnName returns the identifier of the function that deserializes raw JSON into the generated Go type.
func (p *PropertyGenerator) deserializeFnName() string { if p.asIterator { return fmt.Sprintf("%s%s", deserializeIteratorMethod, p.Name.CamelName) } return fmt.Sprintf("%s%sProperty", deserializeMethod, p.Name.CamelName) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *PropertyGenerator) serializeFnName() string {\n\tif p.asIterator {\n\t\treturn serializeIteratorMethod\n\t}\n\treturn serializeMethod\n}", "func (s *Instruction) FuncName() string {\n\tif name, ok := protoNameToFuncName[s.Protobuf.TypeName]; ok {\n\t\treturn name\n\t}\n\treturn \"?\"\n}", "func (f Des...
[ "0.60313565", "0.5606588", "0.52499104", "0.5136683", "0.5099535", "0.5093798", "0.5093467", "0.49743375", "0.49689713", "0.49670947", "0.49635115", "0.49327964", "0.49268723", "0.4926614", "0.49064428", "0.49031153", "0.485391", "0.48537642", "0.48403162", "0.4805315", "0.48...
0.7501765
0
getFnName returns the identifier of the function that fetches concrete types of the property.
func (p *PropertyGenerator) getFnName(i int) string { if len(p.Kinds) == 1 { return getMethod } return fmt.Sprintf("%s%s", getMethod, p.kindCamelName(i)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getFunctionName(fn interface{}) string {\n\treturn runtime.FuncForPC(reflect.ValueOf((fn)).Pointer()).Name()\n}", "func getFunctionName(i interface{}) string {\n\treturn runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()\n}", "func GetFunctionName(i interface{}) string {\n\treturn runtime.FuncForPC(re...
[ "0.6827634", "0.6727215", "0.66207886", "0.651886", "0.6495852", "0.6442681", "0.64336634", "0.64139414", "0.62645584", "0.61905044", "0.61785775", "0.6156786", "0.6141121", "0.61350834", "0.6092728", "0.60824543", "0.6068047", "0.60299236", "0.6020793", "0.59540904", "0.5926...
0.7537252
0
setFnName returns the identifier of the function that sets concrete types of the property.
func (p *PropertyGenerator) setFnName(i int) string { if len(p.Kinds) == 1 { return setMethod } return fmt.Sprintf("%s%s", setMethod, p.kindCamelName(i)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func setterName(typeName string) string {\n\treturn fmt.Sprintf(\"Set%s\", accessorName(typeName))\n}", "func SetTypeName(tau TypeT, name string) int32 {\n\tcs := C.CString(name)\n\tdefer C.free(unsafe.Pointer(cs))\n\treturn int32(C.yices_set_type_name(C.type_t(tau), cs))\n}", "func (fnSet) Name() string {\n\t...
[ "0.65256524", "0.6065046", "0.6001731", "0.5926056", "0.5860202", "0.5847865", "0.5822961", "0.5807942", "0.57485265", "0.5700438", "0.56349945", "0.5561267", "0.5530105", "0.5492297", "0.5476005", "0.5416045", "0.538494", "0.53687495", "0.53397745", "0.53389347", "0.5334416"...
0.7526814
0
serializeFnName returns the identifier of the function that serializes the generated Go type into raw JSON.
func (p *PropertyGenerator) serializeFnName() string { if p.asIterator { return serializeIteratorMethod } return serializeMethod }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *PropertyGenerator) deserializeFnName() string {\n\tif p.asIterator {\n\t\treturn fmt.Sprintf(\"%s%s\", deserializeIteratorMethod, p.Name.CamelName)\n\t}\n\treturn fmt.Sprintf(\"%s%sProperty\", deserializeMethod, p.Name.CamelName)\n}", "func (s *Instruction) FuncName() string {\n\tif name, ok := protoNam...
[ "0.6530537", "0.6170912", "0.6116096", "0.6036066", "0.59973794", "0.58882374", "0.5860285", "0.58490556", "0.574213", "0.5710654", "0.56836104", "0.5672176", "0.56310594", "0.5628329", "0.5607548", "0.55941474", "0.5560768", "0.5551219", "0.5540836", "0.55342555", "0.5517717...
0.7757559
0
kindCamelName returns an identifierfriendly name for the kind at the specified index. It will panic if 'i' is out of range.
func (p *PropertyGenerator) kindCamelName(i int) string { return p.Kinds[i].Name.CamelName }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (af *filtBase) GetKindName() string {\n\treturn af.kind\n}", "func (p *PropertyGenerator) getFnName(i int) string {\n\tif len(p.Kinds) == 1 {\n\t\treturn getMethod\n\t}\n\treturn fmt.Sprintf(\"%s%s\", getMethod, p.kindCamelName(i))\n}", "func nthCounterName(n int) string { return fmt.Sprintf(\"C%02d\", n)...
[ "0.57681674", "0.56236243", "0.5410848", "0.5390779", "0.53520626", "0.53333104", "0.5279356", "0.5263076", "0.5213945", "0.5213919", "0.51842946", "0.5176701", "0.51377106", "0.5112896", "0.50678414", "0.5041035", "0.5003459", "0.49665752", "0.49522355", "0.49473736", "0.493...
0.79529625
0
memberName returns the identifier to use for the kind at the specified index. It will panic if 'i' is out of range.
func (p *PropertyGenerator) memberName(i int) string { return fmt.Sprintf("%sMember", p.Kinds[i].Name.LowerName) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *CompType) MemberIndex(name string) int {\n\tc_name := C.CString(name)\n\tdefer C.free(unsafe.Pointer(c_name))\n\treturn int(C.H5Tget_member_index(t.id, c_name))\n}", "func (p *PropertyGenerator) hasMemberName(i int) string {\n\tif len(p.Kinds) == 1 && p.Kinds[0].Nilable {\n\t\tpanic(\"PropertyGenerator....
[ "0.65057737", "0.6310897", "0.6043316", "0.5811362", "0.57661265", "0.5664528", "0.56453437", "0.5569004", "0.5540558", "0.55238146", "0.5518647", "0.5392962", "0.53348476", "0.5334114", "0.5310704", "0.5276207", "0.52741504", "0.5220169", "0.51843584", "0.51594234", "0.51041...
0.7291041
0
hasMemberName returns the identifier to use for struct members that determine whether nonnilable types have been set. Panics if called for a Kind that is nilable.
func (p *PropertyGenerator) hasMemberName(i int) string { if len(p.Kinds) == 1 && p.Kinds[0].Nilable { panic("PropertyGenerator.hasMemberName called for nilable single value") } return fmt.Sprintf("has%sMember", p.Kinds[i].Name.CamelName) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func hasName(t Type) bool {\n\tswitch t.(type) {\n\tcase *Basic, *Named, *TypeParam:\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *Member) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t *Link) HasUnknownName() (ok bool) {\n\treturn t.name != nil ...
[ "0.6148321", "0.57391715", "0.5466784", "0.5413411", "0.5382661", "0.53526485", "0.5340739", "0.5338777", "0.5309317", "0.5301025", "0.5301025", "0.52994984", "0.52854455", "0.52655333", "0.5247527", "0.5239374", "0.52214646", "0.5211535", "0.52038103", "0.52034855", "0.52006...
0.7602432
0
clearMethodName returns the identifier to use for methods that clear all values from the property.
func (p *PropertyGenerator) clearMethodName() string { if p.asIterator { return iteratorClearMethod } return clearMethod }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (nmd *NetMethodDispatch) Clear() {\n\tnmd.sync.Lock()\n\tdefer nmd.sync.Unlock()\n\tnmd.m = make(map[interface{}]NetMethodFun)\n}", "func ClearName(key string) string {\n\tif strings.Contains(key, \"(\") {\n\t\tkey = strings.Split(key, \"(\")[0]\n\t}\n\n\tkey = strings.Replace(key, \"-\", \" \", -1)\n\tkey ...
[ "0.5459611", "0.52444017", "0.51835364", "0.51691246", "0.50454235", "0.4994905", "0.4980902", "0.49453282", "0.49362674", "0.49041834", "0.48798367", "0.4873958", "0.4838719", "0.47491616", "0.47411805", "0.47411805", "0.47386295", "0.4727244", "0.47245976", "0.47116664", "0...
0.7960542
0
commonMethods returns methods common to every property.
func (p *PropertyGenerator) commonMethods() []*codegen.Method { return []*codegen.Method{ codegen.NewCommentedValueMethod( p.packageName(), nameMethod, p.StructName(), /*params=*/ nil, []jen.Code{jen.String()}, []jen.Code{ jen.Return( jen.Lit(p.PropertyName()), ), }, jen.Commentf("%s returns the name of this property: %q.", nameMethod, p.PropertyName()), ), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Methods() []string {\n\treturn []string{\n\t\t\"logLevel\",\n\t\t\"isDebug\",\n\t\t\"isOnce\",\n\t\t\"withScript\",\n\t\t\"configSource\",\n\t\t\"safeMode\",\n\t}\n}", "func (c *Core) Methods() map[string]Metadata {\n\t_copy := make(map[string]Metadata)\n\tc.methods.Range(func(key, value interface{}) bool {...
[ "0.55080307", "0.5477312", "0.5344144", "0.5331152", "0.5182336", "0.5116721", "0.504159", "0.5015999", "0.501421", "0.5002182", "0.49919805", "0.4979669", "0.49786893", "0.49444678", "0.4941747", "0.4933574", "0.49183306", "0.48967957", "0.48759273", "0.48689747", "0.4833687...
0.8032128
0
isMethodName returns the identifier to use for methods that determine if a property holds a specific Kind of value.
func (p *PropertyGenerator) isMethodName(i int) string { return fmt.Sprintf("%s%s", isMethod, p.kindCamelName(i)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MethodName(ctx context.Context) (string, bool) {\n\tname, ok := ctx.Value(MethodNameKey).(string)\n\treturn name, ok\n}", "func (p *PropertyGenerator) hasMemberName(i int) string {\n\tif len(p.Kinds) == 1 && p.Kinds[0].Nilable {\n\t\tpanic(\"PropertyGenerator.hasMemberName called for nilable single value\")...
[ "0.63787496", "0.5801562", "0.57505494", "0.5694409", "0.54987735", "0.5240616", "0.52405995", "0.516242", "0.5138985", "0.51147056", "0.5100469", "0.5066037", "0.5008488", "0.50017124", "0.49543118", "0.49518663", "0.49440968", "0.493926", "0.49308324", "0.49267986", "0.4905...
0.7992452
0
NewObserver creates an Observer.
func NewObserver() *Observer { return &Observer{ close: make(chan interface{}), events: make(chan Event), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewObserver() Observer {\n\to := observerI{\n\t\tcontrol: NewControl(),\n\t\tstate: NewState(),\n\t}\n\treturn &o\n}", "func newObserver() observerSubComponent {\n\treturn observerSubComponent{subscribed: make(chan struct{})}\n}", "func newObserver() *observerManager {\n\treturn &observerManager{eventRe...
[ "0.7711109", "0.75819886", "0.75644934", "0.7375693", "0.73564756", "0.73259735", "0.6568613", "0.6489884", "0.5951068", "0.5872103", "0.57320786", "0.5586143", "0.5582653", "0.54472643", "0.54084337", "0.5353951", "0.5333283", "0.5277642", "0.5267369", "0.5256169", "0.520833...
0.8069668
0
AddTracepoint adds a tracepoint to watch for.
func (o *Observer) AddTracepoint(name string) EventSource { source := atomic.AddUint32(&o.nextEventSource, 1) o.tracepoints = append(o.tracepoints, tracepointData{ source: EventSource(source), tp: newTracepoint(name), }) return EventSource(source) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *Adapter) AppendTracePoint(ctx context.Context, point string) context.Context {\n\n\tpath := ctx.Value(internal.TraceKey)\n\tif path == nil {\n\t\treturn context.WithValue(ctx, internal.TraceKey, point)\n\t}\n\n\treturn context.WithValue(ctx, internal.TraceKey, path.(string)+\">\"+point)\n}", "func (trac...
[ "0.6792124", "0.6600053", "0.6467869", "0.61718845", "0.6105358", "0.6105242", "0.6003997", "0.5800444", "0.5792138", "0.57220936", "0.55519444", "0.5463996", "0.54356086", "0.5391821", "0.53791606", "0.5247522", "0.52444345", "0.51920646", "0.51866347", "0.5098904", "0.50886...
0.75101924
0
Open finish initializing the observer. From then on, events can be received with ReadEvent().
func (o *Observer) Open() error { var err error defer func() { if err != nil { o.Close() } }() for _, data := range o.tracepoints { tp := data.tp source := data.source if err = tp.open(); err != nil { return err } o.wg.Add(1) go func(tp *tracepoint, source EventSource) { // TODO(damien): should we hide the implementation details into the // tracepoint object and have it provide a channel? for { var nFds int nFds, err = tp.perf.poll(-1) if err != nil { break } if nFds == 0 { break } tp.perf.read(func(msg *perfEventSample, cpu int) { event := &TracepointEvent{ baseEvent: baseEvent{ source: source, }, tp: tp, data: msg.DataCopy(), } o.events <- event }, nil) } o.wg.Done() }(tp, source) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ml *ManagedListener) Open() {\n\tif ml != nil {\n\t\tdefer trace.Tracer.ScopedTrace()()\n\t\tgo ml.Listening()\n\t\tgo ml.PipeMapHandler()\n\t\tml.SetExternalIP()\n\t}\n}", "func (p *Session) OnOpen() {\n\tlevel.Debug(p.logger).Log(\"msg\", \"Session open\")\n\tp.open = true\n}", "func (w *BaseWebsocketC...
[ "0.53760797", "0.5362118", "0.5345924", "0.5270055", "0.51369935", "0.5100342", "0.5030275", "0.5008346", "0.49783102", "0.4963551", "0.49593344", "0.49556515", "0.4924003", "0.4921151", "0.49051183", "0.48950952", "0.48911303", "0.48776537", "0.4828525", "0.48275527", "0.482...
0.5445749
0
ReadEvent returns one event. This call blocks until an event is received.
func (o *Observer) ReadEvent() (Event, error) { select { case <-o.close: return nil, nil case event := <-o.events: return event, nil } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Replayer) ReadEvent() ([]byte, error) {\n\treturn nil, errors.New(\"implement me\")\n}", "func (s *socket) readEvent() (ev *event, identity string, err error) {\n\tvar arr [][]byte\n\tfor {\n\t\tarr, err = s.sock.RecvMessageBytes(0)\n\t\tif err != nil {\n\t\t\tif IsIntr(err) {\n\t\t\t\tcontinue\n\t\t\t}...
[ "0.75224715", "0.71742326", "0.7055589", "0.70353913", "0.693923", "0.65400624", "0.6534028", "0.64399385", "0.64246523", "0.64016706", "0.63070196", "0.6302457", "0.6208788", "0.60944873", "0.6058736", "0.60077566", "0.5945246", "0.59324604", "0.5926525", "0.59069055", "0.59...
0.79893905
0
Close frees precious resources acquired during Open.
func (o *Observer) Close() { close(o.close) for _, data := range o.tracepoints { data.tp.close() } o.wg.Wait() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Close() {\n\tlog4go.Debug(\"resources destroy, pid:%v\", os.Getpid())\n\tfor name, r := range resources {\n\t\terr := r.Close()\n\t\tif err != nil {\n\t\t\tlog4go.Error(\"resources[%s] destroy failed:%s\", name, err.Error())\n\t\t} else {\n\t\t\tlog4go.Info(\"resources[%s] destroy finish\", name)\n\t\t}\n\t}\...
[ "0.70326054", "0.69266677", "0.688963", "0.68719864", "0.6869171", "0.6841722", "0.6823956", "0.68207794", "0.6757346", "0.66874796", "0.6682152", "0.6643168", "0.6635908", "0.6625342", "0.6621565", "0.65806895", "0.6564526", "0.6550202", "0.65330064", "0.6532063", "0.6505968...
0.0
-1
Handler is your Lambda function handler It uses Amazon API Gateway request/responses provided by the awslambdago/events package, However you could use other event sources (S3, Kinesis etc), or JSONdecoded primitive types such as 'string'.
func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { log.Printf("Processing Lambda request %s\n", request.RequestContext.RequestID) r := &UpdateRecipeRequest{} err := json.Unmarshal([]byte(request.Body), r) if err != nil { fmt.Printf("Could not parse body: %v.\n", request.Body) return apigateway.ResponseUnsuccessful(400), err } user, err := apigateway.GetOrCreateAuthenticatedUser(context.TODO(), &request) if err != nil { return apigateway.ResponseUnsuccessful(401), errAuth } err = user.SetNickname(context.TODO(), r.Nickname) if err != nil { return apigateway.ResponseUnsuccessful(500), err } user, err = apigateway.GetOrCreateAuthenticatedUser(context.TODO(), &request) if err != nil { return apigateway.ResponseUnsuccessful(500), err } response := &User{ Nickname: user.Nickname, } resp := apigateway.ResponseSuccessful(response) return resp, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\tbodyEvent := MyEvent{}\n\n\t// Unmarshal the json, return 404 if error\n\terr := json.Unmarshal([]byte(request.Body), &bodyEvent)\n\tif err != nil {\n\t\tlog.Println(\"Failed run: \", err)\n\t\treturn events.APIGatew...
[ "0.766076", "0.7161317", "0.71571386", "0.71170986", "0.7070348", "0.70669854", "0.68084574", "0.6743597", "0.67253304", "0.6682846", "0.66808885", "0.66783696", "0.6599853", "0.6586483", "0.6562023", "0.6460615", "0.6458485", "0.64516455", "0.6448203", "0.64179105", "0.64151...
0.62811965
24
GetBitmarkFullProvenance returns the provenance for a bitmark.
func (bc *BitmarkdRPCClient) GetBitmarkFullProvenance(bitmarkID string) (json.RawMessage, error) { args := FullProvenanceArguments{Id: bitmarkID} var reply json.RawMessage err := bc.call("Bitmark.FullProvenance", &args, &reply) return reply, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (B *block) GetProof() uint64{\n\treturn B.proof\n}", "func CommitSetProvenance(tx *pachsql.Tx, id string) (_ []*pfs.Commit, retErr error) {\n\tq := `\n WITH RECURSIVE prov(from_id, to_id) AS (\n SELECT from_id, to_id\n FROM pfs.commit_provenance JOIN pfs.commits ON int_id = fr...
[ "0.52348286", "0.51490366", "0.5113172", "0.4997171", "0.4847204", "0.47232407", "0.4657581", "0.46153545", "0.45631856", "0.45515525", "0.4539305", "0.44959685", "0.44850057", "0.44723567", "0.44576582", "0.44439232", "0.44069716", "0.43944812", "0.43484256", "0.4348069", "0...
0.8551878
0
NewServer create a new server from config.
func NewServer() *Server { return &Server{ Config: Config{ Port: ":8080", }, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateServer(serverConfig ServerConfig) {\n\n}", "func newServerConfig(fname, id, name, passWord, serverKey string) (err error) {\n\tconfig := Config{\n\t\tid,\n\t\tname,\n\t\t\"server\",\n\t\tpassWord,\n\t\tserverKey,\n\t\tDEFAULT_SERVER_URL,\n\t\tDEFAULT_PROCESS_USER,\n\t\tDEFAULT_PROCESS_LOCK,\n\t\tDEFAU...
[ "0.7811237", "0.7764696", "0.7535014", "0.75244015", "0.74420565", "0.74216586", "0.74212766", "0.74102414", "0.73964494", "0.7378999", "0.73770344", "0.7368471", "0.73329574", "0.732273", "0.72975177", "0.7266847", "0.7214578", "0.72017103", "0.7195584", "0.71932244", "0.716...
0.671589
82
Serve starts listen http requests
func (g *Server) Serve() { addr := g.Config.Port fmt.Printf("======= Server start to listen (%s) and serve =======\n", addr) router := api.Router() if g.Config.GinMode != "" { gin.SetMode(g.Config.GinMode) } router.Run(addr) //router.Run("localhost:8081") //fmt.Println(router.ListenAndServe("addr", nil)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func serve(app *app.CallMe) {\n\thandlers.Register(app)\n\n\tapp.Logger.Info(\n\t\t\"Ready to ListenIP\",\n\t\tzap.Int(\"ListenPort\", app.ListenPort),\n\t\tzap.String(\"IP\", app.ListenIP),\n\t)\n\n\tlistenOn := fmt.Sprintf(\"%s:%d\", app.ListenIP, app.ListenPort)\n\terr := http.ListenAndServe(listenOn, nil)\n\ti...
[ "0.75120056", "0.7396767", "0.7344083", "0.7253987", "0.7183266", "0.7157515", "0.71549964", "0.71036255", "0.7091944", "0.7050944", "0.70465475", "0.7025634", "0.6992546", "0.69904816", "0.6976752", "0.69607323", "0.69219106", "0.6920594", "0.69188297", "0.69120854", "0.6902...
0.0
-1
NewDataTierPhaseStatistics provides a builder for the DataTierPhaseStatistics struct.
func NewDataTierPhaseStatisticsBuilder() *DataTierPhaseStatisticsBuilder { r := DataTierPhaseStatisticsBuilder{ &DataTierPhaseStatistics{}, } return &r }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (rb *DataTierPhaseStatisticsBuilder) Build() DataTierPhaseStatistics {\n\treturn *rb.v\n}", "func NewPhase(name string, message string) *Phase {\n\treturn &Phase{\n\t\tName: name,\n\t\tMessage: message,\n\t}\n}", "func NewTeamSummary()(*TeamSummary) {\n m := &TeamSummary{\n }\n m.SetAdditional...
[ "0.57236797", "0.45517826", "0.4494954", "0.43212146", "0.4309284", "0.428232", "0.42726636", "0.42556655", "0.42099604", "0.415489", "0.41452116", "0.41152003", "0.40808597", "0.402319", "0.4019133", "0.39678004", "0.3950337", "0.39278656", "0.3925215", "0.3925215", "0.39166...
0.76253456
0
Build finalize the chain and returns the DataTierPhaseStatistics struct
func (rb *DataTierPhaseStatisticsBuilder) Build() DataTierPhaseStatistics { return *rb.v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewDataTierPhaseStatisticsBuilder() *DataTierPhaseStatisticsBuilder {\n\tr := DataTierPhaseStatisticsBuilder{\n\t\t&DataTierPhaseStatistics{},\n\t}\n\n\treturn &r\n}", "func (h *AuditLogHandler) FinalizeChain() {\n\th.mutex.Lock()\n\tdefer h.mutex.Unlock()\n\n\tsendServiceLogs()\n}", "func (apd allProvide...
[ "0.51984656", "0.45179856", "0.44725284", "0.43698466", "0.43081263", "0.42829627", "0.42640367", "0.42626828", "0.4221998", "0.41837263", "0.41567776", "0.4145062", "0.41339555", "0.41277158", "0.41120148", "0.41047356", "0.40916216", "0.40905172", "0.40824333", "0.4080839", ...
0.6213985
0
Make sure that existing stream widgets are discarded if the user loads a new pcap.
func (t ManageCapinfoCache) OnNewSource(pcap.HandlerCode, gowid.IApp) { clearCapinfoState() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UnsetFrameCapture() {\n\tframeCapture = false\n}", "func (display *WebDisplay) Dispose() {\n}", "func (source *ipv6IpamSource) stop() {\n\tsource.sink = nil\n}", "func discard(link rtuLink) {\n\tvar rxbuf\t= make([]byte, 1024)\n\n\tlink.SetDeadline(time.Now().Add(time.Millisecond))\n\tlink.Read(rxbuf)\n...
[ "0.4875311", "0.4577949", "0.45520076", "0.45394555", "0.451178", "0.4460268", "0.4458511", "0.4397703", "0.4373493", "0.4372276", "0.4339298", "0.432843", "0.42901286", "0.42819107", "0.42766505", "0.425816", "0.42542195", "0.42340013", "0.4219898", "0.42111307", "0.42110485...
0.47030228
1
Setup establishes connection to the origin Postgres server.
func (s *Server) Setup() error { if s.Logger == nil { s.Logger = log.New(os.Stderr, "", log.LstdFlags) } s.Printf("Connecting to origin at %s...", s.OriginHost) origin, err := connect.Connect(s.OriginHost) if err != nil { s.Fatalf("Failed to connect to origin '%s': %v", s.OriginHost, err) } opts := map[string]string{} startupMsg := protocol.CreateStartupMessage(s.OriginUsername, s.OriginDatabase, opts) origin.Write(startupMsg) response := make([]byte, 4096) if _, err = origin.Read(response); err != nil { return fmt.Errorf("error connecting to '%s': %v", s.OriginHost, err) } if authd := connect.HandleAuthenticationRequest(origin, response); !authd { return fmt.Errorf("Origin authentication failed") } s.Printf("Successfully connected to origin '%s'", s.OriginHost) s.originPool = make(Pool, 20) s.originPool.Add(origin) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Setup(\n\tuser, password, host, dbname string,\n) (\n\tret PostgresProvider, err error,\n) {\n\tret = PostgresProvider{\n\t\tHost: host,\n\t\tUser: user,\n\t\tPassword: password,\n\t\tDBName: dbname,\n\t}\n\tlog.Println(\"Logging into\", dbname)\n\tdb1, err := sql.Open(\n\t\t\"postgres\",\n\t\t//\"p...
[ "0.69815296", "0.6885746", "0.6795049", "0.6725712", "0.67107564", "0.66614467", "0.6627048", "0.6595209", "0.6581932", "0.64448744", "0.6395758", "0.6352034", "0.6335457", "0.62626743", "0.6261324", "0.6251626", "0.62340814", "0.62294436", "0.6219777", "0.62196755", "0.62103...
0.60257894
31
Start begins listening for client connections and proxies them to the Origin.
func (s *Server) Start(stopCh <-chan struct{}) (err error) { s.Print("Starting server...") s.lis, err = net.Listen("tcp", s.ServerHost) if err != nil { return err } s.Printf("Listening on %s", s.ServerHost) for { select { case <-stopCh: break default: conn, err := s.lis.Accept() if err != nil { return err } if conn != nil { go s.HandleConnection(conn) } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Server) Start() {\n\tvar err error\n\ts.listener, err = net.Listen(\"tcp\", s.addr)\n\tif err != nil {\n\t\tservLogger.Fatal(err)\n\t}\n\n if s.credential != \"\" {\n servLogger.Infof(\"use %s for auth\\n\", s.credential)\n }\n\tservLogger.Infof(\"proxy listen in %s, waiting for connection......
[ "0.75999963", "0.75512546", "0.7463912", "0.7431335", "0.7222038", "0.720096", "0.6901696", "0.68746305", "0.6860362", "0.683905", "0.68183726", "0.6795194", "0.67091537", "0.6708329", "0.67044413", "0.67020655", "0.6701726", "0.670116", "0.6652177", "0.660221", "0.6591193", ...
0.59322196
98
NewPlanner returns a new instance of Planner.
func NewPlanner(db DB) *Planner { return &Planner{ DB: db, Now: time.Now, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPlanner() Planner {\n\treturn &simplePlanner{}\n}", "func NewPlanner(ctx *Context) *PlannerDefault {\n\tp := &PlannerDefault{\n\t\tCtx: ctx,\n\t\tchildren: make([]Task, 0),\n\t}\n\tp.Planner = p\n\treturn p\n}", "func NewPlanner()(*Planner) {\n m := &Planner{\n Entity: *NewEntity(),\n ...
[ "0.8373297", "0.78956974", "0.7884329", "0.76004404", "0.74583673", "0.6844997", "0.68093985", "0.66071105", "0.6360136", "0.63401043", "0.63401043", "0.61766195", "0.6119623", "0.6067652", "0.59924793", "0.593622", "0.5857521", "0.5767704", "0.57149994", "0.5667879", "0.5596...
0.8417653
0
normalizeDimensions extacts the time interval, if specified. Returns all remaining dimensions.
func (p *Planner) normalizeDimensions(dimensions Dimensions) (time.Duration, []string, error) { // Ignore if there are no dimensions. if len(dimensions) == 0 { return 0, nil, nil } // If the first dimension is a "time(duration)" then extract the duration. if call, ok := dimensions[0].Expr.(*Call); ok && strings.ToLower(call.Name) == "time" { // Make sure there is exactly one argument. if len(call.Args) != 1 { return 0, nil, errors.New("time dimension expected one argument") } // Ensure the argument is a duration. lit, ok := call.Args[0].(*DurationLiteral) if !ok { return 0, nil, errors.New("time dimension must have one duration argument") } return lit.Val, dimensionKeys(dimensions[1:]), nil } return 0, dimensionKeys(dimensions), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func normalizeCloudWatchAlarmDimensions(alarmDimensions *cloudformation.CloudWatchAlarmDimensionList) *cloudformation.CloudWatchAlarmDimensionList {\n\tif alarmDimensions == nil || len(*alarmDimensions) == 0 {\n\t\treturn &cloudformation.CloudWatchAlarmDimensionList{\n\t\t\t{\n\t\t\t\tName: cloudformation.String(...
[ "0.5863255", "0.5593285", "0.5458185", "0.4924116", "0.48919064", "0.48581466", "0.48396584", "0.478796", "0.4781289", "0.47482437", "0.47061297", "0.4702259", "0.46973515", "0.4674829", "0.4665495", "0.46614796", "0.46198478", "0.45599985", "0.4545783", "0.4512009", "0.44849...
0.7111008
0
planField returns a processor for field.
func (p *Planner) planField(e *Executor, f *Field) (processor, error) { return p.planExpr(e, f.Expr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Planner) planCall(e *Executor, c *Call) (processor, error) {\n\t// Ensure there is a single argument.\n\tif len(c.Args) != 1 {\n\t\treturn nil, fmt.Errorf(\"expected one argument for %s()\", c.Name)\n\t}\n\n\t// Ensure the argument is a variable reference.\n\tref, ok := c.Args[0].(*VarRef)\n\tif !ok {\n\t...
[ "0.5850106", "0.5793708", "0.56735563", "0.55634314", "0.5539706", "0.55268276", "0.5526053", "0.54968065", "0.54968065", "0.54968065", "0.5472559", "0.5347481", "0.5298575", "0.5290777", "0.5278102", "0.52667516", "0.5232726", "0.52285284", "0.52179766", "0.5164068", "0.5136...
0.7988916
0
planExpr returns a processor for an expression.
func (p *Planner) planExpr(e *Executor, expr Expr) (processor, error) { switch expr := expr.(type) { case *VarRef: panic("TODO") case *Call: return p.planCall(e, expr) case *BinaryExpr: return p.planBinaryExpr(e, expr) case *ParenExpr: return p.planExpr(e, expr.Expr) case *NumberLiteral: return newLiteralProcessor(expr.Val), nil case *StringLiteral: return newLiteralProcessor(expr.Val), nil case *BooleanLiteral: return newLiteralProcessor(expr.Val), nil case *TimeLiteral: return newLiteralProcessor(expr.Val), nil case *DurationLiteral: return newLiteralProcessor(expr.Val), nil } panic("unreachable") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *ExecutionPlanner) compileExpr(expr parser.Expr) (_ types.PlanExpression, err error) {\n\tif expr == nil {\n\t\treturn nil, nil\n\t}\n\n\tswitch expr := expr.(type) {\n\tcase *parser.BinaryExpr:\n\t\treturn p.compileBinaryExpr(expr)\n\n\tcase *parser.BoolLit:\n\t\treturn newBoolLiteralPlanExpression(expr.V...
[ "0.6671298", "0.63801324", "0.56326646", "0.5561662", "0.5532963", "0.5225251", "0.52004224", "0.51350623", "0.51319087", "0.50917375", "0.5091232", "0.5029617", "0.49621376", "0.49549094", "0.49485353", "0.49356198", "0.49250898", "0.49079174", "0.49051112", "0.48947218", "0...
0.79593897
0
planCall generates a processor for a function call.
func (p *Planner) planCall(e *Executor, c *Call) (processor, error) { // Ensure there is a single argument. if len(c.Args) != 1 { return nil, fmt.Errorf("expected one argument for %s()", c.Name) } // Ensure the argument is a variable reference. ref, ok := c.Args[0].(*VarRef) if !ok { return nil, fmt.Errorf("expected field argument in %s()", c.Name) } // Extract the substatement for the call. sub, err := e.stmt.Substatement(ref) if err != nil { return nil, err } name := sub.Source.(*Measurement).Name // Extract tags from conditional. tags := make(map[string]string) condition, err := p.extractTags(name, sub.Condition, tags) if err != nil { return nil, err } sub.Condition = condition // Find field. fname := strings.TrimPrefix(ref.Val, name+".") fieldID, typ := e.db.Field(name, fname) if fieldID == 0 { return nil, fmt.Errorf("field not found: %s.%s", name, fname) } // Generate a reducer for the given function. r := newReducer(e) r.stmt = sub // Retrieve a list of series data ids. seriesIDs := p.DB.MatchSeries(name, tags) // Generate mappers for each id. r.mappers = make([]*mapper, len(seriesIDs)) for i, seriesID := range seriesIDs { m := newMapper(e, seriesID, fieldID, typ) m.min, m.max = e.min.UnixNano(), e.max.UnixNano() m.interval = int64(e.interval) m.key = append(make([]byte, 8), marshalStrings(p.DB.SeriesTagValues(seriesID, e.tags))...) r.mappers[i] = m } // Set the appropriate reducer function. switch strings.ToLower(c.Name) { case "count": r.fn = reduceSum for _, m := range r.mappers { m.fn = mapCount } case "sum": r.fn = reduceSum for _, m := range r.mappers { m.fn = mapSum } default: return nil, fmt.Errorf("function not found: %q", c.Name) } return r, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *TimeLine) Plan(nbars, num, denom uint32, callback func(delta int32)) {\n\t/*\n\t 1. calc the abs position for the callback by using forward\n\t 2. rewind cursor\n\t 3. register callback\n\t 4. sort planned callbacks\n\t*/\n\n\tsavedCursor := t.cursor\n\tt.forwardIgnoringCallbacks(nbars, num, denom...
[ "0.5957647", "0.5939454", "0.5878916", "0.5844865", "0.578538", "0.5709484", "0.5678076", "0.55843925", "0.5496034", "0.5492764", "0.54183", "0.5409136", "0.5385073", "0.53798765", "0.5378616", "0.53784394", "0.5343292", "0.5333596", "0.5331891", "0.5302641", "0.5196999", "...
0.769013
0
planBinaryExpr generates a processor for a binary expression. A binary expression represents a join operator between two processors.
func (p *Planner) planBinaryExpr(e *Executor, expr *BinaryExpr) (processor, error) { // Create processor for LHS. lhs, err := p.planExpr(e, expr.LHS) if err != nil { return nil, fmt.Errorf("lhs: %s", err) } // Create processor for RHS. rhs, err := p.planExpr(e, expr.RHS) if err != nil { return nil, fmt.Errorf("rhs: %s", err) } // Combine processors. return newBinaryExprEvaluator(e, expr.Op, lhs, rhs), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newBinaryExprEvaluator(e *Executor, op Token, lhs, rhs processor) *binaryExprEvaluator {\n\treturn &binaryExprEvaluator{\n\t\texecutor: e,\n\t\top: op,\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\tc: make(chan map[string]interface{}, 0),\n\t\tdone: make(chan chan struct{}, 0),\n\t}\n}", "fu...
[ "0.66887915", "0.62147105", "0.61825645", "0.5908567", "0.58572567", "0.5844639", "0.5791973", "0.57730836", "0.57260466", "0.56870455", "0.5641738", "0.5616734", "0.55070674", "0.5478003", "0.54041564", "0.53786176", "0.5364959", "0.52595145", "0.5206847", "0.51054", "0.5102...
0.79556304
0
extractTags extracts a tag key/value map from a statement. Extracted tags are removed from the statement.
func (p *Planner) extractTags(name string, expr Expr, tags map[string]string) (Expr, error) { // TODO: Refactor into a walk-like Replace(). switch expr := expr.(type) { case *BinaryExpr: // If the LHS is a variable ref then check for tag equality. if lhs, ok := expr.LHS.(*VarRef); ok && expr.Op == EQ { return p.extractBinaryExprTags(name, expr, lhs, expr.RHS, tags) } // If the RHS is a variable ref then check for tag equality. if rhs, ok := expr.RHS.(*VarRef); ok && expr.Op == EQ { return p.extractBinaryExprTags(name, expr, rhs, expr.LHS, tags) } // Recursively process LHS. lhs, err := p.extractTags(name, expr.LHS, tags) if err != nil { return nil, err } expr.LHS = lhs // Recursively process RHS. rhs, err := p.extractTags(name, expr.RHS, tags) if err != nil { return nil, err } expr.RHS = rhs return expr, nil case *ParenExpr: e, err := p.extractTags(name, expr.Expr, tags) if err != nil { return nil, err } expr.Expr = e return expr, nil default: return expr, nil } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Extract(ctx context.Context) *Tags {\n\tt, ok := ctx.Value(ctxMarkerKey).(*Tags)\n\tif !ok {\n\t\treturn &Tags{values: make(map[string]interface{})}\n\t}\n\n\treturn t\n}", "func (r serverResult) ExtractTags() ([]string, error) {\n\tvar s struct {\n\t\tTags []string `json:\"tags\"`\n\t}\n\terr := r.ExtractI...
[ "0.60839343", "0.5574362", "0.54821146", "0.54010403", "0.5383956", "0.52683496", "0.5214607", "0.51167417", "0.50469804", "0.5004287", "0.4941273", "0.49274534", "0.49254033", "0.4903882", "0.48592663", "0.48080933", "0.47623283", "0.47225463", "0.4713999", "0.47138765", "0....
0.60490483
1
extractBinaryExprTags extracts a tag key/value map from a statement.
func (p *Planner) extractBinaryExprTags(name string, expr Expr, ref *VarRef, value Expr, tags map[string]string) (Expr, error) { // Ignore if the value is not a string literal. lit, ok := value.(*StringLiteral) if !ok { return expr, nil } // Extract the key and remove the measurement prefix. key := strings.TrimPrefix(ref.Val, name+".") // If tag is already filtered then return error. if _, ok := tags[key]; ok { return nil, fmt.Errorf("duplicate tag filter: %s.%s", name, key) } // Add tag to the filter. tags[key] = lit.Val // Return nil to remove the expression. return nil, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Planner) extractTags(name string, expr Expr, tags map[string]string) (Expr, error) {\n\t// TODO: Refactor into a walk-like Replace().\n\tswitch expr := expr.(type) {\n\tcase *BinaryExpr:\n\t\t// If the LHS is a variable ref then check for tag equality.\n\t\tif lhs, ok := expr.LHS.(*VarRef); ok && expr.Op ...
[ "0.51212686", "0.47047538", "0.46467358", "0.4614326", "0.4610041", "0.45031175", "0.4482802", "0.44662812", "0.44048113", "0.44041216", "0.43895322", "0.4388696", "0.4372503", "0.4370029", "0.4338746", "0.43042067", "0.42618737", "0.42575216", "0.425162", "0.42440602", "0.42...
0.77033806
0