text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func fileAndLine(lvl ...int) Fields {
level := 2
if len(lvl) == 1 {
level = lvl[0]
}
_, file, line, _ := runtime.Caller(level)
_, fileName := path.Split(file)
return Fields{
"file": fileName,
"line": line,
}
} | [
-0.45245468616485596,
-0.9681570529937744,
0.6070334911346436,
-0.3375999331474304,
-0.2835516035556793,
-0.09310441464185715,
-0.14721569418907166,
0.4950113594532013,
-1.765542984008789,
-0.6156260371208191,
-0.7795608639717102,
-0.3396155834197998,
-0.01720678247511387,
0.66890376806259... |
func contextFields(lvl ...int) Fields {
level := 2
if len(lvl) == 1 {
level = lvl[0]
}
pc, file, line, _ := runtime.Caller(level)
_, fileName := path.Split(file)
parts := strings.Split(runtime.FuncForPC(pc).Name(), ".")
pl := len(parts)
packageName := ""
funcName := parts[pl-1]
if len(parts) >= 0 && pl-2 <... | [
-0.1589294672012329,
-0.04151918366551399,
0.7521096467971802,
-0.43640127778053284,
-0.2253330796957016,
-1.0056507587432861,
0.534692645072937,
-0.14157064259052277,
-0.3338698148727417,
0.3906146287918091,
-0.841766357421875,
-0.10905355960130692,
-0.8416202664375305,
-0.743507444858551... |
func Close() {
if Logr.Out.(*os.File) != os.Stderr && Logr.Out.(*os.File) != os.Stdout {
err := Logr.Out.(*os.File).Close()
if err != nil {
fmt.Printf("Could not close logr file descriptor: %v\n", err)
}
}
} | [
0.7251614332199097,
-0.62453693151474,
0.8221563696861267,
-0.7336496114730835,
-0.6906247138977051,
0.35490089654922485,
0.08261576294898987,
-0.8429688215255737,
-0.7903366088867188,
-0.8376343250274658,
1.5204336643218994,
0.27026569843292236,
-0.5023406147956848,
1.1308772563934326,
... |
func HexMutation() Registration {
mutation := func(data []byte) []byte {
return []byte(hex.EncodeToString(data))
}
return Registration{
Label: "hex",
Mutation: mutation}
} | [
-0.6030954718589783,
0.6912251114845276,
0.3085121214389801,
-0.23008373379707336,
0.12313396483659744,
-0.3593362271785736,
-0.6372556090354919,
1.0733543634414673,
1.2473862171173096,
0.4508650600910187,
-0.9304314255714417,
-0.37481218576431274,
0.042524922639131546,
0.11851900070905685... |
func zero(xPtr *int){
// When we write *xPtr = 0, we are saying "store the int 0 in the memory location xPtr refers to"
*xPtr = 0
} | [
-0.2660793364048004,
-1.0412546396255493,
0.18993933498859406,
-0.3077114224433899,
0.41038939356803894,
0.17358455061912537,
0.7907137870788574,
0.5583241581916809,
0.17766372859477997,
-0.18778303265571594,
-0.5451503992080688,
0.828993022441864,
-0.13297545909881592,
0.25060567259788513... |
func main() {
fmt.Println("vim-go")
aca(1000)
aca(5000)
aca(10000)
aca(20000)
} | [
1.068793773651123,
-0.4634473919868469,
0.45754560828208923,
0.5518788695335388,
-0.008294512517750263,
-0.9693138003349304,
0.95108562707901,
0.33730900287628174,
-0.24462734162807465,
0.42620208859443665,
-0.733458399772644,
1.0172405242919922,
0.4651656150817871,
-0.04067050293087959,
... |
func (n *windowNode) extractWindowFunctions(s *renderNode) error {
visitor := extractWindowFuncsVisitor{
n: n,
aggregatesSeen: make(map[*parser.FuncExpr]struct{}),
}
oldRenders := s.render
oldColumns := s.columns
newRenders := make([]parser.TypedExpr, 0, len(oldRenders))
newColumns := make([]Res... | [
-0.3927096724510193,
0.10168752819299698,
0.630649209022522,
-0.1732158660888672,
-0.26583990454673767,
-1.0455589294433594,
0.6310333013534546,
0.031245006248354912,
0.04519405961036682,
-0.2576415538787842,
-0.6030233502388,
0.9624474048614502,
-0.7120161056518555,
0.801734983921051,
0... |
func (n *windowNode) constructWindowDefinitions(sc *parser.SelectClause, s *renderNode) error {
// Process each named window specification on the select clause.
namedWindowSpecs := make(map[string]*parser.WindowDef, len(sc.Window))
for _, windowDef := range sc.Window {
name := windowDef.Name.Normalize()
if _, ok... | [
-0.16638121008872986,
-0.2123509794473648,
0.5698341131210327,
0.3086628019809723,
-0.5780792236328125,
-0.8435109257698059,
0.5548384785652161,
-0.006528405472636223,
-0.1746036410331726,
-0.11579129099845886,
-0.13078436255455017,
0.5951026082038879,
0.33791494369506836,
0.99707573652267... |
func constructWindowDef(
def parser.WindowDef, namedWindowSpecs map[string]*parser.WindowDef,
) (parser.WindowDef, error) {
modifyRef := false
var refName string
switch {
case def.RefName != "":
// SELECT rank() OVER (w) FROM t WINDOW w as (...)
// We copy the referenced window specification, and modify it if ... | [
0.2811000645160675,
-0.4131966531276703,
0.4962327182292938,
0.018996598199009895,
-0.6974156498908997,
-0.5910853147506714,
0.5588579773902893,
-0.06340660899877548,
-0.3252354860305786,
0.3742014169692993,
0.2538694143295288,
0.7431269884109497,
0.0009353424538858235,
1.3207703828811646,... |
func (n *windowNode) replaceIndexedVars(s *renderNode) {
ivarHelper := parser.MakeIndexedVarHelper(n, s.ivarHelper.NumVars())
n.ivarIdxMap = make(map[int]int)
n.ivarSourceInfo = s.sourceInfo
varIdx := 0
for i, render := range n.windowRender {
if render == nil {
continue
}
replaceIdxVars := func(expr pars... | [
-0.8981751203536987,
-0.21729426085948944,
0.38432589173316956,
-0.704994261264801,
-0.4646104574203491,
-0.7856737971305847,
0.5074495077133179,
0.45696425437927246,
0.11345197260379791,
-0.34693965315818787,
-0.8515740036964417,
0.561518132686615,
-0.6466875076293945,
0.03972802311182022... |
func (n *partitionSorter) Len() int { return len(n.rows) } | [
0.01932564191520214,
0.30030184984207153,
0.10148369520902634,
-0.34107479453086853,
-0.20686420798301697,
-0.461773544549942,
0.4951857328414917,
0.803616464138031,
-0.4187878966331482,
-1.2113189697265625,
-0.07447407394647598,
-0.039884764701128006,
0.41049474477767944,
0.47355696558952... |
func (n *partitionSorter) InSameGroup(i, j int) bool { return n.Compare(i, j) == 0 } | [
-1.2960700988769531,
0.49001649022102356,
0.45206955075263977,
0.2938590347766876,
-0.9063342213630676,
-0.17503345012664795,
0.1673714965581894,
-1.046445608139038,
-1.0673272609710693,
0.7402294278144836,
-0.2353135496377945,
0.0101847592741251,
-1.662996530532837,
0.3570561110973358,
... |
func (allPeers) InSameGroup(i, j int) bool { return true } | [
-1.5268641710281372,
0.23838122189044952,
0.504265546798706,
0.305651992559433,
-0.6783092617988586,
0.11653947085142136,
0.3889070153236389,
-0.4221290946006775,
-0.7296952605247498,
1.010939598083496,
-0.7305391430854797,
0.10913561284542084,
-2.2938382625579834,
0.5500534176826477,
-0... |
func (n *windowNode) computeWindows() error {
rowCount := n.wrappedRenderVals.Len()
if rowCount == 0 {
return nil
}
windowCount := len(n.funcs)
acc := n.windowsAcc.Wtxn(n.planner.session)
winValSz := uintptr(rowCount) * unsafe.Sizeof([]parser.Datum{})
winAllocSz := uintptr(rowCount*windowCount) * unsafe.Size... | [
-0.23369406163692474,
0.9248633980751038,
0.7717228531837463,
0.4095817804336548,
-0.11032018065452576,
-0.9555010199546814,
1.2679312229156494,
0.5309239625930786,
0.17171762883663177,
-0.44969668984413147,
0.4930781126022339,
0.8426365256309509,
0.37036362290382385,
1.2016711235046387,
... |
func (n *windowNode) populateValues() error {
acc := n.windowsAcc.Wtxn(n.planner.session)
rowCount := n.wrappedRenderVals.Len()
n.values.rows = NewRowContainer(
n.planner.session.TxnState.makeBoundAccount(), n.values.columns, rowCount,
)
row := make(parser.DTuple, len(n.windowRender))
for i := 0; i < rowCount;... | [
-0.4568324387073517,
0.5213156342506409,
0.5154563784599304,
-0.3783445656299591,
0.15664814412593842,
-0.9199569225311279,
0.7803911566734314,
-0.10298918187618256,
-0.13950583338737488,
-0.5904664397239685,
0.5872412919998169,
0.4910461902618408,
0.29889294505119324,
1.178012490272522,
... |
func (v extractWindowFuncsVisitor) extract(
typedExpr parser.TypedExpr,
) (parser.TypedExpr, int, error) {
expr, _ := parser.WalkExpr(&v, typedExpr)
if v.err != nil {
return nil, 0, v.err
}
return expr.(parser.TypedExpr), v.windowFnCount, nil
} | [
-0.8813228011131287,
-0.35155826807022095,
0.6069292426109314,
-0.1625015139579773,
-1.2709650993347168,
-0.791131317615509,
1.4238377809524536,
0.6313701868057251,
-0.04024461284279823,
0.5828935503959656,
-0.7038955092430115,
0.8882849812507629,
-0.7304801344871521,
1.063899040222168,
... |
func (n *windowNode) IndexedVarEval(idx int, ctx *parser.EvalContext) (parser.Datum, error) {
return n.wrappedIndexedVarVals.At(n.curRowIdx)[n.ivarIdxMap[idx]].Eval(ctx)
} | [
-0.6709639430046082,
-0.438960999250412,
0.12257701903581619,
-0.5233932137489319,
-0.38044261932373047,
-0.1375845968723297,
0.5171902179718018,
-0.6382838487625122,
0.43379801511764526,
0.4188794791698456,
-0.21216896176338196,
1.3964191675186157,
-0.37579676508903503,
-0.719643652439117... |
func (n *windowNode) IndexedVarResolvedType(idx int) parser.Type {
return n.ivarSourceInfo[0].sourceColumns[idx].Typ
} | [
0.003261262085288763,
0.40343528985977173,
0.18770085275173187,
-0.6102882027626038,
0.5910639762878418,
-0.579025387763977,
1.0885635614395142,
-0.6686707735061646,
0.08841448277235031,
-0.01933141238987446,
-0.7769175171852112,
-0.02630983106791973,
-0.496630996465683,
-0.926505386829376... |
func (n *windowNode) IndexedVarFormat(buf *bytes.Buffer, f parser.FmtFlags, idx int) {
n.ivarSourceInfo[0].FormatVar(buf, f, idx)
} | [
0.36957597732543945,
-0.7464360594749451,
0.025573736056685448,
-1.0525654554367065,
0.40696579217910767,
-0.5086995959281921,
0.8279284238815308,
-0.8611201047897339,
0.15860939025878906,
-0.1498122364282608,
-0.07113701850175858,
0.747637927532196,
-0.6293059587478638,
-0.314883142709732... |
func ExecAndWrite(fileName string) error {
cmd := exec.Command("crontab", "-l")
// open the out file for writing
outfile, err := os.Create(fileName)
if err != nil {
panic(err)
}
defer outfile.Close()
stdoutPipe, err := cmd.StdoutPipe()
if err != nil {
panic(err)
}
writer := bufio.NewWriter(outfile)
de... | [
1.0099691152572632,
-0.7188261151313782,
1.0025689601898193,
0.6450484991073608,
0.6502453088760376,
0.10802020132541656,
0.8750132918357849,
0.8682066798210144,
-0.4115234315395355,
0.16684004664421082,
0.6100115776062012,
-0.4444912374019623,
0.5479246973991394,
0.16519081592559814,
0.... |
func Extract(accessToken string) (Profile, error) {
var profile Profile
url, err := getURL(accessToken, fields)
if err != nil {
return profile, fmt.Errorf("Could not construct the profile request url")
}
resp, err := http.Get(url.String())
if err != nil {
return profile, err
}
defer resp.Body.Close()
bod... | [
0.20895835757255554,
-0.25053367018699646,
0.8221818208694458,
-0.19303150475025177,
-0.29471978545188904,
-0.6662049293518066,
-0.7435204386711121,
-0.41160696744918823,
-0.008026770316064358,
0.5040828585624695,
-0.3990575671195984,
0.3554380536079407,
-0.3225952982902527,
-0.57368659973... |
func handleConditionLastTransitionTime(existingStatus, newStatus *longhorn.VolumeStatus) {
for i, newCondition := range newStatus.Conditions {
for _, existingCondition := range existingStatus.Conditions {
if existingCondition.Type == newCondition.Type &&
existingCondition.Status == newCondition.Status &&
... | [
0.4996833801269531,
-1.4716181755065918,
0.6493772864341736,
-0.32406362891197205,
0.4989415109157562,
-0.6920343637466431,
0.16835324466228485,
-0.07935355603694916,
-0.41864442825317383,
1.2571086883544922,
0.03761907294392586,
-0.6664908528327942,
-0.34190404415130615,
0.458667576313018... |
func (c *VolumeController) EvictReplicas(v *longhorn.Volume,
e *longhorn.Engine, rs map[string]*longhorn.Replica, healthyCount int) (err error) {
log := getLoggerForVolume(c.logger, v)
hasNewReplica := false
healthyNonEvictingCount := healthyCount
for _, replica := range rs {
if replica.Status.EvictionRequested... | [
-1.1157430410385132,
0.40569961071014404,
0.6427389979362488,
-0.6534559726715088,
-0.27914273738861084,
0.03973255306482315,
-0.04083103686571121,
-0.33057647943496704,
0.18775205314159393,
0.6480609774589539,
0.10337358713150024,
0.10171938687562943,
-0.565938413143158,
-0.16109775006771... |
func (c *VolumeController) ReconcileEngineReplicaState(v *longhorn.Volume, es map[string]*longhorn.Engine, rs map[string]*longhorn.Replica) (err error) {
defer func() {
err = errors.Wrapf(err, "failed to reconcile engine/replica state for %v", v.Name)
if v.Status.Robustness != longhorn.VolumeRobustnessDegraded {
... | [
-0.3874324560165405,
-1.3172168731689453,
0.6410585045814514,
-0.6717202067375183,
-0.16423800587654114,
0.0706683099269867,
-0.20458999276161194,
0.6161649823188782,
-0.22068044543266296,
0.5967158079147339,
0.28788867592811584,
-0.04059643670916557,
0.011551322415471077,
-0.0033882779534... |
func isFirstAttachment(rs map[string]*longhorn.Replica) bool {
for _, r := range rs {
if r.Spec.HealthyAt != "" {
return false
}
}
return true
} | [
-0.4568014144897461,
-0.6751852631568909,
0.6519371867179871,
-0.08799181133508682,
0.044702596962451935,
0.4649783968925476,
-0.19345323741436005,
-1.248084545135498,
0.8371439576148987,
-0.2253166288137436,
0.4487258195877075,
0.22508633136749268,
0.14825092256069183,
1.2566273212432861,... |
func (c *VolumeController) ReconcileVolumeState(v *longhorn.Volume, es map[string]*longhorn.Engine, rs map[string]*longhorn.Replica) (err error) {
defer func() {
err = errors.Wrapf(err, "failed to reconcile volume state for %v", v.Name)
}()
log := getLoggerForVolume(c.logger, v)
e, err := c.ds.PickVolumeCurrent... | [
-0.1415289342403412,
-0.7231320142745972,
0.7652665972709656,
-0.1472623497247696,
-0.1301068514585495,
-0.2790255546569824,
-0.23698221147060394,
0.29124775528907776,
0.5372995734214783,
-0.19073238968849182,
0.17585475742816925,
-0.3854406177997589,
0.4091254770755768,
0.0181130766868591... |
func hasLocalReplicaOnSameNodeAsEngine(e *longhorn.Engine, rs map[string]*longhorn.Replica) bool {
for _, r := range rs {
if e.Spec.NodeID != "" && (r.Spec.NodeID == e.Spec.NodeID || r.Spec.HardNodeAffinity == e.Spec.NodeID) {
return true
}
}
return false
} | [
0.5776570439338684,
-0.6166334748268127,
0.368591845035553,
-0.7414817214012146,
0.14309699833393097,
-0.1740456074476242,
-0.14881552755832672,
1.1673955917358398,
-0.02281109057366848,
1.023067593574524,
0.30154383182525635,
1.0725140571594238,
0.4476131498813629,
1.5178570747375488,
-... |
func (c *VolumeController) replenishReplicas(v *longhorn.Volume, e *longhorn.Engine, rs map[string]*longhorn.Replica, hardNodeAffinity string) error {
concurrentRebuildingLimit, err := c.ds.GetSettingAsInt(types.SettingNameConcurrentReplicaRebuildPerNodeLimit)
if err != nil {
return err
}
disableReplicaRebuild :=... | [
-0.7359023094177246,
-0.7591076493263245,
0.6272403597831726,
-0.47147518396377563,
-0.09357305616140366,
-0.12316092103719711,
0.1362466961145401,
0.5078780055046082,
0.45952683687210083,
0.37256214022636414,
-0.023622391745448112,
0.6766666769981384,
-0.4095671772956848,
0.22590000927448... |
func (c *VolumeController) isSourceVolumeOfCloning(v *longhorn.Volume) (bool, error) {
vols, err := c.ds.ListVolumes()
if err != nil {
return false, err
}
for _, vol := range vols {
if isTargetVolumeOfCloning(vol) && types.GetVolumeName(vol.Spec.DataSource) == v.Name {
return true, nil
}
}
return false, ... | [
-0.6230589151382446,
-0.29207855463027954,
0.5214749574661255,
-0.3870847523212433,
0.08047449588775635,
-0.7652907371520996,
0.012325659394264221,
0.03772043436765671,
0.22625230252742767,
0.7574111819267273,
-0.6023653745651245,
0.06921394169330597,
0.020835349336266518,
0.66057622432708... |
func generateRecurringJobName(log *logrus.Entry, ds *datastore.DataStore, job *longhorn.VolumeRecurringJobInfo) (string, string, error) {
// reuse restored recurring job that RecurringJobSpec is the same.
allRecurringJobs, err := ds.ListRecurringJobsRO()
if err != nil {
log.WithError(err).Warn("Failed to list all ... | [
-0.022830495610833168,
-0.6763395667076111,
0.670478105545044,
-0.6864227056503296,
0.15932981669902802,
0.22105327248573303,
-0.40253862738609314,
0.16309264302253723,
0.18357940018177032,
0.6008957028388977,
-0.796946108341217,
-0.2012549191713333,
-0.06820182502269745,
0.017516680061817... |
func restoreVolumeRecurringJobLabel(v *longhorn.Volume, jobName string, job *longhorn.VolumeRecurringJobInfo) error {
// set Volume recurring jobs/groups
if job.FromJob {
labelKey := types.GetRecurringJobLabelKey(types.LonghornLabelRecurringJob, jobName)
// enable recurring jobs
v.Labels[labelKey] = types.Longh... | [
0.32933560013771057,
-0.7865515351295471,
0.6136263608932495,
-0.5949719548225403,
-0.2964567542076111,
0.4679928123950958,
-0.37484297156333923,
0.13810719549655914,
-0.6913226246833801,
0.25371116399765015,
0.11718324571847916,
0.2926797568798065,
-1.1041861772537231,
-0.7839009165763855... |
func createRecurringJobNotExist(log *logrus.Entry, ds *datastore.DataStore, v *longhorn.Volume, jobName string, job *longhorn.VolumeRecurringJobInfo) (string, error) {
if existJob, err := ds.GetRecurringJob(jobName); err != nil {
if !apierrors.IsNotFound(err) {
return "", errors.Wrapf(err, "failed to get the recu... | [
0.4019703269004822,
-0.2707233428955078,
0.616707444190979,
-0.5525091886520386,
0.3867713212966919,
0.31400802731513977,
-0.22212059795856476,
0.020961081609129906,
-0.3419106602668762,
0.20010489225387573,
0.24006694555282593,
-0.007738160435110331,
-1.2170804738998413,
-0.46979331970214... |
func (c *VolumeController) restoreVolumeRecurringJobs(v *longhorn.Volume) error {
log := getLoggerForVolume(c.logger, v)
backupVolumeRecurringJobsInfo := make(map[string]longhorn.VolumeRecurringJobInfo)
bvName, exist := v.Labels[types.LonghornLabelBackupVolume]
if !exist {
log.Warn("Failed to find the backup vol... | [
0.2152349352836609,
-1.070334792137146,
0.4371238052845001,
-0.6307120323181152,
0.6176438331604004,
-0.1488867551088333,
-0.297904908657074,
0.016246289014816284,
-0.37254494428634644,
0.010674246586859226,
0.18199439346790314,
-0.39259377121925354,
-0.8476061224937439,
-0.885021865367889... |
func (c *VolumeController) shouldRestoreRecurringJobs(v *longhorn.Volume) bool {
if v.Spec.FromBackup == "" || v.Spec.Standby || v.Status.RestoreInitiated {
return false
}
if v.Spec.RestoreVolumeRecurringJob == longhorn.RestoreVolumeRecurringJobEnabled {
return true
}
if v.Spec.RestoreVolumeRecurringJob == l... | [
0.3024211525917053,
-0.29279884696006775,
0.5908467173576355,
-0.1275864690542221,
0.3180181682109833,
-0.07472703605890274,
-0.30443742871284485,
-0.21331404149532318,
-0.1920163482427597,
-0.3200651705265045,
0.1095503568649292,
-0.1224038377404213,
-1.1108100414276123,
-0.90133988857269... |
func (c *VolumeController) isResponsibleFor(v *longhorn.Volume, defaultEngineImage string) (bool, error) {
var err error
defer func() {
err = errors.Wrap(err, "error while checking isResponsibleFor")
}()
readyNodesWithDefaultEI, err := c.ds.ListReadyNodesWithEngineImage(defaultEngineImage)
if err != nil {
ret... | [
-0.5190467238426208,
-0.13301916420459747,
0.8153161406517029,
-0.256978839635849,
0.40055254101753235,
-0.31761130690574646,
-0.010786730796098709,
0.46932196617126465,
-0.0437200702726841,
0.2848689556121826,
0.3193143606185913,
-0.15697164833545685,
0.09164288640022278,
0.86457490921020... |
func (c *VolumeController) enqueueVolumesForShareManager(obj interface{}) {
sm, isShareManager := obj.(*longhorn.ShareManager)
if !isShareManager {
deletedState, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
utilruntime.HandleError(fmt.Errorf("received unexpected obj: %#v", obj))
return
}
// use ... | [
0.46745583415031433,
-0.639754593372345,
0.6902162432670593,
0.047629572451114655,
0.4051075875759125,
-0.26933395862579346,
-0.33756059408187866,
0.1483898162841797,
1.0015395879745483,
-0.2527652084827423,
0.18112298846244812,
0.4917980432510376,
0.04002318158745766,
1.0861760377883911,
... |
func (c *VolumeController) ReconcileShareManagerState(volume *longhorn.Volume) error {
log := getLoggerForVolume(c.logger, volume)
sm, err := c.ds.GetShareManager(volume.Name)
if err != nil && !apierrors.IsNotFound(err) {
return errors.Wrapf(err, "failed to get share manager for volume %v", volume.Name)
}
if vo... | [
-0.4234485924243927,
-0.8873384594917297,
0.9083194732666016,
-0.2720271050930023,
0.06268776953220367,
-0.4515954256057739,
-0.20383116602897644,
-0.04120497405529022,
0.34006020426750183,
0.35417819023132324,
0.31932979822158813,
-0.0528518408536911,
-0.07389626652002335,
0.4618055820465... |
func (c *VolumeController) enqueueVolumesForBackupVolume(obj interface{}) {
bv, isBackupVolume := obj.(*longhorn.BackupVolume)
if !isBackupVolume {
deletedState, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
utilruntime.HandleError(fmt.Errorf("received unexpected obj: %#v", obj))
return
}
// use ... | [
0.1712466925382614,
-0.7178488373756409,
1.013645052909851,
-0.2655318081378937,
0.5390281677246094,
-0.5560286641120911,
-0.09904869645833969,
-0.017610661685466766,
0.6333432197570801,
0.36380472779273987,
0.09203124791383743,
0.1638573408126831,
0.15145979821681976,
0.10015955567359924,... |
func (c *VolumeController) ReconcileBackupVolumeState(volume *longhorn.Volume) error {
log := getLoggerForVolume(c.logger, volume)
// Update last backup for the DR/restore volume or
// update last backup for the volume name matches backup volume name
var backupVolumeName string
if volume.Status.RestoreRequired {
... | [
0.2798537015914917,
-0.7156693339347839,
1.057314157485962,
-0.5097026228904724,
0.4186565577983856,
-0.8591612577438354,
-0.5822135210037231,
0.5383061766624451,
0.6457940936088562,
0.17359085381031036,
0.4936693608760834,
-0.5800966024398804,
-0.3520558476448059,
-0.0593448244035244,
0... |
func (c *VolumeController) createSnapshot(snapshotName string, labels map[string]string, volume *longhorn.Volume, e *longhorn.Engine) (*longhorn.SnapshotInfo, error) {
if volume.Name == "" {
return nil, fmt.Errorf("volume name required")
}
if err := util.VerifySnapshotLabels(labels); err != nil {
return nil, er... | [
-0.30436745285987854,
-0.4612170457839966,
0.7132699489593506,
-0.5580306053161621,
0.3346935510635376,
-0.3240920901298523,
-0.7429556846618652,
-0.7549745440483093,
-0.5031673908233643,
-0.3213821351528168,
0.3475944697856903,
-1.0089161396026611,
-0.05765921622514725,
-0.015480852685868... |
func (c *VolumeController) ReconcilePersistentVolume(volume *longhorn.Volume) error {
log := getLoggerForVolume(c.logger, volume)
kubeStatus := volume.Status.KubernetesStatus
if kubeStatus.PVName == "" {
return nil
}
pv, err := c.ds.GetPersistentVolume(kubeStatus.PVName)
if err != nil {
if apierrors.IsNotFo... | [
-0.12449701875448227,
-1.3598839044570923,
0.7125107049942017,
-0.18961487710475922,
0.5546687245368958,
-0.2198924720287323,
-0.4385335147380829,
0.4919043481349945,
0.19034036993980408,
0.4122682511806488,
0.6870753169059753,
0.2356652170419693,
-0.31639349460601807,
0.6364269256591797,
... |
func messageResponse(w http.ResponseWriter, s int, m string) {
w.WriteHeader(s)
if m == "" {
return
}
b, err := json.Marshal(errorMessage{m})
if err != nil {
fmt.Fprintf(os.Stderr, "Could not wrap message in JSON: %s", m)
return
}
w.Write(b)
} | [
-0.2962341606616974,
-0.29790762066841125,
0.47727400064468384,
-1.009855031967163,
0.0823872834444046,
-0.9624797701835632,
-0.5432727932929993,
-0.6945882439613342,
0.27269038558006287,
0.4009424149990082,
0.1998719722032547,
-0.5173336267471313,
-0.1678036004304886,
-0.05874909088015556... |
func Serve(db db.Database) {
port := os.Getenv("PORT")
if port == "" {
log.Output(2, "No PORT environment variable found, using 8000.")
port = ":8000"
}
if !strings.HasPrefix(port, ":") {
port = ":" + port
}
nr := newRelicApp()
app := api{db: db}
http.HandleFunc(newRelicHandle(nr, "/", app.companyHandle... | [
0.45892560482025146,
-0.22693637013435364,
0.5533934235572815,
0.09177426248788834,
0.993651807308197,
0.4131357967853546,
0.08299167454242706,
0.36618664860725403,
-0.8404196500778198,
0.10081397742033005,
-0.40047892928123474,
-0.12792879343032837,
-0.4333573281764984,
0.2788095772266388... |
func (q *Query) Having(constraints ...SQLProvider) *Query {
if q.having == nil {
q.having = new(constraint)
q.having.gate = gate_and
}
q.having.children = append(q.having.children, constraints...)
return q
} | [
0.2580614387989044,
0.3538397550582886,
0.4554632008075714,
0.5467373132705688,
-0.0409516878426075,
0.765466034412384,
-0.428876131772995,
-0.02766702137887478,
0.2601783275604248,
-0.07300258427858353,
-0.22543783485889435,
-0.016229717060923576,
-0.4794941246509552,
0.37906789779663086,... |
func getProjectNameOrTenantName(configVarResolver *providerconfig.ConfigVarResolver, rawConfig *openstacktypes.RawConfig) (string, error) {
projectName, err := configVarResolver.GetConfigVarStringValueOrEnv(rawConfig.ProjectName, envOSProjectName)
if err == nil && len(projectName) > 0 {
return projectName, nil
}
... | [
-0.6952995657920837,
-0.2181147038936615,
0.3485526144504547,
-0.08551443368196487,
-0.46302154660224915,
0.2055751085281372,
-0.053318120539188385,
-0.22846153378486633,
-0.1869194209575653,
0.8775483965873718,
0.7769569158554077,
-0.14623646438121796,
-0.014659921638667583,
0.24855956435... |
func getProjectIDOrTenantID(configVarResolver *providerconfig.ConfigVarResolver, rawConfig *openstacktypes.RawConfig) (string, error) {
projectID, err := configVarResolver.GetConfigVarStringValueOrEnv(rawConfig.ProjectID, envOSProjectID)
if err == nil && len(projectID) > 0 {
return projectID, nil
}
// fallback t... | [
-0.2692600190639496,
-0.24341149628162384,
0.4056398272514343,
-0.3761594593524933,
-0.1372849941253662,
0.684579074382782,
-0.09718893468379974,
-0.012462960556149483,
0.33800458908081055,
0.7747833132743835,
0.7751265168190002,
0.46388983726501465,
-0.13401149213314056,
-0.02253497764468... |
func DeployVestingContract(testenv *Testenv, levToken common.Address, dateTime common.Address, receiver common.Address) (common.Address, *vesting.Vesting, error) {
_, tx, contract, err := vesting.DeployVesting(testenv.Auth, testenv, levToken, dateTime, testenv.Auth.From)
if err != nil {
return common.Address{}, nil... | [
-0.37412720918655396,
-0.3733764886856079,
0.6435871720314026,
-0.036251556128263474,
0.5963425040245056,
0.07550445199012756,
-0.06010352075099945,
-0.03400902450084686,
0.2250520884990692,
0.3869543969631195,
-0.16001319885253906,
0.22022081911563873,
-0.3299371898174286,
0.4597851634025... |
func CreateStdHandle(name string, store Store, a Archiver, del HandleDelegate) (*StdHandle, error) {
if store == nil || a == nil {
return nil, errors.New("store")
}
return &StdHandle{name: name, store: store, archiver: a, delegate: del}, nil
} | [
0.9475885033607483,
0.20213682949543,
0.29206863045692444,
0.20496508479118347,
-0.22129151225090027,
0.6731452941894531,
-0.4322347342967987,
0.41877761483192444,
0.054830413311719894,
0.09899093955755234,
0.13473005592823029,
-0.15759699046611786,
-0.580838143825531,
0.060195572674274445... |
func (h *StdHandle) Name() string { return h.name } | [
0.04071957617998123,
-0.41375526785850525,
0.4178689122200012,
-0.10320641100406647,
-0.6491286158561707,
1.3305696249008179,
0.3658817708492279,
-0.6062771081924438,
-0.9233162999153137,
0.6981446146965027,
-0.1097351461648941,
-0.3775600790977478,
-0.3899257779121399,
0.07997073233127594... |
func (h *StdHandle) Clear(ctx context.Context, reporter Reporter) (err error) {
if err = h.archiver.Index(func(k string) error {
if err = h.store.Del(ctx, k); err != nil {
return errors.Wrap(err, "failed to delete object key")
}
reporter.HandledKey(k)
//@TODO inform reporter
return nil
}); err != nil ... | [
-0.18769973516464233,
0.7570035457611084,
0.6719565391540527,
-0.1267348676919937,
0.19669431447982788,
0.9932854175567627,
0.3176908791065216,
-0.5156998038291931,
0.21182189881801605,
-0.03586818277835846,
0.7636446952819824,
0.23798537254333496,
0.1694238930940628,
0.3511161208152771,
... |
func (h *StdHandle) Push(ctx context.Context, fromPath string, rep Reporter) (err error) {
wc := &writeCounter{}
if err = h.archiver.Archive(ctx, fromPath, rep, func(k string, r io.ReadSeeker, nbytes int64) error {
//push bytes while counting the total number being pushed across all objects
defer rep.StopUpload... | [
0.4300067722797394,
0.5664394497871399,
0.7742262482643127,
-0.3745664954185486,
-0.16381953656673431,
0.2668350338935852,
0.5795583724975586,
0.21942058205604553,
-0.18906371295452118,
0.5066494345664978,
-0.37800708413124084,
0.8168584108352661,
-0.2624792754650116,
0.06374907493591309,
... |
func (h *StdHandle) Pull(ctx context.Context, toPath string, rep Reporter) (err error) {
if err = h.archiver.Unarchive(ctx, toPath, rep, func(k string, w io.WriterAt) error {
var total int64
total, err = h.store.Head(ctx, k)
if err != nil {
return errors.Wrap(err, "failed to get object metadata")
}
pw :... | [
-0.15443220734596252,
-0.09674288332462311,
0.8695800304412842,
-0.5248950123786926,
-0.10160760581493378,
0.37979188561439514,
0.4070395231246948,
0.40304210782051086,
0.28425562381744385,
-0.5246766805648804,
0.2227746844291687,
0.13941144943237305,
-0.17040638625621796,
-0.5237200260162... |
func (h *StdHandle) Close() (err error) {
if h.delegate != nil {
if err = h.delegate.PostClose(); err != nil {
return errors.Wrap(err, "failed to run post close delegate")
}
}
return nil
} | [
0.5351496934890747,
0.47462400794029236,
0.7810366749763489,
-0.15581479668617249,
-0.38905471563339233,
0.9995711445808411,
0.24275822937488556,
-0.6634560227394104,
-0.9004226326942444,
-0.5889096856117249,
0.26766151189804077,
-0.060890231281518936,
-1.2157949209213257,
0.86661869287490... |
func TestMap(t *testing.T) {
// test the degrees, cardinality, and string representation
doubleQty := func(tup1 orderTup) orderTup {
return orderTup{tup1.PNO, tup1.SNO, tup1.Qty * 2}
}
mapKeys := [][]string{
[]string{"PNO", "SNO"},
}
rel := orders().Map(doubleQty, mapKeys)
type distinctTup struct {
PNO i... | [
-0.7171034216880798,
0.45462048053741455,
0.9459920525550842,
0.03620953485369682,
-0.10693608224391937,
0.12238236516714096,
0.5024505853652954,
-0.3333907425403595,
0.8688700795173645,
-0.8641570806503296,
-0.10101611912250519,
-0.8256505131721497,
0.7395786643028259,
-1.1867121458053589... |
func SetLogLevel(lvl logrus.Level) {
Log.Level = lvl
} | [
-0.32245659828186035,
0.1766359806060791,
0.32184696197509766,
0.2833574414253235,
0.07289775460958481,
1.0237116813659668,
-0.5106817483901978,
0.3500153422355652,
-0.1931038349866867,
-0.626925528049469,
-1.8384454250335693,
1.261642575263977,
0.2400960624217987,
0.8846837878227234,
-0... |
func preProcessBazel(filer snapshot.Filer, cmd *runner.Command, rts *runTimes) (*bazelapi.ActionResult, []*remoteexecution.Digest, error) {
notExist := []*remoteexecution.Digest{}
bzFiler, ok := filer.(*bzsnapshot.BzFiler)
if !ok {
return nil, notExist, fmt.Errorf("Filer could not be asserted as type BzFiler. Typ... | [
0.07609439641237259,
-0.7207371592521667,
0.7808588147163391,
0.5357033014297485,
0.5702669024467468,
-0.06500206887722015,
0.40914830565452576,
-0.38231968879699707,
0.2996557354927063,
0.11799824237823486,
0.31184375286102295,
0.10243204981088638,
-0.19522015750408173,
1.6965986490249634... |
func fetchBazelCommandData(bzFiler *bzsnapshot.BzFiler, cmd *runner.Command, rts *runTimes) ([]*remoteexecution.Digest, error) {
casCli := cas.MakeCASClient()
notExist := []*remoteexecution.Digest{}
log.Info("Fetching Bazel Action data from CAS server")
rts.actionFetchStart = stamp()
actionDigest := cmd.ExecuteRe... | [
0.2663934528827667,
-0.8456037640571594,
0.6441115736961365,
0.5014212131500244,
-0.10109524428844452,
0.2708863615989685,
-0.06389348953962326,
-0.06704666465520859,
0.08369915932416916,
0.031203025951981544,
-0.5911697149276733,
1.2407275438308716,
0.2666008174419403,
1.5636636018753052,... |
func createOutputPaths(cmd *runner.Command, coDir string) error {
for _, relPath := range cmd.ExecuteRequest.GetCommand().GetOutputFiles() {
dir := filepath.Dir(filepath.Join(coDir, relPath))
err := os.MkdirAll(dir, 0777)
if err != nil {
return fmt.Errorf("Failed to create parent output dir %s: %s", dir, err)... | [
-0.03589261695742607,
0.1642066389322281,
0.7356197237968445,
0.6158508658409119,
0.22883465886116028,
0.5582943558692932,
1.509212851524353,
-0.8178813457489014,
-0.8039669990539551,
-0.10604053735733032,
0.6976104378700256,
-0.877894401550293,
-0.08163591474294662,
0.33223840594291687,
... |
func postProcessBazel(filer snapshot.Filer,
cmd *runner.Command,
coDir string,
stdout, stderr runner.Output,
st execer.ProcessStatus,
rts *runTimes,
rID runner.RunnerID,
) (*bazelapi.ActionResult, error) {
bzFiler, ok := filer.(*bzsnapshot.BzFiler)
if !ok {
return nil, fmt.Errorf("Filer could not be asserted ... | [
0.3713126480579376,
-0.40683332085609436,
0.6323224902153015,
0.5042726397514343,
-0.0863705649971962,
-0.1538216471672058,
1.351840615272522,
-0.4568992555141449,
-0.1335727870464325,
-0.2647664248943329,
0.2459157109260559,
-0.16850270330905914,
0.12044206261634827,
1.1485787630081177,
... |
func writeFileToCAS(bzFiler *bzsnapshot.BzFiler, path string) (*remoteexecution.Digest, error) {
bytes, err := ioutil.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("Error reading file %s as bytes: %s", path, err)
}
sha := fmt.Sprintf("%x", sha256.Sum256(bytes))
digest := &remoteexecution.Digest{Hash: sha... | [
-0.3069050908088684,
-0.5996391177177429,
0.466555118560791,
-0.5249117612838745,
0.010222186334431171,
-0.36517298221588135,
0.15516142547130585,
0.016772551462054253,
-0.06470416486263275,
0.10800091177225113,
-0.44401055574417114,
-0.14192157983779907,
-0.024019137024879456,
0.143545940... |
func ingestOutputFiles(bzFiler *bzsnapshot.BzFiler, cmd *runner.Command, coDir string) ([]*remoteexecution.OutputFile, error) {
outputFiles := []*remoteexecution.OutputFile{}
for _, relPath := range cmd.ExecuteRequest.GetCommand().GetOutputFiles() {
absPath := filepath.Join(coDir, relPath)
info, err := os.Stat(ab... | [
0.08923695981502533,
-0.4749875068664551,
0.7674286365509033,
0.3281888961791992,
0.3013709783554077,
0.2295609563589096,
0.7346420884132385,
-0.08033692836761475,
-0.6904388666152954,
1.017686128616333,
0.6085976958274841,
-0.4941242039203644,
-0.7494332194328308,
0.7083913683891296,
-0... |
func ingestOutputDirs(bzFiler *bzsnapshot.BzFiler, cmd *runner.Command, coDir string) ([]*remoteexecution.OutputDirectory, error) {
outputDirs := []*remoteexecution.OutputDirectory{}
for _, relPath := range cmd.ExecuteRequest.GetCommand().GetOutputDirectories() {
absPath := filepath.Join(coDir, relPath)
info, err... | [
-0.5171130299568176,
-0.2711634933948517,
0.7310170531272888,
0.026729794219136238,
0.18969331681728363,
-0.18274426460266113,
0.6034015417098999,
-0.32264846563339233,
0.06790287792682648,
0.7390570044517517,
0.7530375123023987,
-0.17474918067455292,
-0.2731405794620514,
0.623661398887634... |
func ingestPath(bzFiler *bzsnapshot.BzFiler, absPath string) (*remoteexecution.Digest, error) {
id, err := bzFiler.Ingest(absPath)
if err != nil {
return nil, fmt.Errorf("Error Ingesting output file %s: %s", absPath, err)
}
digest, err := bazel.DigestFromSnapshotID(id)
if err != nil {
return nil, fmt.Errorf("E... | [
0.42842376232147217,
-0.38179290294647217,
0.6870095133781433,
0.11961326003074646,
-0.5953200459480286,
0.12146061658859253,
0.05017122998833656,
-0.6404642462730408,
-0.08796659857034683,
0.6552786827087402,
0.4299050271511078,
-0.3888954222202301,
-0.6389057040214539,
0.2262066453695297... |
func getFailedPreconditionStatus(notExist []*remoteexecution.Digest) (*google_rpc_status.Status, error) {
pcf := &google_rpc_errdetails.PreconditionFailure{
Violations: []*google_rpc_errdetails.PreconditionFailure_Violation{},
}
for _, ne := range notExist {
pcf.Violations = append(pcf.Violations, &google_rpc_e... | [
-0.4282578229904175,
-0.43531063199043274,
0.5537611842155457,
-0.3816070258617401,
-0.049378473311662674,
0.19108527898788452,
0.025173626840114594,
-0.5180185437202454,
-0.3266797363758087,
0.06310084462165833,
-0.842995822429657,
0.39953526854515076,
-1.244730830192566,
0.90572774410247... |
func getCheckoutMissingStatus(snapshotID string) (*google_rpc_status.Status, error) {
inputRoot, err := bazel.DigestFromSnapshotID(snapshotID)
if err != nil {
return nil, fmt.Errorf("Failed to convert SnapshotID %s to Digest: %s", snapshotID, err)
}
return getFailedPreconditionStatus([]*remoteexecution.Digest{inp... | [
-0.786506175994873,
-0.31308236718177795,
0.4528207778930664,
-0.4957727789878845,
-0.2886176109313965,
0.2108028084039688,
-0.10023196786642075,
0.47995010018348694,
0.7314255833625793,
0.1328895390033722,
-0.3847709596157074,
-0.25890806317329407,
-0.16432395577430725,
1.005330204963684,... |
func NewConfig(address string) *Config {
return &Config{
Address: address,
Namespace: "",
Insecure: false,
}
} | [
0.7133191823959351,
0.5322092175483704,
0.028061440214514732,
0.10251115262508392,
-1.3679592609405518,
-0.07515791803598404,
-0.5501095652580261,
0.7154979109764099,
0.7366388440132141,
0.24432633817195892,
-0.4654235243797302,
0.9840890765190125,
0.0741766020655632,
0.45061376690864563,
... |
func NewParser(rules []*rule.Rule, ignorer *ignore.Ignore) *Parser {
return &Parser{
Rules: rules,
Ignorer: ignorer,
rchan: make(chan result.FileResults),
}
} | [
0.8350929021835327,
-1.0003858804702759,
0.10141875594854355,
0.11946109682321548,
-0.243533656001091,
0.3249005377292633,
-0.04459173604846001,
-0.05505485460162163,
-0.12128462642431259,
-0.06730202585458755,
0.40514126420021057,
0.010069785639643669,
-0.8659833073616028,
0.7287489175796... |
func (p *Parser) ParsePaths(print printer.Printer, paths ...string) int {
// data provided through stdin
if util.InSlice(os.Stdin.Name(), paths) {
r, _ := p.generateFileViolations(os.Stdin)
if r.Len() > 0 {
print.Print(output.Stdout, r)
}
return r.Len()
}
if len(paths) == 0 {
paths = DefaultPath
}
v... | [
0.19188180565834045,
0.7315574288368225,
0.9351761341094971,
0.6104479432106018,
0.02377006970345974,
-0.15535388886928558,
0.9276021718978882,
-0.23636594414710999,
-0.7098192572593689,
-0.597762405872345,
0.5627065300941467,
-0.4405330717563629,
-0.8278757333755493,
0.9768818020820618,
... |
func (s SQLError) GetQuery() string {
return s.sql
} | [
0.7671516537666321,
-0.22242048382759094,
0.1301409751176834,
0.8451740145683289,
-0.3532923758029938,
-0.00292781600728631,
-0.8273441195487976,
0.18784135580062866,
0.7221834063529968,
-0.5824268460273743,
0.683829665184021,
0.39612746238708496,
0.1731119453907013,
-0.09003996104001999,
... |
func (s NoRowsAffected) GetQuery() string {
return s.sql
} | [
0.96125727891922,
-0.15216848254203796,
0.26330795884132385,
0.5661409497261047,
-0.2643027901649475,
0.1841973215341568,
-0.04122335463762283,
-0.0007349902880378067,
0.9823851585388184,
-0.8669352531433105,
0.6154347062110901,
0.4775169789791107,
-0.15767687559127808,
0.28831174969673157... |
func NewNoRowsAffected(sql string) error {
return NoRowsAffected{sql: sql}
} | [
0.6492016315460205,
0.06412900984287262,
-0.2845112085342407,
-0.7420293688774109,
-1.3313724994659424,
-0.73259437084198,
-0.09205657988786697,
-0.4857281744480133,
0.6845864057540894,
-0.5631999373435974,
-0.3600549101829529,
0.31501418352127075,
-0.4749842882156372,
1.0409570932388306,
... |
func (nums *Numbers) Add(n *Number) {
if n == nil {
return
}
nums.values = append(nums.values, n)
} | [
-0.705895721912384,
0.3619879186153412,
0.16843721270561218,
0.18723049759864807,
1.1865535974502563,
0.5598419308662415,
-0.37605521082878113,
0.20591989159584045,
1.1898984909057617,
-0.8623361587524414,
-0.23497577011585236,
0.79368656873703,
0.3715169131755829,
1.7204818725585938,
0.... |
func NewLibstore(masterServerHostPort, myHostPort string, mode LeaseMode) (Libstore, error) {
ls := new(libstoreServer)
ls.MyHostPort = myHostPort
ls.ssRPC = make(map[string]*rpc.Client)
ls.Cache = make(map[string]cacheitem)
ls.KeyRecord = make(map[string][]time.Time)
ls.LeaseMode = mode
ls.Ready = make(chan st... | [
0.06949912011623383,
-0.4612319767475128,
0.8416287899017334,
-0.214507594704628,
-0.17007027566432953,
0.4533514976501465,
0.16049686074256897,
-0.1640150099992752,
-0.028019804507493973,
-0.028282530605793,
-0.7043889760971069,
0.15451572835445404,
-0.7911666035652161,
0.6546745896339417... |
func (ls *libstoreServer) CacheHandler() {
for {
select {
case key := <-ls.checkCache:
CacheItem := ls.CheckCache(key)
ls.checkCacheReply <- CacheItem
case key := <-ls.revokeCache:
delete(ls.Cache, key)
ls.CacheReply <- true
case pack := <-ls.addCache:
ls.Cache[pack.Key] = pack.Item
ls.CacheR... | [
-0.15134264528751373,
-0.23997655510902405,
0.4783945679664612,
0.05677398294210434,
-0.2707092761993408,
0.12831905484199524,
-0.20532900094985962,
0.7076493501663208,
0.9620739817619324,
0.42397016286849976,
0.2637653648853302,
-0.28825643658638,
-1.0394667387008667,
0.7293843030929565,
... |
func (ls *libstoreServer) CheckCache(key string) cacheitem {
item, found := ls.Cache[key]
if found { // item already in cache
return item
}
status := ls.CheckRecord(key)
ItemReturn := &cacheitem{Status: status}
// ItemReturn = &cacheitem{Status: status, Item: item}
return *ItemReturn
} | [
-0.7837490439414978,
-0.5393323302268982,
0.37081581354141235,
0.547784686088562,
-0.7522048354148865,
-0.08149919658899307,
-0.46638843417167664,
0.6049954891204834,
0.3428681492805481,
0.7254512310028076,
-0.18991906940937042,
-0.3790237009525299,
-1.1294891834259033,
0.25768253207206726... |
func (ls *libstoreServer) CheckRecord(key string) CacheStatus {
record, found := ls.KeyRecord[key]
if !found {
record = make([]time.Time, 0)
}
if len(record) < storagerpc.QueryCacheThresh {
record = append(record, time.Now())
ls.KeyRecord[key] = record // update record
return SendQuery
}
// check timestam... | [
-0.22351908683776855,
0.0975230261683464,
0.611750066280365,
-0.3751424551010132,
-0.5395895838737488,
0.5489649176597595,
-0.5623347759246826,
-0.177004873752594,
-0.0920606479048729,
0.9631040692329407,
0.21672601997852325,
0.27781787514686584,
-0.8568671345710754,
0.8218007683753967,
... |
func (ls *libstoreServer) RegisterStorageRPC() error {
for _, node := range ls.ServerNodes {
if _, found := ls.ssRPC[node.HostPort]; !found {
ssRPC, err := rpc.DialHTTP("tcp", node.HostPort)
if err != nil {
return err
}
ls.ssRPC[node.HostPort] = ssRPC // add rpc client
}
}
return nil
} | [
0.049115318804979324,
0.11765223741531372,
0.6069737672805786,
-0.3720301687717438,
1.340690016746521,
0.23570862412452698,
0.051842086017131805,
-0.8218260407447815,
-0.4493960738182068,
0.25509849190711975,
-0.40977948904037476,
0.2326183170080185,
-1.056064486503601,
0.3797546923160553,... |
func (ls *libstoreServer) FindRPC(key string) *rpc.Client {
NodeNum := StoreHash(key)
for _, ServerNode := range ls.ServerNodes {
if ServerNode.NodeID >= NodeNum {
return ls.ssRPC[ServerNode.HostPort]
}
}
// if cannot find, choose the first node
return ls.ssRPC[ls.ServerNodes[0].HostPort]
} | [
0.4596043825149536,
0.054940491914749146,
0.7223982214927673,
-0.9518260955810547,
0.1525207757949829,
-0.32737746834754944,
0.5371008515357971,
-1.1895720958709717,
0.012428064830601215,
-0.040750112384557724,
0.7109019756317139,
0.6038597822189331,
-1.5565530061721802,
0.6434983015060425... |
func (ls *libstoreServer) leaseMode(wantlease bool) bool {
switch ls.LeaseMode {
case Never:
return false
case Always:
return true
case Normal:
return wantlease
}
return wantlease
} | [
-0.8222249746322632,
-0.0004068081034347415,
0.5573603510856628,
-0.317381352186203,
-0.5970637798309326,
0.8182494640350342,
-0.8580039143562317,
1.0920660495758057,
0.024098772555589676,
-0.33305996656417847,
-0.17368358373641968,
-0.010586517862975597,
-0.973577082157135,
0.428364932537... |
func (p MemberProfile) Characters() []string {
return p.Response.Profile.Data.CharacterIDs
} | [
-0.0452672615647316,
-0.8895161747932434,
0.044695522636175156,
-0.2847677171230316,
0.7384691834449768,
0.9397398829460144,
-1.020293951034546,
-0.7784361243247986,
0.8107252717018127,
-0.1594896763563156,
-0.824481189250946,
0.7694090604782104,
-0.962527334690094,
-0.9168848991394043,
... |
func (commandContext *CmdContext) Render(presentable presenters.Presentable) error {
presenter := &presenters.Presenter{
Item: presentable,
Out: os.Stdout,
Opts: presenters.Options{
AsJSON: commandContext.OutputJSON(),
},
}
return presenter.Render()
} | [
-0.08891928941011429,
-1.0509634017944336,
0.43133866786956787,
-0.21290014684200287,
-0.4974583685398102,
0.37461820244789124,
-0.4794451892375946,
0.0036887931637465954,
0.13957934081554413,
0.1462150663137436,
0.7882313132286072,
-0.4504387378692627,
-0.6533907055854797,
0.5008618235588... |
func (commandContext *CmdContext) Frender(views ...PresenterOption) error {
// If JSON output wanted, set in all views
if commandContext.OutputJSON() {
for i := range views {
views[i].AsJSON = true
}
}
return commandContext.render(commandContext.IO.Out, views...)
} | [
-0.11962063610553741,
-0.05639202147722244,
0.5044856667518616,
0.232781782746315,
-0.5090548396110535,
-0.42082124948501587,
0.5934408903121948,
-0.20978575944900513,
0.48153868317604065,
-0.9304404854774475,
0.9081669449806213,
-0.5884770750999451,
-0.13376694917678833,
1.676111102104187... |
func (commandContext *CmdContext) FrenderPrefix(prefix string, views ...PresenterOption) error {
// If JSON output wanted, set in all views
p := textio.NewPrefixWriter(commandContext.IO.Out, " ")
if commandContext.OutputJSON() {
for i := range views {
views[i].AsJSON = true
}
}
return commandContext.re... | [
-0.633409321308136,
-0.05753803253173828,
0.5789060592651367,
-0.19690440595149994,
-0.8443387746810913,
-0.9934958219528198,
0.3956347405910492,
0.24276407063007355,
0.5897032022476196,
-0.10076150298118591,
0.3526240885257721,
0.028274664655327797,
0.003926439210772514,
1.236597061157226... |
func (h *RPCHandler) GenerateNodeToken(ctx context.Context, req *tokenauth.NodeTokenRequest) (*tokenauth.NodeTokenResponse, error) {
token, err := h.TokenAuthService.GenerateNodeToken(req.Audience, req.ValidityStart, req.ValidityEnd)
if err != nil {
return nil, fmt.Errorf("Error generating token: %v", err)
}
log.... | [
-1.618416666984558,
-0.18047432601451874,
0.3896547257900238,
-0.48102447390556335,
0.029149126261472702,
0.3965893089771271,
-0.034074824303388596,
0.2529856860637665,
0.040569327771663666,
-0.037763822823762894,
-0.7590457201004028,
1.0731796026229858,
-0.3797530233860016,
0.295847147703... |
func (h *RPCHandler) AutoWatchSvcTokenAuthV1(*api.AggWatchOptions, tokenauth.TokenAuthV1_AutoWatchSvcTokenAuthV1Server) error {
return fmt.Errorf("AutoWatchSvcTokenAuth not implemented")
} | [
-0.20971131324768066,
-0.1780761331319809,
0.5364982485771179,
0.8371589779853821,
-0.14474591612815857,
0.24241642653942108,
0.481576144695282,
0.6172789335250854,
0.0570976585149765,
0.7799860239028931,
-0.1569032222032547,
2.3308167457580566,
0.2908276915550232,
-0.16697506606578827,
... |
func NewRPCHandler(svc types.TokenAuthService) *RPCHandler {
return &RPCHandler{
TokenAuthService: svc,
}
} | [
0.20259512960910797,
0.4728442430496216,
0.0536782406270504,
-0.6171197295188904,
-0.9368440508842468,
0.4781937599182129,
-0.8771658539772034,
-0.730099081993103,
0.8416359424591064,
0.13354092836380005,
0.2150535136461258,
0.7924305200576782,
-1.1993829011917114,
-0.044901292771101,
0.... |
func GetKeys(secretName, namespace string, c k8s.Interface) (priv, pub wgtypes.Key, err error) {
// first we check if a secret containing valid keys already exists
s, err := c.CoreV1().Secrets(namespace).Get(context.Background(), secretName, metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return... | [
-0.15672138333320618,
0.3814188539981842,
0.6255083680152893,
-0.35989001393318176,
0.9352294206619263,
-0.9498123526573181,
-1.008577585220337,
-0.43800950050354004,
-0.34357163310050964,
0.9746336340904236,
-0.6549158692359924,
1.2795644998550415,
-0.6508695483207703,
0.7605651021003723,... |
func firstUnexpectedRune(line string) (unexpected rune) {
// we push a closing rune on here for every opening rune
// when we find a closing rune, it should be the top of the stack
// or we found a syntax error.
stack := []rune{}
for _, r := range line {
switch r {
// openers
case '(':
stack = append(stac... | [
0.25445470213890076,
0.14685767889022827,
0.6635169982910156,
-0.34921878576278687,
0.11837735772132874,
-0.9141151309013367,
-0.1947355419397354,
0.32154712080955505,
-0.6037340760231018,
-0.4362122416496277,
0.1331951767206192,
0.27790114283561707,
0.046855468302965164,
0.294276982545852... |
func solve1(input string) string {
points := map[rune]int{
')': 3,
']': 57,
'}': 1197,
'>': 25137,
}
score := 0
aoc.MapLines(input, func(line string) error {
r := firstUnexpectedRune(line)
//fmt.Printf("line %q unexpected: %c (score: %d)\n", line, r, points[r])
score += points[r]
return nil
})
re... | [
-0.31417176127433777,
-0.49919775128364563,
0.9030762910842896,
0.09400111436843872,
0.18936190009117126,
0.6010468006134033,
0.5007964968681335,
0.02708343043923378,
-0.1629735231399536,
0.24887162446975708,
0.0610651858150959,
-0.08153282850980759,
0.2930241525173187,
-0.2581534385681152... |
func solve2(input string) string {
scores := []int{}
aoc.MapLines(input, func(line string) error {
s := scoreIncompleteCompletion(line)
if s > 0 {
scores = append(scores, s)
//fmt.Printf("line %q (score: %d)\n", line, s)
}
return nil
})
// sort and take the center value.
sort.Ints(scores)
mid := sc... | [
-0.15756741166114807,
-1.2241090536117554,
0.6924508810043335,
-0.01685745269060135,
-0.4031517505645752,
-0.004651753697544336,
0.6078460812568665,
-0.7651676535606384,
-0.264154851436615,
0.18940074741840363,
0.5275360345840454,
-0.08984711766242981,
0.12307151407003403,
0.30591511726379... |
func scoreIncompleteCompletion(line string) (score int) {
// same as the other, but we score 0 for an invalid line.
// and use the stack for the scoring (it will hold the correct closing tags)
stack := []rune{}
for _, r := range line {
switch r {
// openers
case '(':
stack = append(stack, ')')
case '{':
... | [
-0.29490941762924194,
-0.46364742517471313,
0.8560099005699158,
-0.46879059076309204,
-0.22909726202487946,
-0.7741560935974121,
1.4069312810897827,
-0.02734748087823391,
-0.8188058137893677,
0.6272826790809631,
-0.3087340295314789,
-0.9045048356056213,
-0.7114706635475159,
-0.010191083885... |
func NewContainer() *IContainer {
return &IContainer{
mutex: &sync.RWMutex{},
data: make(map[string]*injectionDef),
}
} | [
0.36930403113365173,
0.17437200248241425,
0.0435868501663208,
-0.44305533170700073,
-0.7854587435722351,
-0.5578597784042358,
0.6633131504058838,
-0.7516505122184753,
-0.21045570075511932,
-0.39157503843307495,
-0.21174868941307068,
0.45762869715690613,
-0.4573938846588135,
0.6260256767272... |
func (i *IContainer) Clone(w http.ResponseWriter, r *http.Request) *IClone {
return &IClone{
IContainer: i,
w: w,
r: r,
mutex: &sync.RWMutex{},
threadData: make(map[string]interface{}),
}
} | [
-0.19754035770893097,
-0.3379158675670624,
0.4481240212917328,
0.4896612763404846,
-0.7450321912765503,
-0.05779195576906204,
0.4034673571586609,
-1.1686254739761353,
-0.12601041793823242,
0.3645837903022766,
-0.007976141758263111,
-0.2235608547925949,
-1.1425256729125977,
-1.4897173643112... |
func (i *IContainer) Get(key string) interface{} {
v, _ := i.TryGet(key)
return v
} | [
-1.3321062326431274,
0.38283222913742065,
0.31605264544487,
-0.0171765498816967,
-0.17740972340106964,
-1.0425525903701782,
-0.15383316576480865,
-1.1427901983261108,
-0.5378615856170654,
0.1569068878889084,
-0.06649962812662125,
0.20669561624526978,
-0.2991504371166229,
-0.260184586048126... |
func (i *IContainer) TryGet(key string) (interface{}, bool) {
i.mutex.RLock()
v, ok := i.data[key]
if !ok {
// If no association exists, release the lock
// and return negative
i.mutex.RUnlock()
return nil, false
}
if v.obj == nil {
// if a factory function wasn't provided,
// then the injection ess... | [
-0.8412412405014038,
0.0426805354654789,
1.0905143022537231,
-0.5628309845924377,
0.05852189287543297,
-0.7925200462341309,
0.2999187111854553,
-0.5486947298049927,
-0.18048743903636932,
0.10246573388576508,
0.6783614158630371,
-0.10726112872362137,
-0.731999933719635,
-0.13601398468017578... |
func (i *IContainer) Set(key string, value interface{}) {
i.mutex.Lock()
defer i.mutex.Unlock()
i.data[key] = &injectionDef{obj: value, lifetime: SINGLETON}
} | [
-0.6066741347312927,
0.901780366897583,
0.2570309042930603,
-0.6067784428596497,
0.0444570928812027,
-0.13750410079956055,
-0.1562327742576599,
-0.5630015134811401,
-0.571512758731842,
0.5420668721199036,
-0.56132572889328,
0.6972888708114624,
-0.6596969962120056,
0.24267935752868652,
0.... |
func (i *IContainer) Lazy(key string, fn FactoryFn, lifetime LifeTime) {
i.mutex.Lock()
defer i.mutex.Unlock()
i.data[key] = &injectionDef{fn: fn, lifetime: lifetime}
} | [
-0.5913347005844116,
0.9147074818611145,
0.3605954647064209,
-1.127712368965149,
0.10678747296333313,
-0.7661787867546082,
-0.6980631947517395,
-0.19074030220508575,
-0.23271287977695465,
-0.9551194310188293,
-0.9098467230796814,
0.6392513513565063,
0.2167879343032837,
-0.10642465204000473... |
func (i *IContainer) Delete(key string) {
i.mutex.Lock()
defer i.mutex.Unlock()
delete(i.data, key)
} | [
-0.3726620376110077,
0.891915500164032,
0.16499580442905426,
-0.2611526548862457,
-0.09660869836807251,
-0.34628811478614807,
0.28425389528274536,
-0.2501407265663147,
-0.05688871070742607,
0.451730877161026,
-0.09616408497095108,
-0.17403805255889893,
-1.1858690977096558,
-0.0523767694830... |
func (i *IContainer) Clear() {
i.mutex.Lock()
defer i.mutex.Unlock()
i.data = make(map[string]*injectionDef)
} | [
-0.5868031978607178,
0.7287713289260864,
0.12009307742118835,
-0.6395596861839294,
-0.16126425564289093,
0.20204775035381317,
-0.021759184077382088,
-1.2604905366897583,
-0.5483788847923279,
-0.1139337420463562,
0.3134421706199646,
1.0454943180084229,
-0.10296279191970825,
0.16388572752475... |
func (i *IClone) Get(key string) interface{} {
v, _ := i.TryGet(key)
return v
} | [
-1.1397569179534912,
0.7317577600479126,
0.4445295035839081,
0.09764976054430008,
-0.3084138035774231,
-1.0540903806686401,
-0.5497258305549622,
-0.7943178415298462,
-0.854301929473877,
0.5857105255126953,
-0.13177162408828735,
0.31987470388412476,
-0.9918279647827148,
-1.0422723293304443,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.