text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *Config) VrfLabel() uint32 {
return uint32(c.Node.NId) + c.Node.Label
} | [
0.37626832723617554,
-0.3166496455669403,
0.4712989330291748,
-0.894341230392456,
0.18148766458034515,
0.7090939283370972,
-0.3594764173030853,
-0.6458520889282227,
0.12419590353965759,
0.3815346658229828,
-0.6808449625968933,
0.4719347357749939,
-0.8965760469436646,
-0.7249687910079956,
... |
func ReadConfig(path string, cfg *Config) error {
_, err := toml.DecodeFile(path, cfg)
if err != nil {
return err
}
if cfg.Ribs.Bgp.Port == 0 {
cfg.Ribs.Bgp.Port = GoBGPdGrpcPort
}
if cfg.Ribs.Nexthops.Args == "" {
cfg.Ribs.Nexthops.Args = VirtNexthops
}
return nil
} | [
0.22461314499378204,
0.22459165751934052,
0.5244463086128235,
0.0891815572977066,
0.1704374998807907,
0.3508833944797516,
0.11572178453207016,
1.022663950920105,
-0.9076956510543823,
0.6536115407943726,
0.5925728678703308,
0.4936498701572418,
-0.31802934408187866,
0.33931079506874084,
1.... |
func (l *Library) Patch(src *Library) {
if src.Name != "" {
l.Name = src.Name
}
if src.Description != "" {
l.Description = src.Description
}
if src.Version != "" {
l.Version = src.Version
}
} | [
-0.6763315200805664,
-0.8042974472045898,
0.03526800498366356,
-1.4986903667449951,
-0.32695314288139343,
1.2871463298797607,
-1.1693742275238037,
0.5552523732185364,
0.4875088632106781,
0.0614476203918457,
-0.7659991979598999,
0.5809539556503296,
-0.24713963270187378,
1.2258989810943604,
... |
func NewManager(client *rest.Client) *Manager {
return &Manager{
Client: client,
}
} | [
-0.06966868788003922,
-0.840725302696228,
-0.01850707270205021,
-0.26070111989974976,
-1.3406065702438354,
0.032827697694301605,
-1.1532453298568726,
-0.5352539420127869,
0.09988173097372055,
-0.9702431559562683,
0.022704025730490685,
0.20153439044952393,
-0.8208000063896179,
1.09740638732... |
func (c *Manager) FindLibrary(ctx context.Context, search Find) ([]string, error) {
url := c.Resource(internal.LibraryPath).WithAction("find")
spec := struct {
Spec Find `json:"spec"`
}{search}
var res []string
return res, c.Do(ctx, url.Request(http.MethodPost, spec), &res)
} | [
-1.733215570449829,
-0.4975210130214691,
0.21714262664318085,
-0.03399680182337761,
0.7884476780891418,
0.0364004485309124,
0.15742911398410797,
-1.2494843006134033,
-0.5902504324913025,
0.9743285179138184,
0.42728132009506226,
0.014501567929983139,
-1.1108258962631226,
1.3650689125061035,... |
func (c *Manager) CreateLibrary(ctx context.Context, library Library) (string, error) {
spec := struct {
Library Library `json:"create_spec"`
}{library}
path := internal.LocalLibraryPath
if library.Type == "SUBSCRIBED" {
path = internal.SubscribedLibraryPath
}
url := c.Resource(path)
var res string
return r... | [
-0.6541368365287781,
-0.5424509048461914,
0.39777010679244995,
-0.5158658623695374,
0.7473586201667786,
0.1791565865278244,
-0.06022830680012703,
-0.8080697655677795,
0.1361115276813507,
0.6951601505279541,
0.12912143766880035,
-0.1904640793800354,
-0.8414127230644226,
0.8702881932258606,
... |
func (c *Manager) DeleteLibrary(ctx context.Context, library *Library) error {
path := internal.LocalLibraryPath
if library.Type == "SUBSCRIBED" {
path = internal.SubscribedLibraryPath
}
url := c.Resource(path).WithID(library.ID)
return c.Do(ctx, url.Request(http.MethodDelete), nil)
} | [
-0.4219028651714325,
-0.5641844272613525,
0.26699912548065186,
-0.023756740614771843,
0.7264535427093506,
-0.05396789684891701,
0.09739293903112411,
-0.6920087337493896,
0.6596247553825378,
-0.2869461178779602,
0.29607680439949036,
0.49971380829811096,
-0.9647392630577087,
1.28763067722320... |
func (c *Manager) ListLibraries(ctx context.Context) ([]string, error) {
url := c.Resource(internal.LibraryPath)
var res []string
return res, c.Do(ctx, url.Request(http.MethodGet), &res)
} | [
-0.9173071384429932,
-0.6263654232025146,
0.11285684257745743,
-0.41437217593193054,
0.24101907014846802,
0.11421152949333191,
-0.5924745798110962,
-0.8417758345603943,
0.6888054013252258,
0.1410064697265625,
0.5019073486328125,
0.18246109783649445,
-1.1868841648101807,
0.4862312078475952,... |
func (c *Manager) GetLibraryByID(ctx context.Context, id string) (*Library, error) {
url := c.Resource(internal.LibraryPath).WithID(id)
var res Library
return &res, c.Do(ctx, url.Request(http.MethodGet), &res)
} | [
-0.37274113297462463,
-0.6013962030410767,
-0.30577269196510315,
-0.057734232395887375,
0.41417914628982544,
0.0028292941860854626,
0.11291807144880295,
-1.6140999794006348,
0.24515525996685028,
-0.10896100848913193,
-0.12596456706523895,
0.4706840515136719,
-0.7662385702133179,
0.36890038... |
func (c *Manager) GetLibraryByName(ctx context.Context, name string) (*Library, error) {
// Lookup by name
libraries, err := c.GetLibraries(ctx)
if err != nil {
return nil, err
}
for i := range libraries {
if libraries[i].Name == name {
return &libraries[i], nil
}
}
return nil, fmt.Errorf("library name ... | [
-0.0044908663257956505,
-0.6722322702407837,
0.011519208550453186,
-0.3993021249771118,
-0.04236648604273796,
-0.40390971302986145,
0.0942397192120552,
-1.4312105178833008,
0.006912501994520426,
0.7755963206291199,
0.025313379243016243,
-0.13661818206310272,
-0.8401938676834106,
0.26960894... |
func (c *Manager) GetLibraries(ctx context.Context) ([]Library, error) {
ids, err := c.ListLibraries(ctx)
if err != nil {
return nil, fmt.Errorf("get libraries failed for: %s", err)
}
var libraries []Library
for _, id := range ids {
library, err := c.GetLibraryByID(ctx, id)
if err != nil {
return nil, fm... | [
-0.8634846806526184,
-0.001774958218447864,
0.24335774779319763,
0.3091208040714264,
0.8675493597984314,
0.3189001679420471,
-0.44408416748046875,
-1.045234203338623,
0.7655450701713562,
-0.17585314810276031,
0.2893659472465515,
0.06095416471362114,
-0.9483816027641296,
0.975837230682373,
... |
func Encode(v interface{}) io.Reader {
reader, writer := io.Pipe()
go func() {
err := json.NewEncoder(writer).Encode(v)
if err != nil {
writer.CloseWithError(err)
} else {
writer.Close()
}
}()
return reader
} | [
-0.41456490755081177,
-0.4403674006462097,
0.5304695963859558,
-0.49884483218193054,
-0.7107782959938049,
-0.5785588026046753,
-0.2589229941368103,
-0.5634341835975647,
-0.21117152273654938,
0.2447330206632614,
1.1736077070236206,
0.6956816911697388,
-0.08600833266973495,
-0.31472736597061... |
func NewCircle(center geometry.Point, meters float64, steps int) *Circle {
if steps < 3 {
steps = 3
}
g := new(Circle)
g.center = center
g.meters = meters
g.steps = steps
if meters > 0 {
meters = geo.NormalizeDistance(meters)
g.haversine = geo.DistanceToHaversine(meters)
}
return g
} | [
1.0854415893554688,
0.3080522119998932,
0.27643609046936035,
0.46088770031929016,
-0.8422210216522217,
0.6928718686103821,
-0.20344823598861694,
0.1790708601474762,
-0.6004804968833923,
0.2572843134403229,
0.5805295705795288,
0.049127575010061264,
0.4264873266220093,
0.3605612814426422,
... |
func (g *Circle) Meters() float64 {
return g.meters
} | [
-0.5437461137771606,
-0.37276691198349,
-0.027647003531455994,
-0.7332534193992615,
-0.09268367290496826,
0.5782608985900879,
0.6349503397941589,
-0.8728636503219604,
0.09591910243034363,
-0.3749786913394928,
0.5017885565757751,
-0.5473658442497253,
-0.7904378771781921,
1.1117197275161743,... |
func (g *Circle) Center() geometry.Point {
return g.center
} | [
0.28753018379211426,
-0.10578736662864685,
0.07549916952848434,
0.24910907447338104,
0.14932268857955933,
0.5975310802459717,
0.5699690580368042,
-0.4176929295063019,
0.24146927893161774,
0.06158200278878212,
0.579121470451355,
0.664988100528717,
0.20136460661888123,
-0.4879927933216095,
... |
func (g *Circle) Haversine() float64 {
return g.haversine
} | [
0.8517429232597351,
0.3807573914527893,
0.2625610828399658,
-0.1744735985994339,
0.6259371042251587,
-0.32456836104393005,
-0.0831400603055954,
-0.537100076675415,
-1.1735060214996338,
-0.5549589991569519,
-0.1511809378862381,
-0.23661860823631287,
-0.7445767521858215,
0.43356767296791077,... |
func (g *Circle) HaversineTo(p geometry.Point) float64 {
return geo.Haversine(p.Y, p.X, g.center.Y, g.center.X)
} | [
0.4800471067428589,
0.1517685055732727,
0.5676360130310059,
-1.2237648963928223,
0.9059029817581177,
-0.20488464832305908,
-0.7721118330955505,
-0.438753217458725,
-0.7996551990509033,
0.3842620849609375,
-0.9693877100944519,
0.44146010279655457,
0.13162100315093994,
-0.06849737465381622,
... |
func (g *Circle) Within(obj Object) bool {
return obj.Contains(g)
} | [
-1.145790696144104,
-0.40437138080596924,
0.40388378500938416,
-0.434961199760437,
-1.3231483697891235,
1.018130898475647,
0.5371844172477722,
-1.13386869430542,
-0.1359539031982422,
-0.08430270850658417,
-0.3210383951663971,
0.2711993455886841,
-0.2695919871330261,
-0.35672613978385925,
... |
func (g *Circle) containsPoint(p geometry.Point) bool {
h := geo.Haversine(p.Y, p.X, g.center.Y, g.center.X)
return h <= g.haversine
} | [
0.5647935271263123,
-0.4467979669570923,
0.41540753841400146,
-0.3942137658596039,
-0.0034895571880042553,
1.1557636260986328,
-0.5664907693862915,
-0.21084637939929962,
0.40763431787490845,
-0.25224775075912476,
-0.04526692256331444,
-0.40757039189338684,
-0.6397662162780762,
-0.255277991... |
func (g *Circle) Contains(obj Object) bool {
switch other := obj.(type) {
case *Point:
return g.containsPoint(other.Center())
case *SimplePoint:
return g.containsPoint(other.Center())
case *Circle:
return other.Distance(g) < (other.meters + g.meters)
case Collection:
for _, p := range other.Children() {
... | [
0.006282825022935867,
-0.70956951379776,
0.6249850392341614,
0.012867200188338757,
-0.5102933645248413,
0.7946197390556335,
0.4123672544956207,
-1.517722487449646,
0.07445398718118668,
0.19374307990074158,
-0.3228408694267273,
0.12852193415164948,
0.19154319167137146,
0.09894499182701111,
... |
func (g *Circle) Intersects(obj Object) bool {
switch other := obj.(type) {
case *Point:
return g.containsPoint(other.Center())
case *Circle:
return other.Distance(g) <= (other.meters + g.meters)
case Collection:
for _, p := range other.Children() {
if g.Intersects(p) {
return true
}
}
return fa... | [
-0.49911531805992126,
-0.10682956874370575,
0.8134484887123108,
0.5325515270233154,
-0.13122668862342834,
0.5594395995140076,
-0.07110485434532166,
-0.8334929943084717,
-0.5142861008644104,
0.1430823653936386,
-0.21408164501190186,
-0.4438665807247162,
-0.07924915105104446,
0.0679279565811... |
func (g *Circle) Polygon() Object {
return g.getObject()
} | [
-0.6993511319160461,
-1.0899202823638916,
0.18425020575523376,
-0.18722748756408691,
-0.28006207942962646,
-0.15483291447162628,
1.1036678552627563,
-0.5439349412918091,
0.6959139704704285,
-0.7717145085334778,
-1.1820005178451538,
0.3948378264904022,
0.3123811185359955,
-1.231836676597595... |
func AesGcmEncrypt(plaintext string, additionalData []byte) (string, error) {
key, err := hex.DecodeString(conf.EncodingKey)
if err != nil {
return "", err
}
block, err := aes.NewCipher(key)
if err != nil {
return "", err
}
aesgcm, err := cipher.NewGCM(block)
if err != nil {
return "", err
}
iv := make(... | [
-0.17519494891166687,
0.7483495473861694,
0.677036464214325,
-1.0708792209625244,
-0.5564115643501282,
0.3058677911758423,
-0.22269056737422943,
-0.12374231219291687,
0.24715402722358704,
0.7292102575302124,
-0.27282220125198364,
-0.16492903232574463,
-1.0718469619750977,
0.546878516674041... |
func AesGcmDecrypt(encryptedString string, additionalData []byte) (string, error) {
key, err := hex.DecodeString(conf.EncodingKey)
if err != nil {
return "", err
}
block, err := aes.NewCipher(key)
if err != nil {
return "", err
}
aesgcm, err := cipher.NewGCM(block)
if err != nil {
return "", err
}
enc, ... | [
-0.03853337839245796,
0.4683299958705902,
0.8056928515434265,
-1.001523733139038,
-0.6221410036087036,
0.09939359873533249,
0.05753779783844948,
0.1463102549314499,
-0.17019470036029816,
0.09206733852624893,
-0.11989910155534744,
-0.17695076763629913,
-0.5343058109283447,
0.221569105982780... |
func Search(w http.ResponseWriter, r *http.Request) {
viewData := BaseViewData(w, r)
termMap := utils.GetSearchTermsForString(r.FormValue("q"), true)
terms := make([]string, len(termMap))
i := 0
for term := range termMap {
terms[i] = term
i++
}
pageNumStr := "1"
if len(r.FormValue("page")) > 0 {
pageNum... | [
-0.7827805876731873,
0.5211057662963867,
0.7010056376457214,
-0.7108065485954285,
-0.27343741059303284,
-0.05991676077246666,
0.5508202910423279,
0.7166098356246948,
0.35826990008354187,
-0.07579343765974045,
0.800491988658905,
-0.30612891912460327,
-0.05323100835084915,
0.6294620633125305... |
func runTestScenarios(t *testing.T, tests []testCase) {
runTestScenariosWithInput(t, tests, nil)
} | [
-0.5493432879447937,
-0.43877846002578735,
0.28066596388816833,
1.2733449935913086,
0.024149781093001366,
0.029791805893182755,
0.46283847093582153,
-0.037684448063373566,
0.14043442904949188,
0.12981367111206055,
-1.047807216644287,
-0.31239065527915955,
-0.04283792898058891,
0.7543064951... |
func runTestScenariosWithInput(t *testing.T, tests []testCase, input *os.File) {
runTestScenariosWithInputAndProcessedOutput(t, tests, input, nil)
} | [
-0.14726237952709198,
-1.2912113666534424,
0.3945009112358093,
0.9189631342887878,
-0.10902396589517593,
0.2809179127216339,
1.1474952697753906,
-0.06970913708209991,
-0.3096334934234619,
-0.03908606991171837,
-0.7630089521408081,
-0.008792078122496605,
-0.10194157809019089,
0.987037241458... |
func runTestScenariosWithInputAndProcessedOutput(t *testing.T, tests []testCase, input *os.File, processOutput processOutput) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
cmd := exec.Command(binaryPath, tc.args...)
if input != nil {
cmd.Stdin = input
}
output, err := cmd.Combine... | [
-0.16823652386665344,
-1.3099817037582397,
0.6137841939926147,
0.5063426494598389,
0.22104980051517487,
0.19509553909301758,
1.111863136291504,
-0.30213990807533264,
-0.3298848569393158,
-0.10520163923501968,
-0.27470526099205017,
-0.09387405961751938,
-0.35586610436439514,
0.5143110752105... |
func Test3LOFlow(t *testing.T) {
tests := []testCase{
{
"fetch; 3lo",
[]string{"fetch", "--scope", "pubsub", "--credentials", "integration/fixtures/fake-client-secrets.json", "--cache", ""},
"fetch-3lo.golden",
false,
},
{
"fetch; 3lo; old interface",
[]string{"fetch", "--json", "integration/fi... | [
1.107399344444275,
-0.12984614074230194,
0.7728754281997681,
-0.13120830059051514,
-0.03857587277889252,
0.19619901478290558,
0.09496119618415833,
-1.3238741159439087,
0.4803898334503174,
0.1197742149233818,
-0.7006385326385498,
0.18417440354824066,
0.3010924756526947,
0.07374018430709839,... |
func Test2LOFlow(t *testing.T) {
tests := []testCase{
{
"fetch; 2lo",
[]string{"fetch", "--scope", "pubsub", "--credentials", "integration/fixtures/fake-service-account.json", "--cache", ""},
"fetch-2lo.golden",
false,
},
{
"fetch; 2lo; old interface",
[]string{"fetch", "--json", "integration/f... | [
0.48933959007263184,
-0.13702721893787384,
0.84663325548172,
0.24609394371509552,
0.11924633383750916,
0.06150774657726288,
0.5433385372161865,
-0.5251372456550598,
0.1621713936328888,
-0.4423150420188904,
-0.505917489528656,
0.9210461974143982,
0.6872448921203613,
0.5928987264633179,
0.... |
func TestSSOFlow(t *testing.T) {
tests := []testCase{
{
"fetch; sso",
[]string{"fetch", "--type", "sso", "--email", "integration/fixtures/fake-ssocli.sh", "--scope", "pubsub", "--ssocli", "sh"},
"fetch-sso.golden",
false,
},
{
"fetch; sso; old interface",
[]string{"fetch", "--sso", "--ssocli", ... | [
0.5118377208709717,
0.4868074357509613,
0.44777384400367737,
0.6662082672119141,
0.6824321150779724,
0.1868409663438797,
0.3555481731891632,
-0.10544398427009583,
0.8534243106842041,
0.3704063594341278,
-0.48172539472579956,
0.41242092847824097,
0.7538133263587952,
0.7874423265457153,
0.... |
func TestServiceAccountImpersonationFlow(t *testing.T) {
tests := []testCase{
{
"fetch; sso; impersonation",
[]string{"fetch", "--type", "sso", "--email", "integration/fixtures/fake-ssocli.sh", "--scope", "pubsub", "--ssocli", "sh", "--impersonate-service-account", "12345"},
"fetch-impersonation.golden",
... | [
0.9598187208175659,
0.43553057312965393,
0.5402818322181702,
1.0083523988723755,
0.014305900782346725,
0.6914348006248474,
0.939201295375824,
0.11449971795082092,
1.063501000404358,
-0.03490346670150757,
-0.7371426224708557,
1.4238739013671875,
-0.08738864213228226,
0.2176961749792099,
0... |
func TestMain(m *testing.M) {
err := os.Chdir("..")
if err != nil {
fmt.Printf("could not change dir: %v", err)
os.Exit(1)
}
abs, err := filepath.Abs(binaryName)
if err != nil {
fmt.Printf("could not get abs path for %s: %v", binaryName, err)
os.Exit(1)
}
binaryPath = abs
if err := exec.Command("go"... | [
-0.6237127184867859,
-0.1348605751991272,
1.0254141092300415,
0.09054519981145859,
0.4085685610771179,
0.7945008873939514,
0.6288077235221863,
0.6027775406837463,
-0.7016118764877319,
-0.49744290113449097,
-0.2402426302433014,
0.8341119885444641,
-0.9115933775901794,
-0.15246263146400452,
... |
func NewBool(b bool) Bool {
return Bool{
NullBool: sql.NullBool{
Bool: b,
Valid: true,
},
}
} | [
1.261264443397522,
0.4191043972969055,
0.3074917495250702,
1.4844568967819214,
-0.6837174296379089,
0.08151718229055405,
-0.6744855642318726,
0.6207399964332581,
0.6688498854637146,
-0.03679313883185387,
-0.6388826370239258,
0.23532967269420624,
0.1721755713224411,
-0.4853217601776123,
-... |
func BoolFromPtr(b *bool) Bool {
if b == nil {
return NullBool()
}
return NewBool(*b)
} | [
1.27017080783844,
-0.5563585162162781,
0.31762343645095825,
0.602428674697876,
-1.0552724599838257,
0.27078092098236084,
-0.40246620774269104,
0.30537429451942444,
0.633490264415741,
0.4049270451068878,
-0.008945171721279621,
-0.26338231563568115,
-0.2421981692314148,
-0.12332452088594437,... |
func (b *Bool) UnmarshalText(text []byte) error {
str := string(text)
switch str {
case "", "null":
b.Valid = false
return nil
case "Y":
b.Bool = true
case "N":
b.Bool = false
default:
b.Valid = false
return errors.New("invalid input:" + str)
}
b.Valid = true
return nil
} | [
0.5738648176193237,
0.24102210998535156,
0.5648555159568787,
-0.20235593616962433,
-0.7831982374191284,
0.7164749503135681,
-0.2906407415866852,
0.9517801403999329,
0.2608475685119629,
0.697416365146637,
-0.044423237442970276,
-0.37920528650283813,
-0.8796761631965637,
-0.1479189097881317,... |
func (b Bool) MarshalJSON() ([]byte, error) {
if !b.Valid {
return []byte("null"), nil
}
if !b.Bool {
return []byte(`"N"`), nil
}
return []byte(`"Y"`), nil
} | [
-0.23542198538780212,
-0.059749942272901535,
0.4120645523071289,
0.4956117570400238,
-0.3888431191444397,
-0.13855072855949402,
-0.58673495054245,
0.6273177266120911,
0.4448705017566681,
1.15953528881073,
-0.8955485820770264,
0.7290542125701904,
-0.10529853403568268,
0.3862776756286621,
... |
func (b Bool) MarshalText() ([]byte, error) {
if !b.Valid {
return []byte{}, nil
}
if !b.Bool {
return []byte("N"), nil
}
return []byte("Y"), nil
} | [
-0.02806573174893856,
0.8181994557380676,
0.3529875576496124,
0.7480088472366333,
-0.4335898160934448,
0.03646240755915642,
-1.1654869318008423,
0.22291673719882965,
0.851972222328186,
0.9904761910438538,
-0.3319595158100128,
-0.0348854623734951,
-0.8131718635559082,
0.19038335978984833,
... |
func (b *Bool) SetValid(v bool) {
b.Bool = v
b.Valid = true
} | [
0.6146880984306335,
-0.2896757125854492,
0.29170748591423035,
1.2132319211959839,
-0.29100680351257324,
1.2121593952178955,
0.22443200647830963,
0.5493930578231812,
-0.3463284373283386,
0.006987556349486113,
-0.554872989654541,
0.6309022307395935,
0.11644750088453293,
-0.3159228265285492,
... |
func (b Bool) Ptr() *bool {
if !b.Valid {
return nil
}
return &b.Bool
} | [
0.5677342414855957,
0.4600293040275574,
0.2964325547218323,
1.2495744228363037,
-0.8627402186393738,
0.990647554397583,
-0.338128000497818,
-0.35488706827163696,
0.291869580745697,
0.42605966329574585,
0.9693289995193481,
0.25595971941947937,
-1.12057363986969,
0.12657159566879272,
0.570... |
func (b Bool) IsZero() bool {
return !b.Valid
} | [
-0.40062806010246277,
0.3923893868923187,
0.41615667939186096,
2.145662307739258,
0.39362281560897827,
0.3923987150192261,
-0.16597341001033783,
0.7306287884712219,
-0.36527153849601746,
0.0028281582053750753,
-0.2075398862361908,
0.003956337925046682,
-1.4090484380722046,
0.17665663361549... |
func NewOrganizationServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) OrganizationService {
if c, ok := client.(*http.Client); ok {
client = withoutRedirects(c)
}
clientOpts := twirp.ClientOptions{}
for _, o := range opts {
o(&clientOpts)
}
// Using ReadOpt allows backward... | [
-0.5793311595916748,
-0.30270200967788696,
0.5676761865615845,
-0.5710368156433105,
-0.09049679338932037,
-0.2575659155845642,
0.682744562625885,
-0.4458848237991333,
0.026744388043880463,
-0.17840981483459473,
-0.008032139390707016,
0.16360345482826233,
-0.562512218952179,
-0.162066146731... |
func NewOrganizationServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) OrganizationService {
if c, ok := client.(*http.Client); ok {
client = withoutRedirects(c)
}
clientOpts := twirp.ClientOptions{}
for _, o := range opts {
o(&clientOpts)
}
// Using ReadOpt allows backwards an... | [
-0.8395906686782837,
-0.6840367913246155,
0.5795702338218689,
-0.5664590001106262,
-0.7026121020317078,
-0.7470976710319519,
0.6814032196998596,
-0.6267608404159546,
-0.08074881136417389,
0.1699192225933075,
-0.036192577332258224,
0.017546238377690315,
-0.17302122712135315,
0.2969039380550... |
func NewOrganizationServiceServer(svc OrganizationService, opts ...interface{}) TwirpServer {
serverOpts := newServerOpts(opts)
// Using ReadOpt allows backwards and forwads compatibility with new options in the future
jsonSkipDefaults := false
_ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults)
jsonCam... | [
-1.4227513074874878,
-0.9768628478050232,
0.3111574649810791,
-1.107787847518921,
-0.3030047118663788,
-0.5611750483512878,
0.11819909512996674,
-0.3874571919441223,
0.2870556116104126,
0.24299363791942596,
0.06402044743299484,
-0.0008702457416802645,
-0.6284549236297607,
0.636974275112152... |
func (s *organizationServiceServer) PathPrefix() string {
return baseServicePath(s.pathPrefix, "buf.alpha.registry.v1alpha1", "OrganizationService")
} | [
0.037119630724191666,
-0.21962767839431763,
0.46976912021636963,
0.5557178854942322,
0.14936994016170502,
0.8600344657897949,
0.8789180517196655,
0.45055457949638367,
0.44957584142684937,
0.2729162871837616,
-0.003551788628101349,
0.4871576726436615,
-0.7917736172676086,
0.7308633923530579... |
func (d *DB) NextArticle(categoryID uint16, count int, user *User) (*Article, error) {
articles, err := d.Articles(categoryID, count, user)
if err != nil {
glog.Error(err)
return nil, err
}
for _, article := range articles {
score, alreadySeen := user.Items[article.ID.Hex()]
if !alreadySeen {
return arti... | [
0.3038382828235626,
-0.20329780876636505,
0.3682725131511688,
0.43454691767692566,
-0.7920932769775391,
-0.23931710422039032,
0.1493525207042694,
-0.8101885914802551,
-0.11115715652704239,
0.3157636523246765,
0.4427594244480133,
0.15259887278079987,
0.18305763602256775,
0.4046255052089691,... |
func (d *DB) NextUnseenArticle(user *User) (*Article, error) {
article := Article{}
usersSeen := []bson.ObjectId{}
for id, _ := range user.Items {
usersSeen = append(usersSeen, bson.ObjectIdHex(id))
}
err := d.Items.Find(bson.M{"_id": bson.M{"$nin": usersSeen}}).One(&article)
return &article, err
} | [
-0.5654422044754028,
0.05006898567080498,
0.48030000925064087,
-0.2632977068424225,
-1.4354876279830933,
0.12973839044570923,
-0.07918896526098251,
-0.15713894367218018,
-0.17137128114700317,
0.17021438479423523,
0.1774103343486786,
0.5479320883750916,
-0.09533637017011642,
0.2212285995483... |
func (d *DB) Articles(categoryID uint16, count int, user *User) ([]*Article, error) {
results := []*Article{}
query := bson.M{"categoryid": categoryID}
var iter *mgo.Iter
switch count {
case 0:
iter = d.Items.Find(query).Iter()
default:
iter = d.Items.Find(bson.M{"categoryid": categoryID}).Limit(count).Iter(... | [
-0.42021259665489197,
0.3291340470314026,
0.0828687846660614,
-0.09638214111328125,
0.5046299695968628,
-0.4703306257724762,
-0.335573673248291,
-0.07662935554981232,
-0.8381707668304443,
0.33663344383239746,
0.6952539086341858,
-0.5966585874557495,
-0.20552051067352295,
0.6677364110946655... |
func (d *DB) User(name string) (*User, error) {
user := User{}
err := d.Users.Find(bson.M{"name": name}).One(&user)
if err != nil {
glog.Error(err, name)
user := NewUser()
user.Name = name
err := d.Users.Insert(user)
if err != nil {
glog.Error(err)
return nil, err
}
}
return &user, nil
} | [
-0.7703819870948792,
0.47925102710723877,
0.5111077427864075,
0.04306809976696968,
0.059899285435676575,
0.07155515253543854,
1.1348904371261597,
-0.7871868014335632,
0.6338819861412048,
-0.2370113879442215,
-0.862604558467865,
-0.21058562397956848,
-0.06392038613557816,
-0.046870198100805... |
func (d *DB) GetCategories() ([]*Category, error) {
results := []*Category{}
var iter *mgo.Iter = d.Categories.Find(nil).Iter()
err := iter.All(&results)
return results, err
} | [
-0.17580704391002655,
0.732030987739563,
0.016118600964546204,
0.1984093338251114,
1.138641119003296,
-0.356087863445282,
-0.21838486194610596,
-0.514095664024353,
-0.08083463460206985,
-1.17181396484375,
0.4540322721004486,
-0.22381435334682465,
-1.0980734825134277,
1.5127333402633667,
... |
func (d *DB) InitCategories() {
d.Categories.RemoveAll(nil)
// Get latest categories.
categories, err := FeedzillaCategories()
if err != nil {
glog.Error(err)
return
}
for _, cat := range categories {
err := d.Categories.Insert(cat)
if err != nil {
glog.Error(err)
continue
}
glog.Infof("Loaded... | [
-0.4761677384376526,
0.8632286190986633,
0.5629890561103821,
-0.9672133922576904,
0.9553564786911011,
-0.5292695164680481,
0.23900359869003296,
-0.03306189924478531,
-0.2944697439670563,
-0.7025917768478394,
-0.3468654751777649,
-0.3265363574028015,
-0.11945544928312302,
1.0721588134765625... |
func (d *DB) itemUpdater(catogoryID uint16) {
articles, err := FeedzillaArticles(catogoryID, NumberToGet)
if err != nil {
glog.Error(err)
return
}
for _, art := range articles.List {
art.CategoryID = catogoryID
_, err := d.Items.Upsert(bson.M{"url": art.URL}, art)
if err != nil {
glog.Error(err)
co... | [
-1.0835039615631104,
-0.5918867588043213,
0.35685640573501587,
-0.6855427622795105,
-0.09428062289953232,
-0.08079983294010162,
0.2337024062871933,
0.5446470975875854,
-0.28364789485931396,
0.7797493934631348,
-0.5539102554321289,
-0.6092682480812073,
0.7517796754837036,
0.4144112467765808... |
func (d *DB) ItemUpdaterCron() {
for {
time.Sleep(time.Hour)
d.ItemUpdater()
}
} | [
-0.44843220710754395,
-1.2201204299926758,
0.4450083076953888,
0.12946398556232452,
0.23787790536880493,
0.6301285028457642,
-0.32214730978012085,
0.5619249939918518,
-0.6991523504257202,
0.6910045146942139,
-0.41048112511634827,
-0.18197335302829742,
-0.31055331230163574,
-0.0708500742912... |
func (d *DB) ItemUpdater() {
currentCategories, err := d.GetCategories()
if err != nil {
glog.Error(err)
return
}
i := 0
wg := &sync.WaitGroup{}
for _, category := range currentCategories {
i++
/*
if i > 10 {
break
}
*/
wg.Add(1)
go func(cat *Category) {
glog.Info("Getting category ", c... | [
-1.0730658769607544,
-0.2483835071325302,
0.6059263348579407,
-0.18604591488838196,
0.12434632331132889,
-0.2660198211669922,
0.19575366377830505,
0.27731698751449585,
-0.3394624590873718,
0.1875561773777008,
0.05945267155766487,
-0.8909855484962463,
0.381385862827301,
0.8749068379402161,
... |
func (c *comparables) Len() int {
return len(c.values)
} | [
0.7981752753257751,
0.155766561627388,
-0.09044139087200165,
-0.9469444155693054,
0.9630019664764404,
-0.017129898071289062,
0.7737849950790405,
0.36559292674064636,
-0.5960099697113037,
-0.5047759413719177,
-1.1813971996307373,
0.4563034772872925,
0.28018423914909363,
0.7820075154304504,
... |
func (c *comparables) Less(i, j int) bool {
return c.IsLess(c.values[i], c.values[j])
} | [
0.17592474818229675,
-0.007103082723915577,
0.04374886304140091,
-0.9710531830787659,
-0.31745538115501404,
0.0598805695772171,
-0.3166991174221039,
-1.2576665878295898,
-0.5596253275871277,
-0.6215181946754456,
-0.8141053915023804,
0.04678517207503319,
-0.5627560615539551,
0.6735818386077... |
func (c *comparables) Swap(i, j int) {
c.values[i], c.values[j] = c.values[j], c.values[i]
} | [
-0.7601554989814758,
-0.19562895596027374,
0.14716294407844543,
-0.5234957337379456,
0.2574847340583801,
0.46815812587738037,
0.11543568968772888,
-0.18720503151416779,
-0.8687838315963745,
-0.5846690535545349,
-0.44532713294029236,
0.7699689269065857,
0.19831107556819916,
-0.2264031767845... |
func (c *comparables) IsLess(a, b interface{}) bool {
return c.isLess(a, b)
} | [
0.4784078299999237,
-0.4223308265209198,
0.3047834038734436,
-0.9136579036712646,
-0.13225583732128143,
0.11607682704925537,
-1.2682825326919556,
-0.4044850170612335,
0.6069168448448181,
0.08647195994853973,
0.15535295009613037,
1.1145879030227661,
0.06803907454013824,
0.45236313343048096,... |
func (t *topK) Push(x interface{}) {
t.values = append(t.values, x)
} | [
-0.6988215446472168,
1.2077094316482544,
0.13709613680839539,
-0.13970792293548584,
-0.5021615624427795,
0.883493959903717,
-0.6487653851509094,
-0.7689480781555176,
-0.0924859270453453,
0.05798041820526123,
-1.0512034893035889,
0.5043450593948364,
0.872243344783783,
0.7580257654190063,
... |
func (t *topK) Pop() interface{} {
n := len(t.values)
x := t.values[n-1]
t.values = t.values[:n-1]
return x
} | [
-0.9373799562454224,
0.7234847545623779,
0.550173282623291,
-0.1380622535943985,
-0.8401173949241638,
0.32894670963287354,
0.2674727737903595,
-0.43225738406181335,
-0.4694365859031677,
0.7441193461418152,
-0.355633020401001,
-0.5270297527313232,
0.3798403739929199,
-0.4723650813102722,
... |
func (t *topK) Peek() interface{} {
return t.values[0]
} | [
-0.5388505458831787,
0.18409398198127747,
0.5742778182029724,
0.04423799738287926,
-0.6310169696807861,
0.07395520806312561,
-0.1537884622812271,
-1.1757187843322754,
-0.4231945276260376,
-0.2863405644893646,
-0.07399510592222214,
0.10711846500635147,
1.0503284931182861,
0.2588263750076294... |
func (t *topK) Get() []interface{} {
return t.values
} | [
-1.4130617380142212,
-0.020931586623191833,
0.4660693109035492,
0.037433166056871414,
0.25166431069374084,
0.44362303614616394,
-0.822672963142395,
-0.36807918548583984,
-0.612099289894104,
-0.37691932916641235,
-0.6770488619804382,
0.4969283938407898,
0.5306583642959595,
0.685789227485656... |
func (t *topK) K() int {
return t.k
} | [
-0.3898531496524811,
0.21471276879310608,
0.5327275395393372,
0.3701934814453125,
-0.4918741285800934,
0.8786933422088623,
1.6268479824066162,
0.20399528741836548,
-0.5816854238510132,
-0.00002307030990778003,
-0.8035071492195129,
-0.18212297558784485,
0.825648307800293,
0.0362366586923599... |
func New(k int, l Less) Interface {
return &topK{k, &comparables{make([]interface{}, 0, k), l}}
} | [
0.07054714858531952,
-0.6902415156364441,
0.37105894088745117,
-0.3606232702732086,
-1.148567795753479,
0.15504072606563568,
-0.0020018683280795813,
-0.4716302454471588,
-0.4287421405315399,
-0.8133859634399414,
-0.9156635403633118,
-0.5020721554756165,
0.5792289972305298,
0.56434041261672... |
func Push(t Interface, x interface{}) {
if l := t.Len(); l < t.K() {
heap.Push(t, x)
} else if l > 0 && t.IsLess(t.Peek(), x) {
heap.Pop(t) // remove the smallest element
heap.Push(t, x) // push the new one
}
} | [
0.6687221527099609,
0.6196876168251038,
0.44822409749031067,
0.3054904639720917,
-0.5540168285369873,
0.8114827871322632,
-1.4424527883529663,
-0.10148732364177704,
-0.08499666303396225,
0.7429361343383789,
-0.8196958899497986,
0.4394055902957916,
-0.04740278795361519,
0.5488523244857788,
... |
func Get(t Interface) []interface{} {
vals := t.Get()
valsCopy := make([]interface{}, len(vals))
copy(valsCopy, vals)
cmp := &comparables{valsCopy, t.IsLess}
sort.Sort(sort.Reverse(cmp))
return cmp.values
} | [
-0.407344251871109,
-0.11613841354846954,
0.8227058053016663,
-0.8012340068817139,
0.49758633971214294,
0.2558059096336365,
-0.8689169883728027,
-0.7991408705711365,
-0.18052276968955994,
-0.004702270962297916,
-0.35973918437957764,
0.4179345667362213,
0.1769069880247116,
0.433627337217330... |
func setupEnvConfigViper(environmentFlag string) *viper.Viper {
config := viper.New()
config.SetConfigName(environmentFlag)
config.AddConfigPath("./.argo/environments")
if err := config.ReadInConfig(); err != nil {
color.Red("%s",err)
color.Red("Error locating or parsing %s env's helm value file (should be ./ar... | [
-0.12004046887159348,
-0.6530874371528625,
0.5908880829811096,
-0.14433495700359344,
-0.08331333845853806,
0.4536663889884949,
0.06765986233949661,
0.4387793242931366,
-1.1484925746917725,
0.9462767839431763,
-0.5641820430755615,
-0.3060593008995056,
0.4196375906467438,
0.9951287508010864,... |
func setKubectlConfig(environment string) {
currentEnvConfig := setupEnvConfigViper(environment)
var namespace = currentEnvConfig.GetString("general.namespace")
var contextCluster string
if environment == "local" {
contextCluster = "minikube"
} else {
gcloudCluster := currentEnvConfig.GetString("gcp.cluster")... | [
0.1994360387325287,
-0.6715559959411621,
0.7659441232681274,
-0.1817823052406311,
0.25237709283828735,
0.5645734071731567,
-0.12373903393745422,
-0.41670823097229004,
-0.7273849844932556,
0.5385400056838989,
0.3272934556007385,
0.7435385584831238,
-0.16747532784938812,
-0.7876930832862854,... |
func checkExisting() bool {
projectName := projectConfig.GetString("project_name")
environment := projectConfig.GetString("environment")
color.Cyan("Ensuring existing helm project does not already exist...")
out, err := util.ExecCmdChainCombinedOut(fmt.Sprintf("helm status %s-%s", projectName, environment))
if (... | [
-0.10338634252548218,
-0.01921674981713295,
0.6481648683547974,
0.460758775472641,
1.2375084161758423,
0.8748999238014221,
-0.04175800457596779,
-0.1737912893295288,
-1.1713815927505493,
0.9239821434020996,
0.38854387402534485,
0.45768359303474426,
-0.7643128633499146,
0.6281018257141113,
... |
func (hv *HelmValues) appendValue(helmKey string, value string, required bool) {
if (len(value) <= 0) {
if (required) {
color.Red("Missing required helm value for %s", helmKey)
os.Exit(1)
} else if (viper.GetBool("debug")) {
color.Yellow("[debug] - Not setting value for helm key %s", helmKey)
}
} else ... | [
-0.2851950228214264,
0.6872181296348572,
0.4546406865119934,
-0.16334332525730133,
0.2520548701286316,
0.07899370044469833,
-1.0491151809692383,
0.31591156125068665,
-0.10494111478328705,
0.5531266927719116,
0.6295825839042664,
0.6492093205451965,
0.21421857178211212,
1.905672550201416,
... |
func (hv *HelmValues) appendProjectValue(helmKey string, projectKey string, required bool) {
projectValue := projectConfig.GetString(projectKey)
hv.appendValue(helmKey, projectValue, required)
} | [
0.011043643578886986,
0.7813889980316162,
0.26461485028266907,
0.18416717648506165,
-0.6203785538673401,
0.8072591423988342,
-1.1722017526626587,
0.16524966061115265,
-0.2601647675037384,
0.37172234058380127,
0.6295638084411621,
0.3695090115070343,
-0.27839744091033936,
0.7934556007385254,... |
func helmUpgrade() error {
projectName := projectConfig.GetString("project_name")
environment := projectConfig.GetString("environment")
color.Cyan("Installing project chart via helm...")
var waitFlag string
if projectConfig.GetBool("wait") {
// Intended for CI, wait for updated infrastructure to apply fully so... | [
0.07821746915578842,
-0.3848809599876404,
0.7327598929405212,
0.15487150847911835,
0.240310937166214,
-0.07583150267601013,
0.047490693628787994,
-0.09244250506162643,
-0.9099777340888977,
0.17752483487129211,
0.25741687417030334,
0.49228525161743164,
-0.22362400591373444,
0.62781399488449... |
func (s *system) Send(wr io.Writer) {
tpl, err := template.
New("system").
Funcs(template.FuncMap{
"strContains": func(src string, tgt string) bool {
res := strings.EqualFold(src, tgt)
return res
},
}).
Parse(templateSystem)
if err != nil {
panic(err)
}
err = tpl.Execute(wr, s)
if err != ni... | [
-0.30114904046058655,
0.39188098907470703,
0.28551769256591797,
-0.015354200266301632,
0.21767178177833557,
-0.34046223759651184,
0.09741313010454178,
-0.35284024477005005,
-0.5361419916152954,
0.04039420187473297,
-0.2697668969631195,
0.17775844037532806,
-0.11985349655151367,
0.816206753... |
func BuildKubeConfig(kubeconfig string) (*rest.Config, error) {
if kubeconfig != "" {
glog.V(2).Infof("kubeconfig file: %s", kubeconfig)
return clientcmd.BuildConfigFromFlags("", kubeconfig)
}
glog.V(2).Info("kubeconfig file: using InClusterConfig.")
return rest.InClusterConfig()
} | [
0.05572177842259407,
-0.38147976994514465,
0.38334351778030396,
0.5259637832641602,
-0.06833332031965256,
0.1547943353652954,
-0.11095930635929108,
0.4940522313117981,
-0.0534757599234581,
0.4855138957500458,
-0.028849242255091667,
0.27963483333587646,
-1.1984611749649048,
0.21840813755989... |
func NewContactCenterInsightsClient(cc grpc.ClientConnInterface) ContactCenterInsightsClient {
return src.NewContactCenterInsightsClient(cc)
} | [
0.22914648056030273,
-0.9581762552261353,
0.1716616004705429,
-0.42086225748062134,
-1.5729941129684448,
-0.02488415502011776,
0.1404910534620285,
-0.7689768671989441,
0.4579622149467468,
0.11713621020317078,
0.4870876669883728,
0.2446097880601883,
0.035912830382585526,
-0.4139505326747894... |
func RegisterContactCenterInsightsServer(s *grpc.Server, srv ContactCenterInsightsServer) {
src.RegisterContactCenterInsightsServer(s, srv)
} | [
-0.9596182107925415,
-0.8177294135093689,
0.22424152493476868,
-0.4933950901031494,
-0.392617404460907,
0.36744293570518494,
0.06442299485206604,
-0.19259309768676758,
0.8726296424865723,
-0.0529647022485733,
-0.21596823632717133,
0.08432529866695404,
-0.6002169847488403,
0.261583507061004... |
func hashToBlocks(hash []byte) []byte {
blocks := make([]byte, wtnLen)
// convert hash to base-w blocks
ToBase(blocks[:wtnLen1], hash, w)
// compute checksum
var checksum uint16
for _, b := range blocks {
// + (2^w-1)+b[i]
checksum += wtnMask - uint16(b)
}
// left shift checksum
checksum <<= (8 - (wtnLe... | [
0.9432133436203003,
-0.09708734601736069,
0.7952789664268494,
0.013131513260304928,
0.4083528220653534,
-0.25628000497817993,
-0.08084659278392792,
-0.6922698020935059,
0.5011770129203796,
0.47336187958717346,
-1.0454961061477661,
0.4550018608570099,
-0.15208598971366882,
0.595462203025817... |
func (m *ServiceMgr) deletePrimaryStore(appName string) (info *runtimeInfo) {
info = &runtimeInfo{}
logging.Infof("Deleting application %v from primary store", appName)
checkIfDeployed := false
for _, app := range util.ListChildren(metakvAppsPath) {
if app == appName {
checkIfDeployed = true
}
}
if !chec... | [
0.06333983689546585,
-0.9290438294410706,
0.6882917881011963,
0.1972322016954422,
-1.0769500732421875,
0.026119722053408623,
-0.03527708724141121,
-0.14579567313194275,
0.7777844071388245,
0.6932752132415771,
0.8011708855628967,
0.05592117831110954,
-0.17166006565093994,
1.1007952690124512... |
func (m *ServiceMgr) deleteTempStore(appName string) (info *runtimeInfo) {
info = &runtimeInfo{}
logging.Infof("Deleting drafts from temporary store: %v", appName)
checkIfDeployed := false
for _, app := range util.ListChildren(metakvTempAppsPath) {
if app == appName {
checkIfDeployed = true
}
}
if !check... | [
0.1533806025981903,
-0.8153419494628906,
0.48990848660469055,
-0.024903014302253723,
-1.0172524452209473,
0.2553437352180481,
-0.05076337605714798,
0.06013495475053787,
0.5469259023666382,
0.7486796379089355,
0.7011830806732178,
-0.052982982248067856,
-0.34855368733406067,
1.15688085556030... |
func (m *ServiceMgr) getDeployedApps(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
return
}
audit.Log(auditevent.ListDeployed, r, nil)
nodeAddrs, err := m.getActiveNodeAddrs()
if err != nil {
logging.Errorf("Failed to fetch active Eventing nodes, err: %v", err... | [
-0.5088750123977661,
-0.3101573586463928,
0.8271291255950928,
-0.3434377610683441,
-0.060021985322237015,
0.04770294204354286,
0.5780199766159058,
-0.05446266382932663,
0.2792906165122986,
1.352421522140503,
-0.052672017365694046,
0.32764971256256104,
0.43852975964546204,
1.030680418014526... |
func (m *ServiceMgr) getRebalanceProgress(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
return
}
progress := &common.RebalanceProgress{}
appList := util.ListChildren(metakvAppsPath)
for _, appName := range appList {
// TODO: Leverage error returned from rebal... | [
0.02413766086101532,
-0.22707442939281464,
0.7285646200180054,
0.6000996232032776,
0.4306066632270813,
-0.13098128139972687,
0.14814119040966034,
-0.7781162261962891,
0.19054441154003143,
0.6728300452232361,
0.16185884177684784,
0.041338030248880386,
-0.6989449858665466,
0.6452177166938782... |
func (m *ServiceMgr) getRebalanceStatus(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
return
}
w.Write([]byte(strconv.FormatBool(m.superSup.RebalanceStatus())))
} | [
0.06465033441781998,
0.4560839533805847,
0.5651453733444214,
0.3604896366596222,
0.16754181683063507,
0.260047048330307,
-0.01003179233521223,
0.15554378926753998,
0.53086256980896,
-0.2471914291381836,
-0.9534953236579895,
0.8807348012924194,
-0.39957329630851746,
0.28955408930778503,
-... |
func (m *ServiceMgr) getAggEventProcessingStats(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
return
}
params := r.URL.Query()
appName := params["name"][0]
util.Retry(util.NewFixedBackoff(time.Second), getEventingNodesAddressesOpCallback, m)
pStats, err := uti... | [
-0.560573399066925,
0.7716650366783142,
0.6803705096244812,
-0.4142880141735077,
-0.0795099288225174,
-0.3123183846473694,
-0.3664085268974304,
-0.1914709061384201,
-0.03441176936030388,
1.0237985849380493,
1.1906846761703491,
0.7286445498466492,
0.13433387875556946,
0.20146262645721436,
... |
func (m *ServiceMgr) getAggRebalanceProgress(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
return
}
util.Retry(util.NewFixedBackoff(time.Second), getEventingNodesAddressesOpCallback, m)
aggProgress, _ := util.GetProgress("/getRebalanceProgress", m.eventingNodeAdd... | [
-0.5004076361656189,
0.43045738339424133,
0.7622517347335815,
0.05312402918934822,
0.47707316279411316,
-0.5063880681991577,
0.2709447741508484,
-0.5979363918304443,
0.28520098328590393,
0.7414534687995911,
0.6480841040611267,
0.5756551623344421,
-0.5157879590988159,
0.07085640728473663,
... |
func (m *ServiceMgr) getAggRebalanceStatus(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
return
}
util.Retry(util.NewFixedBackoff(time.Second), getEventingNodesAddressesOpCallback, m)
status, err := util.CheckIfRebalanceOngoing("/getRebalanceStatus", m.eventingNo... | [
-0.10249879956245422,
0.49888792634010315,
0.631277322769165,
-0.07287116348743439,
0.7647174596786499,
-0.10245584696531296,
0.0780462771654129,
0.0689450055360794,
0.49592354893684387,
0.5857354402542114,
0.4927133023738861,
1.1628429889678955,
0.17719531059265137,
0.3007877469062805,
... |
func (m *ServiceMgr) saveTempStore(app application) (info *runtimeInfo) {
info = &runtimeInfo{}
appName := app.Name
nsServerEndpoint := net.JoinHostPort(util.Localhost(), m.restPort)
logging.Infof("Saving handler to temporary store: %v", appName)
cinfo, err := util.FetchNewClusterInfoCache(nsServerEndpoint)
if e... | [
-0.96844083070755,
-0.629898726940155,
0.7377583980560303,
-0.5561480522155762,
-0.46894359588623047,
0.3983999192714691,
-0.2072029411792755,
-0.6541439890861511,
0.04341637343168259,
0.5395699739456177,
-1.1985490322113037,
-0.09453032910823822,
-0.035479672253131866,
1.0380783081054688,... |
func (m *ServiceMgr) savePrimaryStore(app application) (info *runtimeInfo) {
appName := app.Name
info = &runtimeInfo{}
logging.Infof("Saving application %v to primary store", appName)
if rebStatus := m.checkRebalanceStatus(); rebStatus.Code != m.statusCodes.ok.Code {
info.Code = rebStatus.Code
info.Info = rebS... | [
-0.4243347942829132,
-1.1428947448730469,
0.7260512709617615,
-0.1428173929452896,
-0.15323656797409058,
0.41477254033088684,
-0.31070905923843384,
-0.8093000054359436,
0.3335683345794678,
0.5028567314147949,
-0.7555915117263794,
-0.25012460350990295,
-0.23631015419960022,
1.02425622940063... |
func (m *ServiceMgr) cleanupEventing(w http.ResponseWriter, r *http.Request) {
if !m.validateAuth(w, r, EventingPermissionManage) {
fmt.Fprintln(w, `{"error":"Request not authorized"}`)
return
}
audit.Log(auditevent.CleanupEventing, r, nil)
util.Retry(util.NewFixedBackoff(time.Second), cleanupEventingMetaKvPa... | [
-0.2947240471839905,
0.20211462676525116,
0.6769612431526184,
0.7981030941009521,
-0.22859935462474823,
-0.1187872663140297,
1.0602846145629883,
0.5905118584632874,
0.5988851189613342,
0.17792199552059174,
0.9233779311180115,
-0.05423474311828613,
0.22139683365821838,
0.6602171659469604,
... |
func getOpts() (options, error) {
// Ensuring we're getting the correct # of arguments
if len(os.Args) < 2 {
return options{}, errors.New("A filepath argument must be given!")
}
// These are out options flags.
// Using the flag pkg from stdlib, we provide the flag's name, a default value, and
// a short descr... | [
-0.27394816279411316,
-0.5817241668701172,
0.758864164352417,
-0.09668151289224625,
0.10039866715669632,
-0.3042986989021301,
0.511013388633728,
-0.590880811214447,
-0.6920503973960876,
0.17957890033721924,
0.4060780107975006,
-0.0317055769264698,
-0.10295949131250381,
0.3058727979660034,
... |
func checkIfValidFile(filename string) (bool, error) {
// Checking if the filename has a .csv extension
if fileExtension := filepath.Ext(filename); fileExtension != ".csv" {
return false, fmt.Errorf("File %s is not a CSV", filename)
}
if _, err := os.Stat(filename); err != nil && os.IsNotExist(err) {
return fa... | [
0.5258426070213318,
-0.04952232912182808,
0.6959404945373535,
0.6994860768318176,
0.12834173440933228,
1.0811457633972168,
-0.24739068746566772,
0.5335023403167725,
-0.1113923192024231,
-0.1566781848669052,
0.7780357003211975,
-0.2317209392786026,
-0.4669713079929352,
0.6587541103363037,
... |
func processLine(headers []string, dataList []string) (map[string]string, error) {
// Make sure there is the same num of headers as columns, otherwise throw error
if len(dataList) != len(headers) {
return nil, errors.New("line does not match headers format, skipping line.")
}
// Create the map we're going to pop... | [
-0.3913297653198242,
-0.3551608622074127,
0.8768191337585449,
-0.03704967722296715,
0.1195717304944992,
-0.3337577283382416,
-0.979659914970398,
-0.0494309738278389,
-0.5902214646339417,
-0.12622229754924774,
-0.09877929091453552,
-0.45919090509414673,
-0.07347728312015533,
0.0628901422023... |
func writeJSONFile(jsonOutputPath string, writeChannel <-chan map[string]string, done chan<- bool, pretty bool) {
// Init a JSON writer func
writeString := createStringWriter(jsonOutputPath)
// Init the JSON parse func and the breakline char
jsonFunc, breakLine := getJSONFunc(pretty)
//Info log...
fmt.Println("W... | [
-0.6953058838844299,
-1.1271905899047852,
1.0083473920822144,
-0.5988525152206421,
-0.019456246867775917,
-0.17933912575244904,
0.6673887372016907,
0.07435761392116547,
-1.3159300088882446,
0.13266192376613617,
-0.416924387216568,
-0.1717626452445984,
-0.345245361328125,
0.0178708434104919... |
func createStringWriter(jsonOutputPath string) func(string, bool) {
// Open the JSON file we will start writing to
f, err := os.Create(jsonOutputPath)
// Check for err, gracefully error
check(err)
// Return the function that will be used to write to the JSON file we decalred above
return func(data string, close ... | [
-0.33078843355178833,
-0.6708181500434875,
0.5205449461936951,
-0.4510948657989502,
-0.594550609588623,
-0.46063560247421265,
0.23815596103668213,
-0.2918224334716797,
-0.7582814693450928,
0.1067015677690506,
0.07776971161365509,
-0.988681972026825,
0.07073767483234406,
-0.6231124997138977... |
func getJSONFunc(pretty bool) (func(map[string]string) string, string) {
// The function that marshals the records into json
var jsonFunc func(map[string]string) string
// The linebreak character to use
var breakLine string
// If pretty is enabled, we should format the JSON with line breaks and indentation
if pr... | [
-0.052848201245069504,
-0.6988614797592163,
0.7675813436508179,
-0.5310413837432861,
-0.34259679913520813,
-0.7999024987220764,
-0.3530208468437195,
0.6457151770591736,
-0.5389010310173035,
-0.22737367451190948,
-0.17955239117145538,
1.3087133169174194,
0.9908279776573181,
0.12444455176591... |
func Base64ToHex(in []byte) (out []byte, err error) { // input format should be ':"balabala..."'
const prefix, suffix = ":\"", "\""
start, end := len(prefix), len(in)-len(suffix) // b64Str len not contain :" prefix and " suffix
// Decode Base64 string to bin
bin := make([]byte, base64.StdEncoding.DecodedLen(end-st... | [
0.16839781403541565,
-1.00247061252594,
0.8325082063674927,
0.2969537079334259,
-0.25380420684814453,
0.10704206675291061,
-0.37759727239608765,
0.968192994594574,
0.011722907423973083,
0.6666665077209473,
-0.39261573553085327,
0.21369889378547668,
0.1770629733800888,
0.2862969636917114,
... |
func Base64Handler(pattern *regexp.Regexp, out io.Writer, in []byte) {
seek := 0 // init cursor
for _, s := range pattern.FindAllIndex(in, -1) { // foreach matching
out.Write(in[seek:s[0]]) // copy string between two matching
// append hex string if convert successful or ap... | [
-0.182362362742424,
-0.6779391169548035,
0.750809907913208,
0.3352977931499481,
-0.006173641420900822,
0.302270770072937,
1.122039794921875,
1.2199326753616333,
-0.16631534695625305,
0.6477869749069214,
0.5370428562164307,
-0.27189314365386963,
-0.36941981315612793,
-0.43136757612228394,
... |
func (s *Sender) GetMetaDataFor(key string) (*MetaData, error) {
var errMsg string
var method string = "GetMetaDataFor"
conn := s.pool.Get()
defer conn.Close()
matches, err := redis.ByteSlices(conn.Do("KEYS", fmt.Sprintf("%s:*", key)))
if err != nil {
errMsg = fmt.Sprintf("Failed to find matching key for : %s... | [
-0.6792652010917664,
0.24599213898181915,
0.9209510087966919,
-0.8548907041549683,
-0.3898712396621704,
-0.3389783203601837,
-0.8703576326370239,
-0.43223538994789124,
-0.5640940070152283,
0.5655009150505066,
0.15013860166072845,
0.7743471264839172,
0.09815848618745804,
0.7577028870582581,... |
func logFrom(method, msg string) {
log.Printf("Sender - %s - %s", msg, method)
} | [
0.83048415184021,
-0.2847297787666321,
0.6176506280899048,
-0.01374086458235979,
-0.5136330127716064,
-0.5106912851333618,
-0.4134185314178467,
0.1131737008690834,
0.015126366168260574,
-0.6147742867469788,
0.2139555811882019,
1.0514655113220215,
0.32535237073898315,
0.3911997079849243,
... |
func getOrder(config Config, d *schema.ResourceData) error {
url := "api/service_orders?expand=resources"
request, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Printf("[ERROR] Error in creating http Request %s", err)
return err
}
response, err := config.GetResponse(request)
if err != nil {
lo... | [
-0.08742786198854446,
0.8280843496322632,
1.0714244842529297,
0.2634255588054657,
0.09218152612447739,
-0.04036012291908264,
-0.09025849401950836,
0.09195810556411743,
-0.7271780371665955,
-0.4863003194332123,
-0.20489713549613953,
0.6298606991767883,
-0.5344492793083191,
0.887964546680450... |
func deleteOrder(config Config, orderID string) error {
url := "api/service_orders/" + orderID
// buff will contain request body
buff, err := json.Marshal(map[string]string{
"action": "delete",
})
if err != nil {
log.Fatalln(err)
}
request, err := http.NewRequest("POST", url, bytes.NewBuffer(buff))
if er... | [
-0.2417948991060257,
-0.04310094937682152,
0.9344482421875,
0.12290726602077484,
0.4305349290370941,
-0.038643885403871536,
-0.518720269203186,
-0.008044260554015636,
-0.08097799122333527,
-0.0073203882202506065,
-0.03453300893306732,
1.179329514503479,
-0.8254385590553284,
1.7682937383651... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.