text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (m *podMetrics) NamespaceScoped() bool {
return true
} | [
0.5126004815101624,
-0.03503715246915817,
0.6125760078430176,
-0.1130150556564331,
0.1115981787443161,
1.405279278755188,
0.05877010524272919,
-1.0308008193969727,
0.0033661015331745148,
0.1793818324804306,
0.2487647980451584,
0.2821294069290161,
-1.2949588298797607,
0.7469046711921692,
... |
func (m *podMetrics) GetSingularName() string {
return "pod"
} | [
0.6653240323066711,
-0.03783506155014038,
0.46159055829048157,
0.820815920829773,
-0.5121801495552063,
1.1130329370498657,
0.3339822292327881,
0.47245678305625916,
0.10787606239318848,
0.03978300839662552,
0.9745234251022339,
0.9723857045173645,
-0.08403336256742477,
-0.28532230854034424,
... |
func New(f *os.File) *Metadata {
return &Metadata{
file: f,
tags: make(map[string]string),
}
} | [
0.47645244002342224,
-0.9287930727005005,
0.23754602670669556,
-0.3323500454425812,
-0.6000217199325562,
0.25878384709358215,
-0.9752345681190491,
0.14365226030349731,
-2.042059898376465,
-0.09400429576635361,
-0.23253010213375092,
0.21994997560977936,
1.9014861583709717,
0.655207931995391... |
func (m *Metadata) Parse() error {
if _, err := m.file.Seek(-id3v1Block, io.SeekEnd); err != nil {
return fmt.Errorf("could not seek last %d bytes : %w", id3v1Block, err)
}
data := make([]byte, id3v1Block)
_, err := io.ReadFull(m.file, data)
if err != nil {
return fmt.Errorf("could not read last %d bytes : %w... | [
0.0627112165093422,
0.29466232657432556,
0.613041877746582,
0.1331428438425064,
0.3454170823097229,
0.11126282811164856,
-0.7055975794792175,
-0.36423546075820923,
-1.4190444946289062,
0.5880562663078308,
-0.7663553953170776,
0.29909124970436096,
-0.43165871500968933,
-0.1555478572845459,
... |
func (m *Metadata) Get(tag string) (string, error) {
if val, ok := m.tags[tag]; ok {
return val, nil
}
return "", fmt.Errorf("tag not '%s' not found in tag map", tag)
} | [
-0.14915774762630463,
-0.5400780439376831,
0.2575475573539734,
-0.20490944385528564,
0.06348036229610443,
0.026211228221654892,
-0.7371239066123962,
-0.35700756311416626,
-0.8448473811149597,
0.1723560392856598,
0.4998614192008972,
0.5186498165130615,
0.09893417358398438,
0.626943647861480... |
func EnvironFromFile(path string) (environ []string, err error) {
var (
src *os.File
)
if src, err = os.Open(path); err != nil {
if os.IsNotExist(err) {
return environ, nil
}
return environ, errors.WithStack(err)
}
defer src.Close()
return EnvironFromReader(src)
} | [
0.31207364797592163,
-0.7542608976364136,
0.6690316796302795,
-0.09061740338802338,
-0.6707531213760376,
0.6317556500434875,
0.2979849576950073,
-0.04303823783993721,
-0.5830214619636536,
1.1811116933822632,
-0.401987224817276,
-0.11215711385011673,
-0.10681435465812683,
0.789852499961853,... |
func EnvironFromReader(r io.Reader) (environ []string, err error) {
var (
raw []byte
)
if raw, err = io.ReadAll(r); err != nil {
return environ, errors.WithStack(err)
}
return Environ(string(raw)), nil
} | [
0.10980716347694397,
-0.9837550520896912,
0.524097740650177,
0.05766445770859718,
-1.2113007307052612,
0.06192535534501076,
-0.02629910595715046,
0.12079988420009613,
0.23917503654956818,
1.2318445444107056,
-0.43964800238609314,
0.01871904544532299,
0.16424378752708435,
0.8409891724586487... |
func Subst(inputs []string) func(string) string {
m := make(map[string]string, len(inputs))
for _, i := range inputs {
if idx := strings.IndexRune(i, '='); idx > -1 {
m[i[:idx]] = i[idx+1:]
}
}
return func(k string) string {
if v, ok := m[k]; ok {
return v
}
return k
}
} | [
-0.4498400390148163,
-0.296622097492218,
0.5573739409446716,
-0.805975079536438,
-0.49384939670562744,
-0.3796554505825043,
0.07395904511213303,
-0.3462795615196228,
0.027075501158833504,
0.3066892921924591,
0.6195482015609741,
0.8003491759300232,
0.2750207781791687,
-0.9073445200920105,
... |
func Environ(s string) (environ []string) {
var (
ir map[string]string = gotenv.Parse(strings.NewReader(string(s)))
)
environ = make([]string, 0, len(ir))
for k, v := range ir {
var line string
if strings.ContainsAny(v, " \n\t") {
line = fmt.Sprintf("%s=\"%s\"", k, v)
} else {
line = fmt.Sprintf("%s... | [
-0.46342897415161133,
-0.8107861876487732,
0.7223212718963623,
-0.47744303941726685,
-0.14050821959972382,
-0.14353777468204498,
-0.5318386554718018,
1.12050461769104,
-0.5227295756340027,
1.3423383235931396,
-0.40662598609924316,
0.40885108709335327,
0.5370450019836426,
1.0059185028076172... |
func MustEnviron(environ []string, err error) []string {
if err != nil {
panic(err)
}
return environ
} | [
-0.072465680539608,
-0.2713661193847656,
0.309500515460968,
1.023255705833435,
0.19448503851890564,
1.1161092519760132,
-0.7255896329879761,
0.07817234098911285,
0.9409227967262268,
1.0892387628555298,
-0.218061164021492,
0.9431667327880859,
-0.3197615444660187,
0.9215841293334961,
0.596... |
func (c Client) Run(ctx context.Context) (bool, error) {
if err := c.init(); err != nil {
return false, fmt.Errorf("fail during init: %w", err)
}
s := scan.Scan{IgnoreFile: c.Ignore.File, IgnoreLink: c.Ignore.Link, Parser: c.parser}
if err := s.Init(); err != nil {
return false, fmt.Errorf("fail to initialize ... | [
-0.2313014268875122,
0.09209638088941574,
1.0762852430343628,
-0.4740535616874695,
-0.1195579394698143,
0.37362781167030334,
0.6664538979530334,
-0.16868360340595245,
-0.3966977596282959,
-0.28738585114479065,
-0.3729628622531891,
-0.26009079813957214,
-1.471934199333191,
-0.04232741519808... |
func (t TypeSlice) Map(fn func(Type) Type) TypeSlice {
o := make(TypeSlice, len(t))
for i := range t {
o[i] = fn(t[i])
}
return o
} | [
-1.2226420640945435,
-0.31127598881721497,
0.6016519665718079,
0.3816085159778595,
0.3101908564567566,
0.2856340706348419,
-0.4771834909915924,
-0.08851949125528336,
0.19957275688648224,
1.067063570022583,
-0.2044011354446411,
0.3105992376804352,
1.0573456287384033,
-0.29928508400917053,
... |
func (t TypeSlice) GroupBy(groupBy func(Type) string) map[string]TypeSlice {
groups := make(map[string]TypeSlice)
for i := range t {
group := groupBy(t[i])
groups[group] = append(groups[group], t[i])
}
return groups
} | [
-1.3906806707382202,
-0.24304388463497162,
0.5315664410591125,
-0.5961738228797913,
-0.11479759216308594,
-0.3124485909938812,
0.42073872685432434,
-0.6526468992233276,
-0.8515487909317017,
0.9987260103225708,
0.1481991708278656,
0.22648142278194427,
0.15476635098457336,
0.4920779466629028... |
func AddScenarioScript(m *ScenarioScript) (id int64, err error) {
o := orm.NewOrm()
id, err = o.Insert(m)
return
} | [
-0.7167907357215881,
-0.03816872835159302,
0.8707449436187744,
1.3345890045166016,
0.07781677693128586,
-0.25805699825286865,
1.1255366802215576,
0.1411186158657074,
0.05426352471113205,
0.020193476229906082,
-0.6279796361923218,
-1.6067736148834229,
-0.7274521589279175,
0.0833781510591507... |
func GetScenarioScriptById(id int64) (v *ScenarioScript, err error) {
o := orm.NewOrm()
v = &ScenarioScript{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
} | [
-0.28416377305984497,
-0.4902665615081787,
0.03894185274839401,
0.865334689617157,
0.020737463608384132,
-0.9957872033119202,
0.5325886011123657,
-1.0015214681625366,
-0.09751777350902557,
0.4678264856338501,
-0.1529502123594284,
-0.11059203743934631,
0.05551740899682045,
-0.14208589494228... |
func GetAllScenarioScript(query map[string]string, fields []string, sortby []string, order []string,
offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error) {
o := orm.NewOrm()
qs := o.QueryTable(new(ScenarioScript))
// query k=v
for k, v := range query {
// rewrite dot-notation to Objec... | [
-0.42739081382751465,
-0.4594622254371643,
0.9317941069602966,
0.9649201035499573,
-0.30685582756996155,
-1.0237805843353271,
-0.2031579166650772,
-0.6822192072868347,
-0.1102692037820816,
0.5393663048744202,
0.20181336998939514,
-0.14288288354873657,
0.43709757924079895,
0.169237598776817... |
func UpdateScenarioScriptById(m *ScenarioScript) (err error) {
o := orm.NewOrm()
v := ScenarioScript{Id: m.Id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Update(m); err == nil {
fmt.Println("Number of records updated in database:", num)
}
}
retu... | [
-0.7402842044830322,
-1.1539394855499268,
0.6700013279914856,
0.27571383118629456,
0.05912848934531212,
-0.7566663026809692,
0.7520307898521423,
-0.22353172302246094,
0.05747219920158386,
1.1394786834716797,
-0.9021667838096619,
-0.4272540807723999,
-0.33618712425231934,
0.4055798351764679... |
func DeleteScenarioScript(id int64) (err error) {
o := orm.NewOrm()
v := ScenarioScript{Id: id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Delete(&ScenarioScript{Id: id}); err == nil {
fmt.Println("Number of records deleted in database:", num)
}
... | [
-0.37192749977111816,
-0.8481882810592651,
0.6664882898330688,
0.8179795145988464,
0.31566324830055237,
-0.7002431750297546,
0.7777970433235168,
0.4054180681705475,
0.2476837933063507,
0.5386127829551697,
-0.48245859146118164,
-0.34280481934547424,
-0.1533234715461731,
0.6626625061035156,
... |
func NewAccessTokenServer(t *testing.T, json string) *httptest.Server {
return NewTestServerFunc(func(w http.ResponseWriter, req *http.Request) {
assert.Equal(t, "POST", req.Method)
w.Header().Set(contentType, jsonContentType)
w.Write([]byte(json))
})
} | [
-0.6529043316841125,
-0.6865226626396179,
0.5503935813903809,
-1.1028410196304321,
-0.6873188018798828,
-0.49103739857673645,
0.08371001482009888,
-0.6457000374794006,
0.4186376631259918,
-0.15329496562480927,
-0.2788345217704773,
0.7746841907501221,
-0.13286139070987701,
0.549970090389251... |
func NewTestServerFunc(handler func(w http.ResponseWriter, r *http.Request)) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(handler))
} | [
-0.13770054280757904,
-0.5259073972702026,
0.19225041568279266,
-0.08983391523361206,
-0.32240989804267883,
0.09804902970790863,
0.6421970129013062,
-0.30807486176490784,
0.2801501452922821,
-0.10801519453525543,
-0.2646140158176422,
0.6419724225997925,
0.032343316823244095,
0.498602926731... |
func NewResourceManager(etcdCli *clientv3.Client) ResourceGroupManager {
return &externalResourceGroupManager{etcdCli: etcdCli}
} | [
-0.38332313299179077,
0.35265249013900757,
0.23137761652469635,
-0.8918265104293823,
-1.3987773656845093,
0.18133828043937683,
-0.8668420314788818,
-0.08138109743595123,
-0.263700008392334,
0.11763820797204971,
-0.16484539210796356,
-0.48771339654922485,
-0.5924495458602905,
0.687819063663... |
func (m *externalResourceGroupManager) GetResourceGroupClient() rmpb.ResourceManagerClient {
conn := m.etcdCli.ActiveConnection()
return rmpb.NewResourceManagerClient(conn)
} | [
-0.36005899310112,
0.2125960886478424,
0.16213275492191315,
-0.8757036924362183,
-1.2006638050079346,
-0.1651870757341385,
-0.041691187769174576,
0.1701827496290207,
-1.2311004400253296,
-0.3953823149204254,
0.22615496814250946,
-0.36289235949516296,
-1.3910572528839111,
0.2158494144678115... |
func (m *externalResourceGroupManager) GetResourceGroup(ctx context.Context, name string) (*rmpb.ResourceGroup, error) {
group := &rmpb.GetResourceGroupRequest{ResourceGroupName: name}
resp, err := m.GetResourceGroupClient().GetResourceGroup(ctx, group)
if err != nil {
return nil, err
}
return resp.GetGroup(), n... | [
-0.061158258467912674,
0.7990226745605469,
0.26463568210601807,
-0.8283263444900513,
-0.9512714147567749,
-0.5995650291442871,
-0.41969794034957886,
-0.4975254237651825,
0.5574230551719666,
0.06977465003728867,
0.030040642246603966,
0.34594592452049255,
-1.2369568347930908,
0.9070954322814... |
func (m *externalResourceGroupManager) GetAllResourceGroups(ctx context.Context) ([]*rmpb.ResourceGroup, error) {
req := &rmpb.ListResourceGroupsRequest{}
resp, err := m.GetResourceGroupClient().ListResourceGroups(ctx, req)
if err != nil {
return nil, err
}
return resp.GetGroups(), nil
} | [
-0.4378022849559784,
0.8407056331634521,
0.2540014684200287,
0.24003131687641144,
-0.9386005997657776,
0.07083341479301453,
-1.2971891164779663,
-0.3841572701931,
0.4265301525592804,
-0.5584195852279663,
-0.02036384306848049,
0.5240735411643982,
-1.8147705793380737,
1.244025707244873,
0.... |
func (m *externalResourceGroupManager) CreateResourceGroup(ctx context.Context, group *rmpb.ResourceGroup) error {
req := &rmpb.PutResourceGroupRequest{Group: group}
_, err := m.GetResourceGroupClient().AddResourceGroup(ctx, req)
return err
} | [
-0.4691930115222931,
0.8648304343223572,
0.19608137011528015,
-0.8603878617286682,
-0.508676290512085,
0.20049889385700226,
-0.23940302431583405,
-0.4026632606983185,
0.334175169467926,
0.24593167006969452,
-0.4672999382019043,
-0.3675091564655304,
-1.5419450998306274,
1.1658109426498413,
... |
func (m *externalResourceGroupManager) ModifyResourceGroup(ctx context.Context, group *rmpb.ResourceGroup) error {
req := &rmpb.PutResourceGroupRequest{Group: group}
_, err := m.GetResourceGroupClient().ModifyResourceGroup(ctx, req)
return err
} | [
-1.3708499670028687,
0.10116194933652878,
-0.1674577295780182,
-0.7194489240646362,
-1.037912130355835,
-0.06180890277028084,
0.09708033502101898,
-0.26783186197280884,
0.4665146470069885,
-0.03650695085525513,
0.460696816444397,
-0.2614145874977112,
-1.3304640054702759,
1.591355562210083,... |
func (m *externalResourceGroupManager) DeleteResourceGroup(ctx context.Context, name string) error {
req := &rmpb.DeleteResourceGroupRequest{ResourceGroupName: name}
log.Info("delete resource group", zap.String("name", name))
_, err := m.GetResourceGroupClient().DeleteResourceGroup(ctx, req)
return err
} | [
-0.1880263388156891,
0.5225860476493835,
0.06606455892324448,
-0.711998701095581,
-1.0146437883377075,
-0.41475725173950195,
-0.5135793685913086,
-0.230127215385437,
0.8112216591835022,
-0.04469635337591171,
-0.21450366079807281,
-0.15733540058135986,
-0.8384804725646973,
1.233235836029052... |
func startHttpServer(s *Server, cfg *HttpConfig) (hs *http.Server, err error) {
logger := s.log // promlog.New(&cfg.promlogConfig)
httpServer := &http.Server{
Addr: cfg.Listen,
Handler: nil,
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
MaxHeaderBytes: 1 << 13,
}
htt... | [
-0.3746308982372284,
-0.6430063843727112,
0.7211147546768188,
0.09121914952993393,
-0.34935227036476135,
0.4784238636493683,
0.13700640201568604,
0.5548847317695618,
0.02828500047326088,
0.20907840132713318,
-0.4931631088256836,
0.4674900770187378,
-0.8226650357246399,
0.8563295006752014,
... |
func protoHandler(pserver *ProtocolServer) http.HandlerFunc {
hf := func(w http.ResponseWriter, r *http.Request) {
data, err := ioutil.ReadAll(r.Body)
if err != nil {
pserver.s.log.Printf("http read error: %s\n", err.Error())
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
cr, e... | [
0.10064245015382767,
-0.5721447467803955,
0.8542550802230835,
-0.33686599135398865,
-0.7680818438529968,
0.5840615630149841,
0.42976969480514526,
0.17071399092674255,
-0.7021897435188293,
-0.2851788401603699,
0.2428431659936905,
-0.1753462702035904,
-0.893775224685669,
0.3453138768672943,
... |
func (face *FaceBase) GetPtr() unsafe.Pointer {
return unsafe.Pointer(face.getPtr())
} | [
0.7536388039588928,
-0.20311397314071655,
0.28664925694465637,
0.8370833396911621,
0.34824860095977783,
-0.09375681728124619,
0.26797622442245483,
-1.782799482345581,
0.11606106162071228,
-0.016493504866957664,
1.2285548448562622,
0.331502228975296,
-0.2319364994764328,
0.4204913377761841,... |
func (face *FaceBase) InitFaceBase(id FaceId, sizeofPriv int, socket eal.NumaSocket) error {
face.id = id
if socket.IsAny() {
if lc := eal.GetCurrentLCore(); lc.IsValid() {
socket = lc.GetNumaSocket()
} else {
socket = eal.NumaSocketFromID(0) // TODO what if socket 0 is unavailable?
}
}
faceC := face.... | [
-0.4284146726131439,
-0.11823615431785583,
0.939609706401825,
-0.45453381538391113,
-0.2955992519855499,
-0.5546656847000122,
0.774456799030304,
-0.11393481492996216,
0.6387941837310791,
-0.06051865592598915,
-1.1309913396835327,
0.3818754255771637,
-0.14685183763504028,
0.7340269684791565... |
func (face *FaceBase) FinishInitFaceBase(txQueueCapacity, mtu, headroom int) error {
faceC := face.getPtr()
socket := face.GetNumaSocket()
indirectMp := pktmbuf.Indirect.MakePool(socket)
headerMp := ndni.HeaderMempool.MakePool(socket)
nameMp := ndni.NameMempool.MakePool(socket)
r, e := ringbuffer.New(fmt.Sprintf... | [
0.4644794464111328,
-0.040801726281642914,
1.0118675231933594,
-0.6325759887695312,
0.3090995252132416,
-0.7597297430038452,
0.5285260677337646,
-1.6978999376296997,
-0.41688019037246704,
0.6400263905525208,
-0.7637500166893005,
0.26164060831069946,
-1.1874902248382568,
0.301926851272583,
... |
func (face *FaceBase) BeforeClose() {
id := face.GetFaceId()
faceC := face.getPtr()
faceC.state = C.FACESTA_DOWN
emitter.EmitSync(evt_FaceClosing, id)
} | [
0.6323172450065613,
0.2636715769767761,
0.4411894679069519,
0.327461838722229,
-0.0031432267278432846,
-0.4347456991672516,
0.2763228714466095,
-0.6955057382583618,
0.06554040312767029,
-0.14279593527317047,
-0.052163247019052505,
0.019102271646261215,
0.4278826117515564,
1.137762427330017... |
func (face *FaceBase) CloseFaceBase() {
id := face.GetFaceId()
face.clear()
emitter.EmitSync(evt_FaceClosed, id)
} | [
-0.5578338503837585,
-0.294916033744812,
0.4144209921360016,
0.24201881885528564,
-0.34254276752471924,
-0.19963791966438293,
0.397306889295578,
-1.059826374053955,
0.12684759497642517,
0.6235632300376892,
-0.819421648979187,
-0.43406638503074646,
-0.30050337314605713,
1.3763281106948853,
... |
func IsFIDO2Available() bool {
val, ok := os.LookupEnv("TELEPORT_FIDO2")
// Default to enabled, otherwise obey the env variable.
return !ok || val == "1"
} | [
-0.1754361242055893,
-0.2586626708507538,
0.03982046619057655,
0.7168899774551392,
-0.1814318597316742,
0.17621243000030518,
-0.2575642764568329,
0.2468917965888977,
-0.648479700088501,
0.7980873584747314,
-0.24185198545455933,
0.34283289313316345,
0.05305710434913635,
1.634239673614502,
... |
func withRetries(callback deviceCallbackFunc) deviceCallbackFunc {
return func(dev FIDODevice, info *deviceInfo, pin string) error {
const maxRetries = 3
var err error
for i := 0; i < maxRetries; i++ {
err = callback(dev, info, pin)
if err == nil {
return err
}
// Important: errors mapped by go-... | [
0.6805986166000366,
0.3491545617580414,
0.37028753757476807,
0.20620927214622498,
-0.3321586549282074,
-0.8709981441497803,
-0.20936810970306396,
-0.5386704802513123,
0.7364266514778137,
-0.24907413125038147,
0.21329918503761292,
0.08842200040817261,
0.47023701667785645,
-0.032101053744554... |
func (di *deviceInfo) uvCapable() bool {
return di.uv || di.clientPinSet
} | [
-0.483175665140152,
0.1038932353258133,
0.6122216582298279,
0.5773666501045227,
-0.20524625480175018,
0.7810985445976257,
0.45485919713974,
0.3435310423374176,
0.39324450492858887,
0.5783286094665527,
0.5788524150848389,
-0.02502075582742691,
0.4942780137062073,
-0.056401804089546204,
-0... |
func (this *Task) elapsedRunning(now time.Time) time.Duration {
if !(this.State() == TASK_RUNNING) {
return 0
}
return now.Sub(this.Started)
} | [
-0.04105101525783539,
0.1395488977432251,
0.6493996977806091,
0.3952105641365051,
0.14056383073329926,
0.8477203249931335,
-0.392768919467926,
0.8244349360466003,
-0.25275084376335144,
0.42669662833213806,
-0.5932388305664062,
-0.06760253757238388,
0.27653181552886963,
0.8308577537536621,
... |
func (this *Task) elapsed() time.Duration {
if this.Finished.IsZero() {
return 0
}
return this.Finished.Sub(this.Started)
} | [
0.49550697207450867,
0.21108947694301605,
0.4818665683269501,
0.23345498740673065,
0.2556457817554474,
0.5346947908401489,
0.6603779196739197,
0.757497251033783,
-0.2809780240058899,
0.2872946560382843,
-0.6982163190841675,
-0.24555224180221558,
0.06205170601606369,
1.0408990383148193,
-... |
func NewDn(value string) Dn {
dn := Dn{
Value: value,
}
return dn
} | [
-0.195308655500412,
-0.45173051953315735,
0.11744414269924164,
1.0721038579940796,
-1.563378095626831,
-0.6494418382644653,
-0.49906420707702637,
0.360541433095932,
1.267615556716919,
-0.9380398392677307,
-1.177231788635254,
0.1561388373374939,
1.0515758991241455,
-0.584650456905365,
0.6... |
func NewId(value string) Id {
id := Id{
Value: value,
}
return id
} | [
0.652475118637085,
-0.916439414024353,
0.09183903783559799,
0.16371957957744598,
-1.1690049171447754,
1.1342650651931763,
-0.11955485492944717,
-0.15555785596370697,
1.4355037212371826,
0.18422846496105194,
-0.2715947926044464,
0.020471446216106415,
-0.061919618397951126,
-0.56153649091720... |
func New() elton.Handler {
store := cache.GetRedisSession()
return session.NewByCookie(session.CookieConfig{
Store: store,
Signed: true,
Expired: scf.TTL,
GenID: func() string {
return util.GenXID()
},
Name: scf.Key,
Path: scf.CookiePath,
MaxAge: int(scf.MaxAge.Seconds()),
HttpOnly: ... | [
-0.6878560185432434,
-0.30909082293510437,
0.33903130888938904,
0.16636225581169128,
-1.1970136165618896,
-0.3110780119895935,
-0.006177396979182959,
-0.089370496571064,
-0.44271692633628845,
0.24615392088890076,
-0.4873894453048706,
0.08513032644987106,
0.8826400637626648,
0.2720120549201... |
func (ids WorkloadEndpointIdentifiers) NameMatches(name string) (bool, error) {
// Extract the required segments for this orchestrator type.
req, err := ids.getSegments()
if err != nil {
return false, err
}
// Extract the parameters from the name.
parts := ExtractDashSeparatedParms(name, len(req))
if len(part... | [
-1.5533440113067627,
-0.05582541599869728,
0.7934147119522095,
-0.2631286084651947,
-0.2757403254508972,
-0.19730505347251892,
-0.31494370102882385,
-0.8439105749130249,
-0.43516817688941956,
0.9188152551651001,
-0.7912115454673767,
-0.9587313532829285,
-1.0708829164505005,
0.0002076185919... |
func (ids WorkloadEndpointIdentifiers) CalculateWorkloadEndpointName(allowPrefix bool) (string, error) {
req, err := ids.getSegments()
if err != nil {
return "", err
}
parts := []string{}
for _, s := range req {
part := ""
if len(s.value) == 0 {
// This segment has no value associated with it.
if !al... | [
-0.8002896904945374,
-0.4910249710083008,
0.7852926254272461,
-0.8139874339103699,
-0.9855591654777527,
0.13732121884822845,
-0.04786154255270958,
0.21447309851646423,
-0.10567360371351242,
1.0528955459594727,
0.2438509166240692,
-0.24017444252967834,
-0.20491234958171844,
0.00782052148133... |
func (ids WorkloadEndpointIdentifiers) getSegments() ([]segment, error) {
node := segment{value: ids.Node, field: "node", structField: "Node"}
orch := segment{value: ids.Orchestrator, field: "orchestrator", structField: "Orchestrator"}
cont := segment{value: ids.ContainerID, field: "containerID", structField: "Conta... | [
-1.1767898797988892,
-0.16354086995124817,
0.42279699444770813,
-0.25224941968917847,
1.9530717134475708,
-0.28507280349731445,
0.2114928662776947,
-0.7087989449501038,
-0.24372565746307373,
0.24682103097438812,
-0.5467261075973511,
-0.10154271125793457,
-0.37087008357048035,
0.02934114634... |
func escapeDashes(seg segment) (string, *cerrors.ErroredField) {
if seg.value[0] == '-' {
return "", &cerrors.ErroredField{Name: seg.field, Value: seg.value, Reason: "field must not begin with a '-'"}
}
if seg.value[len(seg.value)-1] == '-' {
return "", &cerrors.ErroredField{Name: seg.field, Value: seg.value, Re... | [
-0.015361648984253407,
0.17668946087360382,
0.7128828167915344,
-0.47574561834335327,
0.07022606581449509,
-0.23475590348243713,
-0.12175047397613525,
-0.03405745327472687,
-0.3908557891845703,
-0.011826018802821636,
-0.3833753168582916,
-0.22778597474098206,
0.3644232451915741,
0.30247473... |
func ExtractDashSeparatedParms(name string, numParms int) []string {
// The name must be at least as long as the number of parameters plus the separators.
if len(name) < (2*numParms - 1) {
return nil
}
parts := extractParts(name)
// We should have extracted the correct number of name segments.
if len(parts) !... | [
0.006539823953062296,
0.7782710790634155,
0.7934879660606384,
-0.08246459066867828,
0.45773595571517944,
-0.5375550389289856,
-0.9219145774841309,
-0.24172495305538177,
-0.28057292103767395,
0.07777143269777298,
-0.7858423590660095,
-0.7708333730697632,
0.04428656026721001,
-0.053162526339... |
func ParseWorkloadEndpointName(wepName string) (WorkloadEndpointIdentifiers, error) {
if len(wepName) == 0 {
return WorkloadEndpointIdentifiers{}, errors.New("Cannot parse empty string")
}
parts := extractParts(wepName)
if parts == nil || len(parts) == 0 {
return WorkloadEndpointIdentifiers{}, fmt.Errorf("Canno... | [
-0.5693302750587463,
-0.7079538702964783,
0.5457274913787842,
-0.4960513710975647,
-0.8064602017402649,
0.33987295627593994,
0.07886763662099838,
0.05530614033341408,
-0.15988615155220032,
0.617781400680542,
-0.6832814812660217,
-0.43905651569366455,
-0.6101951003074646,
-0.292914390563964... |
func (in *RTCPeerConnection) DeepCopyInto(out *RTCPeerConnection) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
} | [
0.0304777342826128,
-0.6486730575561523,
0.5500593781471252,
-0.2088804543018341,
-0.7758545875549316,
0.2188589721918106,
-0.12525393068790436,
1.0838031768798828,
-1.4359514713287354,
-0.1370869129896164,
-0.33915993571281433,
0.8071194887161255,
-0.12764881551265717,
-0.3507645130157470... |
func (in *RTCPeerConnection) DeepCopy() *RTCPeerConnection {
if in == nil {
return nil
}
out := new(RTCPeerConnection)
in.DeepCopyInto(out)
return out
} | [
-1.2672463655471802,
0.0024920906871557236,
0.1949656903743744,
0.385539174079895,
-0.12198583781719208,
-0.12536558508872986,
-0.0162301417440176,
0.23400737345218658,
-0.41342926025390625,
0.020139139145612717,
-0.09459207206964493,
-0.7302513122558594,
-1.1304248571395874,
-0.3472047150... |
func (in *RTCPeerConnection) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
-0.6946165561676025,
-0.38265755772590637,
0.5853511691093445,
0.24106112122535706,
-0.6325555443763733,
0.3520800471305847,
0.6386371850967407,
0.30969393253326416,
-0.6710343360900879,
-0.4038761556148529,
-0.2709140479564667,
-0.11526753753423691,
-0.5124068856239319,
-0.367430686950683... |
func (in *RTCPeerConnectionList) DeepCopyInto(out *RTCPeerConnectionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RTCPeerConnection, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
... | [
-0.5499506592750549,
-0.024129128083586693,
0.4811355471611023,
0.05117863416671753,
-0.40930113196372986,
-0.19847436249256134,
-0.3727533221244812,
1.020447015762329,
-0.865073025226593,
0.503127932548523,
-0.655149519443512,
-0.33914971351623535,
-0.31094107031822205,
-0.221264153718948... |
func (in *RTCPeerConnectionList) DeepCopy() *RTCPeerConnectionList {
if in == nil {
return nil
}
out := new(RTCPeerConnectionList)
in.DeepCopyInto(out)
return out
} | [
-1.2866425514221191,
-0.09595388919115067,
-0.04262380674481392,
0.45415541529655457,
-0.07938090711832047,
0.3109080195426941,
-0.24849829077720642,
0.5913550853729248,
-0.04248422384262085,
0.5057373642921448,
-0.4778418242931366,
-1.4571807384490967,
-0.5428807735443115,
-0.466120064258... |
func (in *RTCPeerConnectionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
-1.1542112827301025,
-0.2650551497936249,
0.43321964144706726,
0.3294430375099182,
-0.46384721994400024,
0.23974813520908356,
0.45312613248825073,
0.38159415125846863,
-0.2850273549556732,
-0.15968602895736694,
-0.6791425943374634,
-0.6214024424552917,
-0.22930003702640533,
-0.086955338716... |
func (in *RTCPeerConnectionSpec) DeepCopyInto(out *RTCPeerConnectionSpec) {
*out = *in
} | [
0.5880573391914368,
-0.373187780380249,
0.36518847942352295,
-1.0079530477523804,
-0.34356871247291565,
0.28755831718444824,
-0.4314740002155304,
0.9263865947723389,
-1.2450698614120483,
0.09396408498287201,
0.25894930958747864,
0.1790381819009781,
0.29836830496788025,
-0.6387997269630432,... |
func (in *RTCPeerConnectionSpec) DeepCopy() *RTCPeerConnectionSpec {
if in == nil {
return nil
}
out := new(RTCPeerConnectionSpec)
in.DeepCopyInto(out)
return out
} | [
-0.3321017324924469,
-0.25158068537712097,
0.17706261575222015,
-0.7968459725379944,
0.03673417493700981,
0.158575177192688,
-0.07510874420404434,
0.27265116572380066,
-0.4956837296485901,
0.44602686166763306,
0.5353802442550659,
-0.9366430640220642,
0.142717182636261,
-0.6438989043235779,... |
func (in *RTCPeerConnectionStatus) DeepCopyInto(out *RTCPeerConnectionStatus) {
*out = *in
} | [
0.4962337017059326,
-0.7560780048370361,
0.13468800485134125,
-0.990679919719696,
-0.7520539164543152,
0.27479586005210876,
-0.9720212817192078,
1.0303397178649902,
-1.121778964996338,
-0.2683519721031189,
-0.2647591233253479,
-0.041414495557546616,
0.07875050604343414,
-0.7848382592201233... |
func (in *RTCPeerConnectionStatus) DeepCopy() *RTCPeerConnectionStatus {
if in == nil {
return nil
}
out := new(RTCPeerConnectionStatus)
in.DeepCopyInto(out)
return out
} | [
-0.6697623133659363,
-0.6298933029174805,
-0.1535961776971817,
-0.7597389817237854,
-0.30303117632865906,
-0.04936424642801285,
-0.9100279808044434,
0.4650748074054718,
-0.3068607449531555,
0.057218559086322784,
-0.026102744042873383,
-1.0617552995681763,
-0.45927900075912476,
-0.618970811... |
func (h *StmtHistory) Add(st sqlexec.Statement, stmtCtx *stmtctx.StatementContext) {
s := &stmtRecord{
st: st,
stmtCtx: stmtCtx,
}
h.history = append(h.history, s)
} | [
-0.06748346984386444,
0.11317605525255203,
0.4234273433685303,
-0.4560083746910095,
-0.291345477104187,
0.5161048173904419,
-1.0428221225738525,
0.19371996819972992,
0.28789404034614563,
0.0038399810437113047,
0.5924504995346069,
1.161596417427063,
-0.14341692626476288,
0.7020919919013977,... |
func (h *StmtHistory) Count() int {
return len(h.history)
} | [
0.24110962450504303,
0.054632365703582764,
0.324687659740448,
0.017434511333703995,
0.10979534685611725,
0.1716950237751007,
0.271954745054245,
0.4337286949157715,
-1.1921485662460327,
0.4603036046028137,
-0.18726249039173126,
-0.05904984474182129,
-0.10554162412881851,
1.3364009857177734,... |
func (s *session) FieldList(tableName string) ([]*ast.ResultField, error) {
is := infoschema.GetInfoSchema(s)
dbName := model.NewCIStr(s.GetSessionVars().CurrentDB)
tName := model.NewCIStr(tableName)
table, err := is.TableByName(dbName, tName)
if err != nil {
return nil, err
}
cols := table.Cols()
fields := ... | [
-0.702872633934021,
-0.1689542680978775,
0.5781517028808594,
-0.46692195534706116,
-0.1881876140832901,
-0.5184128880500793,
0.18017630279064178,
-0.24207928776741028,
-0.12200731784105301,
0.3273165822029114,
-1.446455717086792,
-0.6599436402320862,
-0.18255972862243652,
-0.08653754740953... |
func (s *session) ExecRestrictedSQL(sql string) ([]chunk.Row, []*ast.ResultField, error) {
ctx := context.TODO()
// Use special session to execute the sql.
tmp, err := s.sysSessionPool().Get()
if err != nil {
return nil, nil, err
}
se := tmp.(*session)
defer s.sysSessionPool().Put(tmp)
return execRestricted... | [
0.4886181652545929,
0.4743856191635132,
0.6936389207839966,
0.5421299934387207,
-0.5961481928825378,
-0.8512665629386902,
-0.3230341970920563,
-1.1234952211380005,
1.133569359779358,
0.6173169016838074,
-0.4017683267593384,
1.0079096555709839,
0.10139033943414688,
-0.13633273541927338,
0... |
func (s *session) getExecRet(ctx sessionctx.Context, sql string) (string, error) {
rows, fields, err := s.ExecRestrictedSQL(sql)
if err != nil {
return "", err
}
if len(rows) == 0 {
return "", executor.ErrResultIsEmpty
}
d := rows[0].GetDatum(0, &fields[0].Column.FieldType)
value, err := d.ToString()
if err... | [
0.11984434723854065,
0.7265350818634033,
0.9163691401481628,
0.005007375963032246,
-0.2940695285797119,
-0.8916564583778381,
-0.35223472118377686,
-1.095679521560669,
0.2881145179271698,
0.19245052337646484,
-0.08248486369848251,
1.078782558441162,
-0.1451256275177002,
-0.19296599924564362... |
func (s *session) GetAllSysVars() (map[string]string, error) {
if s.Value(sessionctx.Initing) != nil {
return nil, nil
}
sql := `SELECT VARIABLE_NAME, VARIABLE_VALUE FROM %s.%s;`
sql = fmt.Sprintf(sql, mysql.SystemDB, mysql.GlobalVariablesTable)
rows, _, err := s.ExecRestrictedSQL(sql)
if err != nil {
return ... | [
-0.7461315989494324,
-0.32074010372161865,
0.5658395886421204,
0.6775124669075012,
-0.9886330962181091,
-0.4611176550388336,
-0.4147728383541107,
-0.2481086254119873,
-0.4475829005241394,
-0.15803174674510956,
-1.052383542060852,
0.9791359901428223,
-0.3904016315937042,
0.9501603841781616,... |
func (s *session) GetGlobalSysVar(name string) (string, error) {
if s.Value(sessionctx.Initing) != nil {
// When running bootstrap or upgrade, we should not access global storage.
return "", nil
}
sql := fmt.Sprintf(`SELECT VARIABLE_VALUE FROM %s.%s WHERE VARIABLE_NAME="%s";`,
mysql.SystemDB, mysql.GlobalVaria... | [
-0.7955482006072998,
0.2468549758195877,
0.6841187477111816,
0.6016563177108765,
-0.6977314949035645,
-0.3184889853000641,
0.4309103190898895,
-0.8749238848686218,
-0.34310951828956604,
0.4051259458065033,
-0.7163002490997314,
0.7325641512870789,
-0.5342426896095276,
1.0007357597351074,
... |
func (s *session) SetGlobalSysVar(name, value string) error {
if name == variable.SQLModeVar {
value = mysql.FormatSQLModeStr(value)
if _, err := mysql.GetSQLMode(value); err != nil {
return err
}
}
var sVal string
var err error
sVal, err = variable.ValidateSetSystemVar(s.sessionVars, name, value)
if err... | [
-0.9291623830795288,
-0.18317845463752747,
0.7765721678733826,
0.1456226408481598,
-0.8158184885978699,
0.1546706110239029,
0.15312530100345612,
-0.6040512919425964,
-0.37285080552101135,
0.7149431705474854,
-0.8745580911636353,
1.1688035726547241,
-0.5666013956069946,
1.182238221168518,
... |
func (s *session) Close() {
ctx := context.TODO()
s.RollbackTxn(ctx)
} | [
0.335579514503479,
0.074672631919384,
0.39545735716819763,
-0.37672898173332214,
0.2582438886165619,
-0.3624383509159088,
0.47752484679222107,
-0.38820168375968933,
0.8342521786689758,
-0.19969120621681213,
0.37790539860725403,
0.08193289488554001,
0.4394080340862274,
-0.6364020109176636,
... |
func (s *session) GetSessionVars() *variable.SessionVars {
return s.sessionVars
} | [
-0.7413841485977173,
-0.531283438205719,
0.22400467097759247,
1.0868524312973022,
-0.9450106620788574,
-0.4727643132209778,
0.6873029470443726,
-1.259012222290039,
1.006709337234497,
-0.4111524820327759,
-0.4541376233100891,
1.2589582204818726,
-0.6027592420578003,
-0.14600658416748047,
... |
func CreateSession4Test(store kv.Storage) (Session, error) {
s, err := CreateSession(store)
if err == nil {
// initialize session variables for test.
s.GetSessionVars().InitChunkSize = 2
s.GetSessionVars().MaxChunkSize = 32
}
return s, err
} | [
-0.17207865417003632,
-0.317543089389801,
0.30665531754493713,
0.4098939895629883,
-0.275417298078537,
-0.44310155510902405,
0.22070381045341492,
-1.4984889030456543,
0.13585300743579865,
-0.22001776099205017,
-0.6794077754020691,
-0.5804846882820129,
-0.6075772047042847,
-0.20578910410404... |
func CreateSession(store kv.Storage) (Session, error) {
s, err := createSession(store)
if err != nil {
return nil, err
}
return s, nil
} | [
0.03679509088397026,
-0.19144953787326813,
0.04090853035449982,
0.5800600647926331,
-0.06180673465132713,
0.11407598853111267,
-0.23977558314800262,
-0.7280367612838745,
0.9265426397323608,
-0.10939006507396698,
-0.38044437766075134,
-0.6671561002731323,
-0.35036513209342957,
-0.1693517714... |
func BootstrapSession(store kv.Storage) (*domain.Domain, error) {
initLoadCommonGlobalVarsSQL()
if !getStoreBootstrap(store) {
runInBootstrapSession(store, bootstrap)
}
se, err := createSession(store)
if err != nil {
return nil, err
}
dom := domain.GetDomain(se)
se1, err := createSession(store)
if err ... | [
-0.7727341651916504,
0.2708840072154999,
0.5586692094802856,
0.5250154733657837,
-0.7564497590065002,
-0.34114310145378113,
0.4875890016555786,
-1.1259346008300781,
0.9560967087745667,
0.24341413378715515,
0.052429646253585815,
0.17533712089061737,
0.13688813149929047,
0.1027451828122139,
... |
func GetDomain(store kv.Storage) (*domain.Domain, error) {
return domap.Get(store)
} | [
-0.7950040698051453,
0.3936578929424286,
0.20201793313026428,
1.696596622467041,
-0.337360143661499,
-0.36412185430526733,
-0.6470427513122559,
0.17887189984321594,
0.7560094594955444,
-1.0136820077896118,
-0.6392245888710022,
1.3134596347808838,
0.17649005353450775,
0.06484297662973404,
... |
func runInBootstrapSession(store kv.Storage, bootstrap func(Session)) {
s, err := createSession(store)
if err != nil {
// Bootstrap fail will cause program exit.
logutil.BgLogger().Fatal("createSession error", zap.Error(err))
}
s.SetValue(sessionctx.Initing, true)
bootstrap(s)
finishBootstrap(store)
s.Clear... | [
-0.8413378000259399,
-0.633500874042511,
0.49702635407447815,
0.4882349669933319,
-0.7407010793685913,
-0.3184971511363983,
0.3485718071460724,
-0.7178975939750671,
0.6161227226257324,
0.25072887539863586,
-0.2415022999048233,
0.214843288064003,
0.26486319303512573,
-0.0852687656879425,
... |
func CreateSessionWithDomain(store kv.Storage, dom *domain.Domain) (*session, error) {
s := &session{
store: store,
parser: parser.New(),
sessionVars: variable.NewSessionVars(),
client: store.GetClient(),
}
s.mu.values = make(map[fmt.Stringer]interface{})
domain.BindDomain(s, dom)
// sessio... | [
0.2888050079345703,
-0.42387545108795166,
0.37588727474212646,
0.4947512745857239,
-0.9067860245704651,
-0.3224709630012512,
0.19815568625926971,
-1.2819067239761353,
0.8165830373764038,
-0.046309132128953934,
-0.0746159553527832,
0.5113138556480408,
0.11236075311899185,
0.137701153755188,... |
func (s *session) loadCommonGlobalVariablesIfNeeded() error {
initLoadCommonGlobalVarsSQL()
vars := s.sessionVars
if vars.CommonGlobalLoaded {
return nil
}
if s.Value(sessionctx.Initing) != nil {
// When running bootstrap or upgrade, we should not access global storage.
return nil
}
var err error
// Use ... | [
-0.5097531080245972,
0.031766414642333984,
0.9304496049880981,
0.3829199969768524,
-0.5133931636810303,
0.03503957763314247,
0.8238766193389893,
-0.9985775947570801,
-0.5821502804756165,
1.2115212678909302,
-0.3040069043636322,
0.3075558841228485,
-1.0755196809768677,
0.6681101322174072,
... |
func (s *session) PrepareTxnCtx(ctx context.Context) {
if s.txn.validOrPending() {
return
}
is := domain.GetDomain(s).InfoSchema()
s.sessionVars.TxnCtx = &variable.TransactionContext{
InfoSchema: is,
SchemaVersion: is.SchemaMetaVersion(),
CreateTime: time.Now(),
}
} | [
-0.15889063477516174,
-0.1185993105173111,
0.4072616696357727,
-0.23133789002895355,
-0.7104812860488892,
-0.7204011082649231,
-0.39628541469573975,
-0.5245931148529053,
0.48580530285835266,
0.491494357585907,
-0.7339684367179871,
-0.5634028315544128,
0.6411954164505005,
0.1289927363395691... |
func (s *session) PrepareTxnFuture(ctx context.Context) {
if s.txn.validOrPending() {
return
}
txnFuture := s.getTxnFuture(ctx)
s.txn.changeInvalidToPending(txnFuture)
} | [
-0.013559848070144653,
0.02663733996450901,
0.19330453872680664,
0.43274158239364624,
-1.0017136335372925,
-1.4204856157302856,
-1.3072562217712402,
0.6531734466552734,
0.46269866824150085,
0.29907697439193726,
-0.6374003291130066,
-0.5575515627861023,
0.4958118796348572,
0.273336827754974... |
func (s *session) RefreshTxnCtx(ctx context.Context) error {
if err := s.doCommit(ctx); err != nil {
return err
}
return s.NewTxn(ctx)
} | [
0.34036484360694885,
-0.09046284854412079,
0.2108171284198761,
-0.22071915864944458,
-0.4922291040420532,
-0.235968679189682,
-1.1374759674072266,
-1.5773168802261353,
0.4120796024799347,
0.8921418786048889,
0.17667345702648163,
0.07276913523674011,
-0.06731639802455902,
-0.505733788013458... |
func (s *session) InitTxnWithStartTS(startTS uint64) error {
if s.txn.Valid() {
return nil
}
// no need to get txn from txnFutureCh since txn should init with startTs
txn, err := s.store.BeginWithStartTS(startTS)
if err != nil {
return err
}
s.txn.changeInvalidToValid(txn)
s.txn.SetCap(s.getMembufCap())
e... | [
0.4562036097049713,
-0.528405487537384,
0.33181291818618774,
0.5605010986328125,
-0.8995043039321899,
-1.1098132133483887,
0.007390616927295923,
0.21288838982582092,
1.0055005550384521,
-0.3995518684387207,
-0.7210080027580261,
-0.0577811598777771,
0.20979289710521698,
0.09301915019750595,... |
func (s *session) GetStore() kv.Storage {
return s.store
} | [
0.07679934799671173,
-0.06068354845046997,
0.20760264992713928,
1.4978708028793335,
-0.581203281879425,
-0.47833141684532166,
0.27908921241760254,
-0.8030104041099548,
1.904509425163269,
-1.1884443759918213,
0.0971604734659195,
0.11005932092666626,
-0.09657677263021469,
-0.1322253644466400... |
func ImportLogsFromCSV(fileName string) (DataCollection, error) {
file, err := os.Open(fileName)
if err != nil {
return DataCollection{}, fmt.Errorf(ImportCSVError, err.Error())
}
defer file.Close()
data := DataCollection{}
var skipHeader bool
r := csv.NewReader(file)
for {
record, err := r.Read()
if err... | [
0.7465660572052002,
-0.239285409450531,
0.8208996653556824,
-0.01034371368587017,
-0.5483089685440063,
0.565820574760437,
-0.28978902101516724,
-0.7763386964797974,
-0.3394056260585785,
0.20878587663173676,
-0.43550461530685425,
0.5394653081893921,
-0.27260568737983704,
0.1273304671049118,... |
func IsPurgeable(candidate time.Time, before time.Duration, since time.Duration) bool {
now := time.Now().In(time.UTC)
start := time.Time{}
end := now
if before == 0 && since == 0 {
return true
} else if before != 0 && since != 0 {
return false
}
if before != 0 {
end = now.Add(-before)
}
if since != 0 {
... | [
-0.9027278423309326,
0.5467455387115479,
0.7928524613380432,
0.30568593740463257,
-0.3195453882217407,
0.15154848992824554,
-1.16435968875885,
0.8192039728164673,
-0.9343858361244202,
1.0774649381637573,
-0.03621543198823929,
0.3484678268432617,
-0.4569318890571594,
0.4615662395954132,
-... |
func (g *Game) Init() {
// Set gameReference
gameReference = g
// Init lightHandler
g.lightHandler = initLightHandler()
playerLightID := g.lightHandler.addLight(g.lightHandler.lightImages.playerLight, 0)
// Init maps
initMaps(g)
// Player
g.player = createPlayer(
newVec2f(screenWidth/2, screenHeight/2),
... | [
-0.12752853333950043,
0.3946216404438019,
0.9505037069320679,
-0.5956045389175415,
0.44022002816200256,
0.6076580882072449,
0.9679039716720581,
-0.5124955773353577,
-0.39972588419914246,
0.22861360013484955,
-0.8148905634880066,
-0.1986531764268875,
-0.0577021948993206,
0.7901190519332886,... |
func (g *Game) Update(screen *ebiten.Image) error {
if !gameInitialized {
g.Init()
gameInitialized = true
}
// Update game
if g.state == 1 {
updateGame(screen, g)
}
return nil
} | [
-1.4206756353378296,
-0.15025530755519867,
0.4409477114677429,
0.3916465640068054,
0.44339990615844727,
0.7265583872795105,
-0.4671061933040619,
-0.9240365624427795,
0.5267570614814758,
1.2362059354782104,
0.32581597566604614,
-0.7832273244857788,
-0.17066353559494019,
1.8259639739990234,
... |
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
return screenWidth, screenHeight
} | [
-1.151246428489685,
-0.35847583413124084,
0.6286482810974121,
-0.3418639302253723,
-1.3381327390670776,
0.09153396636247635,
-0.2314932942390442,
-0.7219759225845337,
-0.008458304218947887,
-0.8017170429229736,
0.7653555274009705,
-0.8175865411758423,
-0.748132586479187,
0.4457549452781677... |
func readMsg(br *bufio.Reader) (byte, [][]byte, error) {
var b []byte
var data [][]byte
flag, err := br.ReadByte()
switch flag {
case '+', '-', ':':
b, err = readLine(br)
data = [][]byte{b}
case '$':
b, err = readBulk(br)
data = [][]byte{b}
case '*':
data, err = readMultiBulk(br)
default:
err = PRO... | [
0.05496976152062416,
0.5711620450019836,
0.8404151797294617,
0.1648114174604416,
-0.6096864342689514,
0.6378865838050842,
-0.5077220797538757,
0.6194704174995422,
-0.9429833292961121,
0.17934677004814148,
-0.2217598706483841,
0.5696176290512085,
-0.28017523884773254,
0.8880784511566162,
... |
func readMultiBulk(br *bufio.Reader) ([][]byte, error) {
count, err := readInt(br)
switch {
case err != nil:
return nil, err
case count < 0:
return nil, PROTOCOL_ERROR
}
data := make([][]byte, 0, count)
for count > 0 {
f, err := br.ReadByte()
var b []byte
switch f {
case '$':
b, err = readBulk(br... | [
-0.335366815328598,
0.11147463321685791,
0.8656265139579773,
0.46187153458595276,
-0.35405656695365906,
0.2641349732875824,
-0.035257596522569656,
-0.0013467251555994153,
-0.27500927448272705,
-0.1961933821439743,
-0.5685945153236389,
0.39680978655815125,
-0.5817943215370178,
1.00345718860... |
func readBulk(br *bufio.Reader) ([]byte, error) {
size, err := readInt(br)
if err != nil {
return nil, err
}
if size < 0 {
return nil, nil
}
data := make([]byte, size+2)
_, err = readFull(br, data)
switch {
case err != nil:
return nil, err
case data[size] != '\r':
return nil, PROTOCOL_ERROR
case da... | [
-0.1566881239414215,
0.16961446404457092,
1.029961347579956,
0.5211632251739502,
-0.32021814584732056,
-0.36320993304252625,
-0.48217615485191345,
-0.6389797329902649,
-0.5565440058708191,
-0.6920209527015686,
-0.7333751916885376,
0.3951157331466675,
-0.5245499014854431,
0.6572802662849426... |
func readFull(r io.Reader, p []byte) (int, error) {
cur := 0
for cur < len(p) {
amt, err := r.Read(p[cur:])
cur += amt
if err != nil {
return cur, err
}
}
return cur, nil
} | [
0.2859853506088257,
-0.14263007044792175,
0.6344889402389526,
-0.0025457702577114105,
-0.2674432694911957,
0.10506621748209,
-0.450089693069458,
0.5027807354927063,
-0.16046291589736938,
0.9962470531463623,
-0.2538919150829315,
0.06236282363533974,
-0.4906010329723358,
-0.1641014665365219,... |
func readInt(br *bufio.Reader) (int, error) {
line, err := readLine(br)
if err != nil {
return -1, err
}
return strconv.Atoi(string(line))
} | [
0.0802876204252243,
-0.6203138828277588,
0.7354584336280823,
-0.47254252433776855,
-0.7555575370788574,
-0.001034195302054286,
-0.2623675763607025,
-0.3505971431732178,
-1.6260676383972168,
-0.5044993162155151,
0.04108778014779091,
-0.16849388182163239,
-0.05987568944692612,
0.141241714358... |
func readLine(br *bufio.Reader) ([]byte, error) {
line := make([]byte, 0, 64)
for {
part, err := br.ReadSlice('\n')
if err != nil {
return nil, err
}
if bytes.HasSuffix(part, crlf) {
line = append(line, part[:len(part)-2]...)
break
}
line = append(line, part...)
}
return line, nil
} | [
0.2201424539089203,
-0.12755778431892395,
0.6692115068435669,
0.7185877561569214,
-0.08101151138544083,
-0.12543903291225433,
-0.7520303726196289,
-0.10834662616252899,
-0.5413834452629089,
-0.45555275678634644,
-0.8833858966827393,
-0.10710762441158295,
-0.6871458292007446,
0.566211879253... |
func writeRequest(w io.Writer, verb string, args ...interface{}) error {
b, err := marshalRequest(verb, args...)
if err != nil {
return err
}
_, err = w.Write(b)
return err
} | [
-0.5682013630867004,
-0.3219279646873474,
0.7065122127532959,
0.6970836520195007,
1.1440200805664062,
-0.3423633277416229,
0.1356794238090515,
0.5763971209526062,
-0.43000102043151855,
-0.20578153431415558,
0.6240792274475098,
0.6508302092552185,
0.2739478051662445,
0.14234304428100586,
... |
func (o *ImageDetails) Validate() error {
if o.DataVerifier == nil {
return errors.New("the DataVerifier cannot be nil")
}
if len(strings.TrimSpace(o.OwnerUserId)) == 0 {
return errors.New("please specify a Steam user ID")
}
return nil
} | [
0.39713189005851746,
1.0228773355484009,
0.14368276298046112,
-0.20582090318202972,
0.6645439267158508,
0.11384820193052292,
-0.012038511224091053,
-0.14335539937019348,
-0.42820024490356445,
-0.602919340133667,
0.6522991061210632,
0.74394690990448,
0.07774518430233002,
1.0832473039627075,... |
func (o *ImageDetails) FilePath(optionalExtension string) (string, error) {
err := o.Validate()
if err != nil {
return "", err
}
gridDirPath, _, err := o.DataVerifier.GridDirPath(o.OwnerUserId)
if err != nil {
return "", err
}
gameId := naming.LegacyNonSteamGameId(o.GameName, o.GameExecutablePath)
return... | [
1.0897996425628662,
0.1926322728395462,
0.4358368515968323,
0.022906621918082237,
-0.09080056101083755,
0.2571440041065216,
0.6283945441246033,
-0.30691471695899963,
0.5556315183639526,
0.5982785820960999,
0.98875892162323,
0.40303611755371094,
-0.25078266859054565,
0.43557122349739075,
... |
func (o *AddConfig) Validate() error {
err := o.ResultDetails.Validate()
if err != nil {
return err
}
if len(strings.TrimSpace(o.ImageSourcePath)) == 0 {
return errors.New("please specify a tile image source path")
}
if o.Mode == 0 {
o.Mode = defaultImageMode
}
return nil
} | [
-0.41990089416503906,
1.092233657836914,
0.4133015275001526,
-0.2634583115577698,
0.3566558063030243,
0.1728561818599701,
0.35308095812797546,
-0.45519590377807617,
-0.33128660917282104,
0.32662665843963623,
0.15993592143058777,
-0.38762229681015015,
-0.5507156848907471,
1.350514531135559,... |
func (o *RemoveConfig) Validate() error {
err := o.TargetDetails.Validate()
if err != nil {
return err
}
return nil
} | [
-0.3016207218170166,
0.5037089586257935,
0.5147218108177185,
-0.47912371158599854,
0.7925509810447693,
-0.39695674180984497,
-0.1536732316017151,
0.7134168744087219,
-0.3989836871623993,
0.7099008560180664,
0.3242035210132599,
-0.19365684688091278,
-0.5697847008705139,
0.1704568862915039,
... |
func AddImage(config AddConfig) error {
err := config.Validate()
if err != nil {
return err
}
gridDirPath, _, err := config.ResultDetails.DataVerifier.GridDirPath(config.ResultDetails.OwnerUserId)
if err != nil {
return err
}
gameId := naming.LegacyNonSteamGameId(config.ResultDetails.GameName, config.Resul... | [
-0.3209560513496399,
0.41987478733062744,
1.005807876586914,
-0.04396272450685501,
0.03373067453503609,
0.47331148386001587,
0.7797433137893677,
0.05400194227695465,
0.01694890297949314,
0.7095116972923279,
0.25688546895980835,
-0.07184206694364548,
-0.3347179591655731,
0.14185190200805664... |
func RemoveImage(config RemoveConfig) error {
err := config.Validate()
if err != nil {
return err
}
filePath, err := config.TargetDetails.FilePath(config.FileExtension)
if err != nil {
return err
}
if len(config.FileExtension) != 0 {
os.Remove(filePath)
return nil
}
dirPath := path.Dir(filePath)
... | [
-0.5398252010345459,
-0.12727636098861694,
0.6963797211647034,
-0.10718202590942383,
-0.0710408017039299,
0.14186178147792816,
0.5446587800979614,
1.1357712745666504,
-0.36242303252220154,
0.46593669056892395,
0.5249632000923157,
-0.09743474423885345,
-0.2716258466243744,
0.967557609081268... |
func (h *Handler) getPlatform(m *v1alpha1.PerconaServerMongoDB) v1alpha1.Platform {
if m.Spec.Platform != nil {
return *m.Spec.Platform
}
if h.serverVersion != nil {
return h.serverVersion.Platform
}
return v1alpha1.PlatformKubernetes
} | [
-0.25384852290153503,
-0.2948095500469208,
0.48775145411491394,
0.7185021638870239,
0.2337474822998047,
0.3385933041572571,
0.3238966763019562,
0.1653464287519455,
0.05495152249932289,
0.2756442427635193,
0.005750747397542,
0.05099840089678764,
-1.381855845451355,
1.7931855916976929,
0.8... |
func labelsForPerconaServerMongoDB(m *v1alpha1.PerconaServerMongoDB, replset *v1alpha1.ReplsetSpec) map[string]string {
return map[string]string{
"app": "percona-server-mongodb",
"percona-server-mongodb_cr": m.Name,
"replset": replset.Name,
}
} | [
-0.16306371986865997,
-0.3924863636493683,
0.31068888306617737,
-0.8855876922607422,
-0.8496944904327393,
0.9841555953025818,
-0.5851926207542419,
0.24792732298374176,
-0.33935198187828064,
1.1779423952102661,
0.15843525528907776,
0.8505774736404419,
-0.9053654670715332,
0.910390317440033,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.