text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
... | [
0.34371325373649597,
-0.3622533082962036,
0.6770349144935608,
-1.2592034339904785,
-0.00613967701792717,
-0.044532135128974915,
-0.00726317847147584,
-0.43950432538986206,
-0.2061910331249237,
-0.2510174810886383,
0.17843623459339142,
0.1356850564479828,
-0.2362709492444992,
-0.56985044479... |
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
... | [
0.4226192533969879,
0.3001989424228668,
0.5813396573066711,
-0.20641714334487915,
-0.23828980326652527,
-0.24414613842964172,
0.5739712119102478,
-0.029911452904343605,
0.061882976442575455,
-0.43923527002334595,
0.5113739371299744,
0.3275964856147766,
-0.612514853477478,
0.035165321081876... |
func Counted(handler http.Handler, name string, registry metrics.Registry) *Counter {
counter := &Counter{
Counter: metrics.NewCounter(),
handler: handler,
}
if nil == registry {
registry = metrics.DefaultRegistry
}
registry.Register(name, counter)
return counter
} | [
1.3607616424560547,
0.20670560002326965,
0.7633431553840637,
-0.13387803733348846,
-0.10073200613260269,
0.7786117196083069,
0.5991182327270508,
-0.1186504140496254,
-0.06728556752204895,
-0.8619286417961121,
-0.5298066735267639,
0.31157535314559937,
0.48198530077934265,
0.8741952180862427... |
func (c *Counter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
c.handler.ServeHTTP(w, r)
c.Inc(1)
} | [
0.5864608287811279,
0.4643053412437439,
0.30904436111450195,
0.7823976278305054,
-0.1422879695892334,
1.1785311698913574,
1.0494979619979858,
-0.540341317653656,
-0.8621554970741272,
0.003993096761405468,
-0.5321809649467468,
-0.5647183060646057,
-0.3151119351387024,
0.624883234500885,
0... |
func Timed(handler http.Handler, name string, registry metrics.Registry) *Timer {
timer := &Timer{
Timer: metrics.NewTimer(),
handler: handler,
}
if nil == registry {
registry = metrics.DefaultRegistry
}
registry.Register(name, timer)
return timer
} | [
0.8233163356781006,
0.6658444404602051,
0.505452573299408,
-0.3328332304954529,
-0.14557507634162903,
0.34854549169540405,
-0.46577173471450806,
-0.2093091607093811,
-0.17126986384391785,
-0.7066584825515747,
-0.9161746501922607,
0.5899885892868042,
0.4537094533443451,
0.8983351588249207,
... |
func (t *Timer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer t.UpdateSince(time.Now())
t.handler.ServeHTTP(w, r)
} | [
0.22664527595043182,
0.3046281635761261,
0.5346264243125916,
0.6693572402000427,
-0.3849935531616211,
1.2129745483398438,
-0.05992810055613518,
-0.2578365206718445,
-1.0558274984359741,
1.1066194772720337,
-0.31994181871414185,
-0.5911890864372253,
-0.06586474180221558,
1.1406534910202026,... |
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
ch <- e.up.Desc()
e.authCacheHits.Describe(ch)
e.authCacheMisses.Describe(ch)
e.databaseReads.Describe(ch)
e.databaseWrites.Describe(ch)
e.openDatabases.Describe(ch)
e.openOsFiles.Describe(ch)
e.requestTime.Describe(ch)
e.httpdStatusCodes.Describe(ch)... | [
-0.1950194537639618,
0.2467682808637619,
0.8535143136978149,
-0.5099607110023499,
0.03551096469163895,
0.2739158570766449,
0.12137605249881744,
-0.4904768168926239,
-0.038510821759700775,
-0.006321422755718231,
0.09151571989059448,
0.7975614666938782,
0.17796005308628082,
0.461310148239135... |
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
e.mutex.Lock() // To protect metrics from concurrent collects.
defer e.mutex.Unlock()
if err := e.collect(ch); err != nil {
glog.Error(fmt.Sprintf("Error collecting stats: %s", err))
}
return
} | [
0.4198572337627411,
-0.05309419333934784,
0.7229486107826233,
-0.08678767085075378,
-0.31529176235198975,
0.8717990517616272,
0.0798744410276413,
-1.5214555263519287,
-0.35083523392677307,
0.35471248626708984,
0.6532017588615417,
0.6163498759269714,
0.37475720047950745,
0.9707085490226746,... |
func (c *Counter) N() int { return c.n } | [
-0.8886429071426392,
0.0786089226603508,
0.07999184727668762,
0.5632727146148682,
-0.2062961608171463,
0.1655987799167633,
1.2315106391906738,
-0.04787358269095421,
-0.7629334926605225,
-1.4183204174041748,
-1.2627911567687988,
0.1218309998512268,
0.4228147864341736,
1.4644125699996948,
... |
func (c *Counter) Increment() { c.n++ } | [
-0.05760917067527771,
0.14013373851776123,
0.10574821382761002,
-0.23267756402492523,
0.6945381760597229,
0.5729852914810181,
0.5947651267051697,
-0.2510519027709961,
-0.26670897006988525,
-1.6584216356277466,
-0.7626222372055054,
0.27307525277137756,
-0.30220168828964233,
1.01196837425231... |
func (c *Counter) Reset() { c.n = 0 } | [
0.011394483037292957,
0.2712250053882599,
-0.05851507931947708,
0.02881678380072117,
0.606866180896759,
0.5750177502632141,
1.011630892753601,
-0.3389160931110382,
-1.2188105583190918,
-0.6753703951835632,
-0.49073487520217896,
0.6778315305709839,
-0.7259868383407593,
0.3556964099407196,
... |
func (w Worker) Start() {
go func() {
for {
// register the current worker into the worker queue.
w.WorkerPool <- w.JobChannel
select {
case job := <-w.JobChannel:
// we have received a work request.
if err := job.Payload.Uplo... | [
-0.12128522247076035,
-0.11512821912765503,
0.531574547290802,
-0.23687341809272766,
0.9833025336265564,
-0.08094373345375061,
0.1364193558692932,
-0.27413877844810486,
-0.8479530215263367,
0.13305796682834625,
-0.6961832046508789,
1.2458935976028442,
-0.05841242894530296,
0.10498326271772... |
func (w Worker) Stop() {
go func() {
w.quit <- true
}()
} | [
-0.6593325138092041,
0.2287709265947342,
0.32887837290763855,
-0.12534932792186737,
0.678642749786377,
1.3175935745239258,
0.35150814056396484,
-0.09636221081018448,
-1.0028945207595825,
0.3930683732032776,
-1.1327646970748901,
0.41970154643058777,
-0.7149046659469604,
0.4704211354255676,
... |
func (r userRepository) newErrExisted() error {
return apperror.New("USER_EXISTED", "user is existed", "用户已存在")
} | [
0.14589090645313263,
-0.6318257451057434,
0.272630900144577,
0.27759042382240295,
1.1232503652572632,
-0.17112897336483002,
-0.3315039873123169,
0.4621788561344147,
0.20454587042331696,
-0.2974901795387268,
0.0659308061003685,
0.026081282645463943,
0.22636252641677856,
0.8421173095703125,
... |
func ChannelNameString(s string) (ChannelName, error) {
if val, ok := _ChannelNameNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to ChannelName values", s)
} | [
-0.2692197263240814,
-0.8694799542427063,
0.2375936508178711,
-0.12429703027009964,
-0.7856507301330566,
-0.15697301924228668,
-0.22148415446281433,
-0.5002192854881287,
-0.3468622863292694,
0.48535671830177307,
0.34268563985824585,
0.29870203137397766,
-0.28079789876937866,
-0.02090821228... |
func ChannelNameValues() []ChannelName {
return _ChannelNameValues
} | [
-0.3064980208873749,
-0.30352237820625305,
0.3070017397403717,
-0.2291223257780075,
-0.5277547240257263,
0.07157452404499054,
-0.9817512631416321,
-0.03350478783249855,
-0.4134247899055481,
-0.4074535369873047,
-0.3802017271518707,
1.245326280593872,
0.5933745503425598,
0.46919360756874084... |
func (i ChannelName) IsAChannelName() bool {
for _, v := range _ChannelNameValues {
if i == v {
return true
}
}
return false
} | [
-0.6898292303085327,
-0.2621854841709137,
0.16485849022865295,
0.41368621587753296,
0.4068545699119568,
-0.4518665373325348,
-0.2650044858455658,
-0.10691054165363312,
0.20163725316524506,
0.8349428772926331,
0.3375045955181122,
0.85251784324646,
-0.4309273660182953,
0.17437228560447693,
... |
func (i ChannelName) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
} | [
0.03781794756650925,
-0.13422268629074097,
0.11960909515619278,
-0.9164353609085083,
-0.5022463202476501,
-0.5596899390220642,
-0.517209529876709,
0.06022439897060394,
0.39761775732040405,
0.5420504212379456,
-0.38849014043807983,
1.5827888250350952,
-0.5889808535575867,
-0.263645350933074... |
func (i *ChannelName) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ChannelName should be a string, got %s", data)
}
var err error
*i, err = ChannelNameString(s)
return err
} | [
-0.38458511233329773,
0.18814219534397125,
0.2534749507904053,
-1.4677449464797974,
-0.7529709935188293,
-0.4419277310371399,
-0.20741236209869385,
-0.07671523839235306,
-0.18269512057304382,
0.39497071504592896,
0.31009602546691895,
1.0670441389083862,
-0.705171525478363,
-0.0530283302068... |
func (i ChannelName) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
} | [
0.5918107032775879,
0.2879953980445862,
0.06637692451477051,
-0.8519739508628845,
-0.6656249165534973,
-0.4134567081928253,
-1.4270044565200806,
-0.4045933783054352,
0.8645824193954468,
0.9205824732780457,
-0.3644821047782898,
0.6910119652748108,
-1.227531909942627,
-0.6201409697532654,
... |
func (i *ChannelName) UnmarshalText(text []byte) error {
var err error
*i, err = ChannelNameString(string(text))
return err
} | [
0.6200800538063049,
0.3821081519126892,
0.25252723693847656,
-1.6172120571136475,
-1.034671664237976,
-0.46525275707244873,
-0.5657500624656677,
0.07361134141683578,
0.10190179944038391,
0.8017473816871643,
0.07853081822395325,
0.19993869960308075,
-1.0999243259429932,
-0.24414004385471344... |
func (i ChannelName) MarshalYAML() (interface{}, error) {
return i.String(), nil
} | [
0.698803722858429,
-0.019740507006645203,
0.2892988324165344,
-0.6418065428733826,
-0.4027874767780304,
-0.03176359087228775,
-0.17946277558803558,
0.25798630714416504,
0.5270666480064392,
0.30622735619544983,
-0.11533842235803604,
0.7905269861221313,
-0.43543460965156555,
-0.5851002335548... |
func (i *ChannelName) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = ChannelNameString(s)
return err
} | [
0.22005951404571533,
0.47387319803237915,
0.5892166495323181,
-0.9760662317276001,
-0.685905933380127,
-1.2684894800186157,
0.17570319771766663,
0.42292505502700806,
0.2152930498123169,
0.6036226749420166,
0.638385534286499,
0.9848003387451172,
0.26124125719070435,
-0.24739070236682892,
... |
func (obj *Object) SetProperties(properties *enigma.GenericObjectProperties) {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil {
obj.data = &objectData{
properties: properties,
}
return
}
obj.data.properties = properties
} | [
-0.9312732815742493,
-0.5952531695365906,
0.23753897845745087,
-0.6314412355422974,
0.5738802552223206,
0.5403583645820618,
-0.004806799814105034,
-0.21864287555217743,
0.1070842370390892,
-0.31101083755493164,
-0.9729735255241394,
0.18918608129024506,
-0.017340270802378654,
-0.45906534790... |
func (obj *Object) Properties() *enigma.GenericObjectProperties {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil {
return nil
}
return obj.data.properties
} | [
-0.8442709445953369,
-0.8439227342605591,
0.3646453320980072,
-0.39725589752197266,
0.4470404386520386,
0.15874218940734863,
0.0005743870278820395,
-1.0174022912979126,
0.6928471922874451,
-0.632139265537262,
-0.2814275920391083,
0.07307545095682144,
-0.30297860503196716,
-1.08680415153503... |
func (obj *Object) SetChildList(children *enigma.ChildList) {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil {
obj.data = &objectData{
childlist: children,
}
return
}
obj.data.childlist = children
} | [
-0.869878888130188,
-0.2081507295370102,
0.22376428544521332,
-0.06575115770101547,
-0.20855772495269775,
0.5520772337913513,
0.3348124027252197,
-0.17151093482971191,
0.22336207330226898,
0.41802316904067993,
-2.632128953933716,
0.09170864522457123,
0.17988422513008118,
0.2328139841556549... |
func (obj *Object) SetChildren(children *[]ObjChild) {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil {
obj.data = &objectData{
children: children,
}
return
}
obj.data.children = children
} | [
-0.7698451280593872,
-0.09077765047550201,
0.2785467505455017,
-0.06850505620241165,
-0.1254873126745224,
0.35379308462142944,
0.13174068927764893,
-0.4999915063381195,
-0.06695133447647095,
-0.43848636746406555,
-1.9802459478378296,
0.7993312478065491,
-0.0014429454458877444,
0.0478195957... |
func (obj *Object) ChildList() *enigma.ChildList {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil {
return nil
}
return obj.data.childlist
} | [
0.49492964148521423,
-0.42972883582115173,
0.36058059334754944,
-0.07149400562047958,
-0.45550867915153503,
0.3098287582397461,
0.41509002447128296,
-0.7916444540023804,
0.6572825312614441,
0.1427576094865799,
-1.5458168983459473,
-0.15509840846061707,
0.03864646703004837,
-0.4838733673095... |
func (obj *Object) ExternalReferenceApps() []string {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.children == nil {
return nil
}
apps := make([]string, 0, len(*obj.data.children))
for _, item := range *obj.data.children {
apps = append(apps, item.ExternalReference.App)
}
r... | [
-0.6367200613021851,
-0.6329795718193054,
0.8610619306564331,
0.4665089249610901,
-0.6551033854484558,
1.0561535358428955,
-0.49606674909591675,
-0.6066932082176208,
0.7698232531547546,
1.271721601486206,
-0.09064707905054092,
0.4379456043243408,
-0.4544520974159241,
0.7183579206466675,
... |
func (obj *Object) SetListObjectDataPages(datapages []*enigma.NxDataPage) error {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.listobject == nil {
return errors.Errorf("object<%s> has no listobject", obj.ID)
}
obj.data.listobject.DataPages = datapages
return nil
} | [
-0.7322967648506165,
-0.7840405106544495,
0.2145913541316986,
-0.21498028934001923,
-0.006016433238983154,
0.8190578818321228,
-0.4223076403141022,
-0.18862800300121307,
1.4145644903182983,
-0.20563676953315735,
-1.3445783853530884,
0.9405149221420288,
-0.29934611916542053,
0.7264239192008... |
func (obj *Object) ListObjectDataPages() []*enigma.NxDataPage {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.listobject == nil {
return nil
}
return obj.data.listobject.DataPages
} | [
-0.26749950647354126,
-0.5647556185722351,
0.47951385378837585,
-0.09778352826833725,
0.06557844579219818,
0.5567632913589478,
-0.6984608173370361,
-0.8372076153755188,
1.6774708032608032,
0.09461863338947296,
-0.8373920917510986,
1.0266731977462769,
-0.04094246029853821,
0.237533554434776... |
func (obj *Object) SetHyperCubeDataPages(datapages []*enigma.NxDataPage, binned bool) error {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.hypercube == nil {
return errors.Errorf("object<%s> has no hypercube", obj.ID)
}
obj.data.hypercube.DataPages = datapages
obj.data.hypercub... | [
-0.14991141855716705,
-0.134428471326828,
0.5524792671203613,
0.013334394432604313,
0.5002884268760681,
1.0053871870040894,
0.1366509050130844,
0.2178448885679245,
0.07339789718389511,
-0.16253317892551422,
-1.3408452272415161,
1.10073983669281,
-0.6869920492172241,
0.7064855694770813,
0... |
func (obj *Object) SetStackHyperCubePages(datapages []*enigma.NxStackPage) error {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.hypercube == nil {
return errors.Errorf("object<%s> has no hypercube", obj.ID)
}
obj.data.hypercube.StackedDataPages = datapages
return nil
} | [
-0.5443101525306702,
0.4024848937988281,
0.5613493323326111,
0.5905174016952515,
0.3718121349811554,
0.347198486328125,
0.26498690247535706,
-0.45714735984802246,
-0.18336783349514008,
0.324891597032547,
-1.2519299983978271,
0.610711395740509,
-0.6841384768486023,
0.6483121514320374,
0.5... |
func (obj *Object) SetPivotHyperCubePages(datapages []*enigma.NxPivotPage) error {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.hypercube == nil {
return errors.Errorf("object<%s> has no hypercube", obj.ID)
}
obj.data.hypercube.PivotDataPages = datapages
return nil
} | [
-0.7337659597396851,
0.15237517654895782,
0.4863523840904236,
0.06751328706741333,
0.3736324906349182,
1.0601972341537476,
-0.05262436345219612,
-0.18883448839187622,
0.2971978187561035,
0.30580204725265503,
-1.0873600244522095,
0.017708655446767807,
-0.8981813192367554,
0.3008003830909729... |
func (obj *Object) HyperCubeDataPages() []*enigma.NxDataPage {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.hypercube == nil {
return nil
}
return obj.data.hypercube.DataPages
} | [
0.53814697265625,
0.2977965176105499,
0.4910176992416382,
0.5607429146766663,
0.5316707491874695,
0.607090950012207,
-0.9304587841033936,
-0.851067841053009,
0.4902152717113495,
0.47548508644104004,
-0.7695186734199524,
0.9038203358650208,
-0.8202167749404907,
0.2534847557544708,
-0.1806... |
func (obj *Object) HyperCubeStackPages() []*enigma.NxStackPage {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.hypercube == nil {
return nil
}
return obj.data.hypercube.StackedDataPages
} | [
0.2881608307361603,
0.6954243183135986,
0.5727767944335938,
0.8974811434745789,
0.6612392067909241,
-0.016309374943375587,
-0.7726941108703613,
-0.9935237765312195,
-0.030933430418372154,
0.8117238283157349,
-0.8391444087028503,
0.44710099697113037,
-0.7833912372589111,
0.5072274804115295,... |
func (obj *Object) HyperPivotPages() []*enigma.NxPivotPage {
obj.lockData.Lock()
defer obj.lockData.Unlock()
if obj.data == nil || obj.data.hypercube == nil {
return nil
}
return obj.data.hypercube.PivotDataPages
} | [
0.07939030230045319,
-0.05961468443274498,
0.5082821846008301,
0.4592719078063965,
0.7268249988555908,
0.6057259440422058,
-1.2305729389190674,
-0.6389662027359009,
0.7825627326965332,
0.38928842544555664,
-0.38164299726486206,
-0.027897410094738007,
-1.0111501216888428,
0.0692285001277923... |
func (obj *Object) Close() error {
if obj == nil {
return nil
}
if obj.closefuncs == nil {
return nil
}
var mErr *multierror.Error
for _, f := range obj.closefuncs {
err := f()
if err != nil {
mErr = multierror.Append(mErr, err)
}
}
return errors.WithStack(helpers.FlattenMultiError(mErr))
} | [
-0.5586920976638794,
0.2253841608762741,
0.8801048398017883,
0.7836198210716248,
-0.28781840205192566,
-0.3473442494869232,
0.5435547232627869,
-0.4716532528400421,
0.2962903678417206,
-0.12307631224393845,
-0.12284628301858902,
-0.42907580733299255,
-0.5832542181015015,
0.4132442772388458... |
func (obj *Object) RegisterCloseFunc(f func() error) {
if obj.closefuncs == nil {
obj.closefuncs = make([]func() error, 1)
obj.closefuncs[0] = f
return
}
obj.closefuncs = append(obj.closefuncs, f)
} | [
-0.8863897919654846,
0.30979350209236145,
0.8646172285079956,
0.064602330327034,
0.1406618356704712,
-0.398763507604599,
0.687184751033783,
-0.21750494837760925,
-0.12554863095283508,
-0.38612592220306396,
-0.8007917404174805,
0.4970230460166931,
0.7253903746604919,
0.10788808017969131,
... |
func (obj *Object) HasDims() bool {
return obj.ListObject() != nil || (obj.HyperCube() != nil && len(obj.HyperCube().DimensionInfo) > 0)
} | [
0.6357200741767883,
0.23991991579532623,
0.5207352638244629,
0.6434136629104614,
0.35291922092437744,
0.20606134831905365,
0.14705178141593933,
0.41040918231010437,
0.2131405621767044,
-0.9443632960319519,
-0.7057705521583557,
-0.10109864175319672,
0.36151450872421265,
1.3845710754394531,
... |
func NewObject(handle int, t ObjectType, id string, enigmaobject interface{}) *Object {
obj := &Object{
Handle: handle,
Type: t,
ID: id,
EnigmaObject: enigmaobject,
}
return obj
} | [
0.2593488395214081,
-0.9076753258705139,
0.4444579482078552,
-0.11761042475700378,
0.003532483708113432,
1.1435316801071167,
0.5292813181877136,
-0.7004052400588989,
-0.2436417192220688,
-0.3739587068557739,
-0.9461502432823181,
0.04928966611623764,
-0.19613012671470642,
-1.328870296478271... |
func majorityElement(nums []int) []int {
} | [
-1.089287519454956,
-0.6386335492134094,
0.32847195863723755,
1.2266126871109009,
0.5425019264221191,
0.2358459085226059,
0.802672803401947,
-0.214365616440773,
1.1932923793792725,
-0.24361677467823029,
0.13353241980075836,
0.6812720894813538,
-0.29507049918174744,
1.1578929424285889,
0.... |
func New() *AIO {
return NewNum(runtime.NumCPU())
} | [
0.5983293652534485,
-0.4899950623512268,
0.37711185216903687,
0.28543978929519653,
-0.9827074408531189,
-0.9629140496253967,
1.459783673286438,
0.16381865739822388,
-0.6081616282463074,
-0.7145981192588806,
-0.12370318174362183,
0.08994141966104507,
1.042855978012085,
0.05278405547142029,
... |
func NewNum(numThreads int) *AIO {
a := AIO{
rq: make(chan interface{}, ulimitNoFile()),
}
if numThreads < 1 {
numThreads = 1
}
for i := 0; i < numThreads; i++ {
t := newThread(a.rq)
go t.listen()
}
return &a
} | [
0.550193727016449,
0.17161187529563904,
0.5324856042861938,
0.06805488467216492,
-0.3094593286514282,
-0.46511977910995483,
0.6561219096183777,
-0.6271577477455139,
0.49278533458709717,
-0.8495616316795349,
0.4470311403274536,
0.044419851154088974,
0.08984332531690598,
-0.7721981406211853,... |
func (a *AIO) Open(key string) <-chan *OpenResp {
return a.OpenFile(key, os.O_RDONLY, 0)
} | [
-0.23406817018985748,
-0.141622856259346,
0.4189669191837311,
-0.9305864572525024,
-0.6258490085601807,
0.21213625371456146,
0.882701575756073,
-0.08957049250602722,
0.1617322415113449,
-0.41189926862716675,
0.7873847484588623,
-0.21275919675827026,
-0.4265623688697815,
-0.0411413013935089... |
func (a *AIO) OpenFile(key string, flag int, perm os.FileMode) <-chan *OpenResp {
or := acquireOpenRequest()
or.key = key
or.flag = flag
or.perm = perm
a.rq <- or
return or.resp
} | [
0.27135521173477173,
-0.43358105421066284,
0.4590165913105011,
0.17411334812641144,
-0.2507210671901703,
0.11569986492395401,
0.251175194978714,
-0.27551016211509705,
-0.3513208031654358,
-0.7545884251594543,
1.146217942237854,
-0.18884554505348206,
-1.3534069061279297,
-0.3905257880687713... |
func (a *AIO) Delete(key string) <-chan error {
var dr deleteRequest
dr.key = key
dr.errCh = make(chan error, 1)
a.rq <- &dr
return dr.errCh
} | [
-0.5019739270210266,
0.1262979805469513,
0.4277802109718323,
-0.07850372791290283,
0.10524407774209976,
-0.4375295341014862,
0.06962853670120239,
-0.9495656490325928,
0.7255887389183044,
0.45523232221603394,
1.065609335899353,
0.6685115098953247,
-1.0085394382476807,
0.2699073851108551,
... |
func authorize(name string) error {
if distro.Get() == distro.Synology {
return authorizeSynology(name)
}
return nil
} | [
-0.23941557109355927,
1.0829359292984009,
0.3556171655654907,
2.0771431922912598,
0.12684670090675354,
-0.5964281558990479,
0.7211865782737732,
0.4198817312717438,
0.36326465010643005,
0.4984803795814514,
-0.10967836529016495,
0.4710617959499359,
-0.016009164974093437,
0.9076719284057617,
... |
func authorizeSynology(name string) error {
f, err := os.Open("/etc/group")
if err != nil {
return err
}
defer f.Close()
s := bufio.NewScanner(f)
var agLine string
for s.Scan() {
if !mem.HasPrefix(mem.B(s.Bytes()), mem.S("administrators:")) {
continue
}
agLine = s.Text()
break
}
if err := s.Err();... | [
0.4407947063446045,
-0.057498570531606674,
0.6182300448417664,
-0.15768708288669586,
-0.4846276342868805,
-0.9877305626869202,
-0.03785615414381027,
-0.4385000169277191,
-0.33101028203964233,
0.6711896061897278,
0.4519141912460327,
1.2383217811584473,
-0.05871659517288208,
0.58775764703750... |
func authenticate() (string, error) {
if distro.Get() != distro.Synology {
return "", nil
}
cmd := exec.Command("/usr/syno/synoman/webman/modules/authenticate.cgi")
out, err := cmd.CombinedOutput()
if err != nil {
return "", fmt.Errorf("auth: %v: %s", err, out)
}
return strings.TrimSpace(string(out)), nil
} | [
-0.5544226765632629,
0.06892501562833786,
0.602091372013092,
1.5398670434951782,
0.06050237640738487,
-0.29883888363838196,
0.1658870279788971,
0.06256772577762604,
0.1590920239686966,
0.11780568212270737,
0.007070466410368681,
0.23844201862812042,
-0.7108355760574341,
0.7619512677192688,
... |
func tailscaleUpForceReauth(ctx context.Context) (authURL string, retErr error) {
prefs := ipn.NewPrefs()
prefs.ControlURL = ipn.DefaultControlURL
prefs.WantRunning = true
prefs.CorpDNS = true
prefs.AllowSingleHosts = true
prefs.ForceDaemon = (runtime.GOOS == "windows")
if distro.Get() == distro.Synology {
pr... | [
-0.6540656685829163,
-0.0348910428583622,
0.9153270721435547,
0.184798926115036,
0.13453370332717896,
-0.3256663382053375,
0.04867793619632721,
-0.2209165245294571,
-0.23387226462364197,
-0.3423965275287628,
0.46688559651374817,
0.5604894161224365,
-0.31751346588134766,
0.7604678869247437,... |
func (p *PlantUML) schemaTemplate() string {
return `@startuml
hide methods
hide stereotypes
skinparam class {
BackgroundColor White
BorderColor #6E6E6E
ArrowColor #6E6E6E
}
' tables
{{- range $i, $t := .Schema.Tables }}
rectangle "{{ $t.Name }}" {
{{- if ne $t.Type "VIEW" }}
entity {{ $t.Name }} as "{{ $t.Name... | [
-0.563940703868866,
0.2844710648059845,
0.7322046160697937,
-0.673391580581665,
-0.4794767498970032,
-0.3232722282409668,
0.17911775410175323,
0.0787392407655716,
-0.044704731553792953,
0.6581312417984009,
-0.5254985094070435,
0.009102770127356052,
0.2886691391468048,
-0.40918830037117004,... |
func (p *PlantUML) OutputSchema(wr io.Writer, s *Schema) error {
for _, t := range s.Tables {
err := addPrefix(t)
if err != nil {
return err
}
}
ts := p.schemaTemplate()
tmpl := template.Must(template.New(s.Name).Funcs(Funcs()).Parse(ts))
err := tmpl.Execute(wr, map[string]interface{}{
"Schema": ... | [
-1.0993752479553223,
0.2464105188846588,
0.5781248807907104,
0.3631141185760498,
-0.04171614348888397,
-0.728066086769104,
1.0784711837768555,
0.6082871556282043,
-0.2873128652572632,
0.65049809217453,
-0.051153987646102905,
-0.14037513732910156,
-0.059304654598236084,
-0.08019349724054337... |
func GetTokenFromCacheOrServer(ctx context.Context, config *oauth2.Config, get func(ctx context.Context, config *oauth2.Config) (*oauth2.Token, error)) (*oauth2.Token, error) {
cache, err := FindTokenCache(config)
switch {
case cache != nil:
return cache, nil
case err != nil:
log.Printf("Could not find token ca... | [
-0.3720724284648895,
-0.3289303183555603,
0.2736928164958954,
0.35255929827690125,
-0.15803532302379608,
-0.29089727997779846,
-0.3261377513408661,
0.021027732640504837,
0.8385555148124695,
-0.4242769777774811,
-0.22972333431243896,
1.033918023109436,
0.27577459812164307,
0.439510703086853... |
func FindTokenCache(config *oauth2.Config) (*oauth2.Token, error) {
name, err := tokenCacheName()
if err != nil {
return nil, err
}
file, err := os.Open(name)
if os.IsNotExist(err) {
return nil, nil
}
if err != nil {
return nil, fmt.Errorf("Could not open cache file %s: %s", name, err)
}
defer file.Close... | [
-0.01922835037112236,
-0.633853554725647,
0.3660428822040558,
-0.33927515149116516,
-0.684411883354187,
-0.41633373498916626,
-0.2607874870300293,
-0.2988184094429016,
-0.39667439460754395,
0.4143538475036621,
0.10928290337324142,
0.2378075271844864,
-0.33922645449638367,
0.308471024036407... |
func CreateTokenCache(token *oauth2.Token, config *oauth2.Config) error {
name, err := tokenCacheName()
if err != nil {
return err
}
file, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return fmt.Errorf("Could not create cache file %s: %s", name, err)
}
defer file.Close()
... | [
0.16885465383529663,
-0.34154343605041504,
0.3084257245063782,
-0.27945971488952637,
-0.3291618824005127,
0.02291649766266346,
-0.4580635130405426,
-0.18349699676036835,
0.003110306104645133,
0.43377217650413513,
-0.7459335327148438,
-0.22028310596942902,
0.15622715651988983,
-0.1003919616... |
func ReadTokenCache(r io.Reader, config *oauth2.Config) (*oauth2.Token, error) {
encrypted, err := ioutil.ReadAll(r)
if err != nil {
return nil, fmt.Errorf("Could not read token cache: %s", err)
}
stream, err := newAESCTR(config)
if err != nil {
return nil, fmt.Errorf("Could not initialize cipher: %s", err)
}... | [
-0.9283174276351929,
-0.5619142055511475,
0.2883497178554535,
-0.7085533738136292,
-1.2750227451324463,
-0.5035473108291626,
-0.3934820592403412,
-0.24665670096874237,
0.2571254074573517,
0.8560845851898193,
-0.07101050019264221,
0.8469170331954956,
0.22395066916942596,
-0.2851976454257965... |
func WriteTokenCache(w io.Writer, token *oauth2.Token, config *oauth2.Config) error {
tokenJSON, err := json.Marshal(token)
if err != nil {
return fmt.Errorf("Could not encode oauth2 token: %s", err)
}
stream, err := newAESCTR(config)
if err != nil {
return fmt.Errorf("Could not initialize cipher: %s", err)
}... | [
-0.8291770815849304,
0.09683308005332947,
0.2051185965538025,
-0.6400588154792786,
-0.18118320405483246,
-0.6697559952735901,
-0.21215702593326569,
-0.1632886379957199,
0.28022125363349915,
0.8255321979522705,
-1.2009822130203247,
0.3848949074745178,
0.2382873296737671,
0.17064282298088074... |
func NewPackagePool(root string, supportLegacyPaths bool) *PackagePool {
rootPath := filepath.Join(root, "pool")
rootPath, err := filepath.Abs(rootPath)
if err != nil {
panic(err)
}
return &PackagePool{
rootPath: rootPath,
supportLegacyPaths: supportLegacyPaths,
}
} | [
-0.20448261499404907,
-0.5779612064361572,
0.3119371235370636,
0.34218814969062805,
-1.1572017669677734,
0.266074538230896,
0.4390029311180115,
0.5449255108833313,
-0.20152975618839264,
0.42783138155937195,
-0.38172176480293274,
0.19070541858673096,
0.2733708322048187,
0.559635579586029,
... |
func (pool *PackagePool) LegacyPath(filename string, checksums *utils.ChecksumInfo) (string, error) {
filename = filepath.Base(filename)
if filename == "." || filename == "/" {
return "", fmt.Errorf("filename %s is invalid", filename)
}
hashMD5 := checksums.MD5
if len(hashMD5) < 4 {
return "", fmt.Errorf("un... | [
0.7369561195373535,
-0.9068987369537354,
0.7592518925666809,
0.3639916479587555,
-0.659512460231781,
0.5626599192619324,
0.7986595630645752,
0.7970273494720459,
-0.4095485508441925,
0.4297982156276703,
0.5204861760139465,
-0.9112066626548767,
0.13572712242603302,
-0.11092399805784225,
-0... |
func (pool *PackagePool) buildPoolPath(filename string, checksums *utils.ChecksumInfo) (string, error) {
filename = filepath.Base(filename)
if filename == "." || filename == "/" {
return "", fmt.Errorf("filename %s is invalid", filename)
}
hash := checksums.SHA256
if len(hash) < 4 {
// this should never happ... | [
-0.7684494853019714,
-0.9803099632263184,
0.6544728875160217,
0.08519487082958221,
-0.19374093413352966,
0.5212845802307129,
1.2717474699020386,
0.34888285398483276,
-0.26291000843048096,
0.6101999878883362,
-0.109279565513134,
-0.02256145142018795,
0.25451064109802246,
-0.4227614402770996... |
func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error) {
pool.Lock()
defer pool.Unlock()
dirs, err := os.ReadDir(pool.rootPath)
if err != nil {
if os.IsNotExist(err) {
return nil, nil
}
return nil, err
}
if len(dirs) == 0 {
return nil, nil
}
if progress != nil {
progres... | [
-0.38525110483169556,
-0.7805907726287842,
0.6881084442138672,
0.7611448764801025,
0.05642912536859512,
-0.2860177159309387,
1.0903609991073608,
0.2177683413028717,
-0.006496822461485863,
0.7882141470909119,
-0.03507336229085922,
-0.8403031229972839,
-0.4417093098163605,
1.4871668815612793... |
func (pool *PackagePool) Remove(path string) (size int64, err error) {
pool.Lock()
defer pool.Unlock()
path = filepath.Join(pool.rootPath, path)
info, err := os.Stat(path)
if err != nil {
return 0, err
}
err = os.Remove(path)
return info.Size(), err
} | [
-0.9203830361366272,
0.13701899349689484,
0.7416490316390991,
-0.3018139898777008,
-0.7685361504554749,
-0.528911828994751,
0.6613715887069702,
0.08059961348772049,
-0.0023251643870025873,
0.5104631185531616,
-0.40222182869911194,
-0.46348801255226135,
-0.8877909183502197,
0.35392639040946... |
func (pool *PackagePool) Verify(poolPath, basename string, checksums *utils.ChecksumInfo, checksumStorage aptly.ChecksumStorage) (string, bool, error) {
possiblePoolPaths := []string{}
if poolPath != "" {
possiblePoolPaths = append(possiblePoolPaths, poolPath)
} else {
// try to guess
if checksums.SHA256 != "... | [
-0.16927799582481384,
-0.4181371331214905,
0.8488880395889282,
-0.073521189391613,
0.7774381637573242,
0.4803704023361206,
0.6427969336509705,
0.0010316052939742804,
0.08825745433568954,
0.4156828820705414,
-0.19342412054538727,
-0.28446274995803833,
0.276938259601593,
0.1791677176952362,
... |
func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.ChecksumInfo, move bool, checksumStorage aptly.ChecksumStorage) (string, error) {
pool.Lock()
defer pool.Unlock()
source, err := os.Open(srcPath)
if err != nil {
return "", err
}
defer source.Close()
sourceInfo, err := source.Stat()
... | [
-0.25562167167663574,
-0.6593236923217773,
0.8723209500312805,
-0.39293813705444336,
0.26130983233451843,
0.4737893044948578,
1.3130661249160767,
-0.1566106677055359,
-0.016961073502898216,
0.6456108689308167,
-0.16070331633090973,
0.07744837552309036,
0.3155979812145233,
-0.58593612909317... |
func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error) {
return os.Open(filepath.Join(pool.rootPath, path))
} | [
-0.9799725413322449,
-0.5593757629394531,
0.1858862042427063,
-0.23293855786323547,
-0.6574277281761169,
0.5600407123565674,
0.862007737159729,
0.27477696537971497,
-0.5411719679832458,
-0.3051051199436188,
0.2111055552959442,
0.3910749852657318,
0.3755888342857361,
0.470187246799469,
-0... |
func (pool *PackagePool) Stat(path string) (os.FileInfo, error) {
return os.Stat(filepath.Join(pool.rootPath, path))
} | [
0.20803393423557281,
-1.1281092166900635,
0.3253144919872284,
-1.1696723699569702,
-0.1017242968082428,
0.2766980528831482,
0.7904697060585022,
-0.8891809582710266,
-0.4222653806209564,
-0.466616690158844,
-0.3942299783229828,
0.22257088124752045,
0.39480093121528625,
0.39230820536613464,
... |
func (pool *PackagePool) Link(path, dstPath string) error {
return os.Link(filepath.Join(pool.rootPath, path), dstPath)
} | [
-0.11658670753240585,
0.24261698126792908,
0.15863455832004547,
-0.06957188993692398,
0.18592999875545502,
1.4587488174438477,
0.7818877100944519,
0.025252502411603928,
-0.21022024750709534,
-0.158061683177948,
-0.13101942837238312,
1.011264681816101,
0.38425329327583313,
-0.53883129358291... |
func (pool *PackagePool) Symlink(path, dstPath string) error {
return os.Symlink(filepath.Join(pool.rootPath, path), dstPath)
} | [
0.3142082095146179,
0.17461955547332764,
0.1917998343706131,
-0.45784977078437805,
-0.3809848427772522,
0.9176355600357056,
0.8090461492538452,
0.8187696933746338,
-0.019940588623285294,
0.17819847166538239,
-0.4262063205242157,
1.0223792791366577,
0.643372118473053,
-0.6042922735214233,
... |
func (pool *PackagePool) FullPath(path string) string {
return filepath.Join(pool.rootPath, path)
} | [
0.6433844566345215,
-0.7987883687019348,
0.3044687509536743,
-0.1566801816225052,
-0.47768905758857727,
0.9534339308738708,
0.9456030130386353,
-0.6782056093215942,
0.1457001119852066,
-0.0458325557410717,
0.36563360691070557,
-0.008640190586447716,
0.046143606305122375,
0.1085768193006515... |
func (pool *PackagePool) GenerateTempPath(filename string) (string, error) {
random := uuid.NewRandom().String()
return filepath.Join(pool.rootPath, random[0:2], random[2:4], random[4:]+filename), nil
} | [
-0.9325681328773499,
-0.6047258377075195,
0.615593433380127,
0.2766692638397217,
-0.022346822544932365,
1.1714403629302979,
1.2977418899536133,
0.25124162435531616,
0.17799095809459686,
0.4062284231185913,
-0.5781983137130737,
-1.002211570739746,
-0.8001911044120789,
-0.22437098622322083,
... |
func (*ReserveRequest) Descriptor() ([]byte, []int) {
return file_proto_bw_allocation_v1_bw_allocation_proto_rawDescGZIP(), []int{0}
} | [
-0.6140220165252686,
0.3932679295539856,
0.67983078956604,
-0.1604790985584259,
0.3508646786212921,
-0.25384485721588135,
-0.008246961049735546,
0.6040257215499878,
0.0897025391459465,
-0.3219998776912689,
-0.18566781282424927,
0.11398033052682877,
-0.28858429193496704,
0.2933919429779053,... |
func (*ReserveResponse) Descriptor() ([]byte, []int) {
return file_proto_bw_allocation_v1_bw_allocation_proto_rawDescGZIP(), []int{1}
} | [
-0.006155789364129305,
0.12555699050426483,
0.31185513734817505,
-0.40428024530410767,
0.7376651167869568,
-0.7193872332572937,
0.7108951807022095,
0.05393242463469505,
0.2727722227573395,
-0.4882287085056305,
-0.8516305685043335,
-0.6880732774734497,
-1.1380198001861572,
-0.76412308216094... |
func (*BandwidthHint) Descriptor() ([]byte, []int) {
return file_proto_bw_allocation_v1_bw_allocation_proto_rawDescGZIP(), []int{2}
} | [
0.7489001750946045,
0.38942962884902954,
0.08950590342283249,
-0.6041403412818909,
0.35631003975868225,
0.17448124289512634,
0.09764047712087631,
-0.6279123425483704,
-0.3409964442253113,
-0.3239656090736389,
-0.1577448546886444,
1.4307918548583984,
-0.6003903150558472,
0.39828601479530334... |
func (*ExpirationHint) Descriptor() ([]byte, []int) {
return file_proto_bw_allocation_v1_bw_allocation_proto_rawDescGZIP(), []int{3}
} | [
0.862653374671936,
0.4606636166572571,
0.09769695997238159,
-0.00598490284755826,
0.11459751427173615,
0.6413029432296753,
-0.39424294233322144,
-0.38951337337493896,
-0.6111629605293274,
-0.047844063490629196,
0.00030899050761945546,
0.41025510430336,
0.03534043952822685,
0.78575736284255... |
func Jobs(nomad *NomadServer) ([]Job, int, error) {
jobs := make([]Job, 0)
status, err := decodeJSON(url(nomad)+"/v1/jobs", &jobs)
return jobs, status, err
} | [
-1.8523743152618408,
0.2595612108707428,
0.3728141784667969,
-0.3060343563556671,
-0.3336006700992584,
-0.7192599177360535,
-0.8833526372909546,
0.6717802286148071,
-0.7878024578094482,
0.025110822170972824,
-1.2119337320327759,
0.42001670598983765,
-0.7058973908424377,
0.12012683600187302... |
func FindJob(nomad *NomadServer, name string) (*Job, error) {
jobs, _, _ := Jobs(nomad)
for _, job := range jobs {
if job.Name == name {
return &job, nil
}
}
return &Job{}, errors.New("job not found")
} | [
0.5254452228546143,
0.07778770476579666,
0.28526970744132996,
0.5381359457969666,
-0.8151007294654846,
0.08041376620531082,
-0.5473712086677551,
-0.9919065237045288,
-0.451178640127182,
0.2664194405078888,
0.33595579862594604,
0.10353675484657288,
-1.3721331357955933,
0.6423028111457825,
... |
func Hosts(nomad *NomadServer) ([]Host, int, error) {
hosts := make([]Host, 0)
status, err := decodeJSON(url(nomad)+"/v1/nodes", &hosts)
return hosts, status, err
} | [
-1.8203415870666504,
0.2019551694393158,
0.23811037838459015,
-0.6124428510665894,
0.11827924102544785,
-0.5201823711395264,
-0.858932614326477,
0.6213299632072449,
-0.8757531642913818,
0.3606626093387604,
-0.36238405108451843,
0.7422001361846924,
0.060357626527547836,
-0.01363333314657211... |
func Drain(nomad *NomadServer, id string, enable bool) (int, error) {
resp, err := retryablehttp.Post(url(nomad)+"/v1/node/"+id+"/drain?enable="+strconv.FormatBool(enable), "application/json", nil)
if resp != nil && resp.Body != nil {
defer resp.Body.Close()
return resp.StatusCode, err
}
return http.StatusInter... | [
-0.9079381823539734,
0.8023149371147156,
0.9335890412330627,
-0.4735637605190277,
-0.5694316029548645,
-0.002834067214280367,
-0.09637502580881119,
-0.12486185878515244,
0.1041439101099968,
0.2589229643344879,
-0.3962489664554596,
0.8437289595603943,
-1.876059889793396,
0.03002751059830188... |
func StopJob(nomad *NomadServer, job *Job) (int, error) {
url := fmt.Sprintf("http://%v:%v/v1/job/%v", nomad.Address, nomad.Port, job.Name)
req, err := retryablehttp.NewRequest(http.MethodDelete, url, bytes.NewReader([]byte{}))
if err != nil {
buf := log("event", "stop_job_request_error", "jobname", job.Name, "err... | [
-0.20292511582374573,
0.0395122729241848,
1.1685391664505005,
-0.12760649621486664,
-0.7729814648628235,
-0.1519690454006195,
0.02925105020403862,
0.0032060607336461544,
-0.609634518623352,
0.5216912627220154,
0.01970525085926056,
0.6095069050788879,
-1.5700640678405762,
-0.059326361864805... |
func SubmitJob(nomad *NomadServer, launchFilePath string) (int, error) {
file, err := ioutil.ReadFile(launchFilePath)
if err != nil {
return http.StatusBadRequest, err
}
resp, err := retryablehttp.Post(url(nomad)+"/v1/jobs", "application/json", bytes.NewReader(file))
defer resp.Body.Close()
return resp.StatusCo... | [
-0.2876659631729126,
-0.10267715156078339,
0.7201663851737976,
0.7486507892608643,
-0.8675041198730469,
0.7160161137580872,
-0.2168176919221878,
0.7344341278076172,
-0.9429765939712524,
-0.19015169143676758,
-0.22513166069984436,
0.5605629682540894,
-1.2145965099334717,
0.45436155796051025... |
func Allocs(nomad *NomadServer) []Alloc {
allocs := make([]Alloc, 0)
decodeJSON(url(nomad)+"/v1/allocations", &allocs)
return allocs
} | [
-1.5531799793243408,
0.2147628515958786,
0.5945873260498047,
-0.19151057302951813,
-0.6609091758728027,
-0.5695635080337524,
-0.38827863335609436,
-0.7163093686103821,
1.049013376235962,
0.8690688610076904,
0.5655967593193054,
0.50675368309021,
0.34620633721351624,
-0.09426572918891907,
... |
func FindAlloc(nomad *NomadServer, job *Job, host *Host) (*Alloc, error) {
allocs := Allocs(nomad)
for _, alloc := range allocs {
if alloc.NodeID == host.ID && strings.Contains(alloc.Name, job.Name) {
// We may be looking at a stale allocation and a newer one exists
if alloc.DesiredStatus == "stop" && len(all... | [
0.19952674210071564,
-0.7367622256278992,
0.7208620309829712,
-0.4325413107872009,
-1.1549028158187866,
-0.23365844786167145,
-0.19147425889968872,
-0.7630654573440552,
-0.3626869022846222,
0.7049038410186768,
0.9841768741607666,
0.33865076303482056,
-0.032991643995046616,
0.63683813810348... |
func Active(nomad *NomadServer, job *Job, host *Host) bool {
allocs := Allocs(nomad)
for _, alloc := range allocs {
if alloc.NodeID == host.ID && strings.Contains(alloc.Name, job.Name) {
if alloc.DesiredStatus != "stop" && strings.Contains(alloc.Name, "worker") {
return true
}
}
}
return false
} | [
-0.5684196949005127,
-0.8550784587860107,
0.6572613716125488,
-0.24081678688526154,
-0.9694889187812805,
0.42923927307128906,
-0.10867682099342346,
0.057630084455013275,
-1.0793964862823486,
0.4969727694988251,
0.10512048751115799,
0.05620640516281128,
-0.13734325766563416,
-0.252753794193... |
func Services(nomad *NomadServer, job *Job, host *Host) []string {
services := make([]string, 0)
allocs := Allocs(nomad)
for _, alloc := range allocs {
if alloc.NodeID == host.ID && strings.Contains(alloc.Name, job.Name) {
if alloc.DesiredStatus != "stop" {
services = append(services, alloc.TaskGroup)
}
... | [
-1.1507937908172607,
0.06585666537284851,
0.36930033564567566,
-0.45120254158973694,
-0.8005806803703308,
0.18664295971393585,
-0.044796738773584366,
-0.9107484221458435,
-0.8560590147972107,
0.7885323166847229,
0.5468065738677979,
0.11626207828521729,
-0.27527081966400146,
0.9255697131156... |
func (alloc *Alloc) CheckTaskStates(state string) bool {
for k := range alloc.Tasks {
task := alloc.Tasks[k]
if task.State != state {
return false
}
}
return true
} | [
0.027660664170980453,
-0.03965055197477341,
0.618280827999115,
0.198908269405365,
-0.9673969149589539,
0.5182374715805054,
0.18956193327903748,
-0.41202375292778015,
0.35228580236434937,
1.0737920999526978,
-0.35114434361457825,
-0.6819702386856079,
0.37161335349082947,
0.20445507764816284... |
func HostID(nomad *NomadServer, hostname *string) (*Host, error) {
hosts, _, err := Hosts(nomad)
if err != nil {
return &Host{}, err
}
for _, host := range hosts {
if *hostname == host.Name {
return &host, nil
}
}
buf := log("event", "node_not_found", "hostname", hostname)
return &Host{}, errors.New(buf... | [
0.48754116892814636,
-0.2835526466369629,
0.37148553133010864,
0.16268330812454224,
-0.5015121698379517,
0.34599190950393677,
-0.03788335993885994,
-0.22952324151992798,
-0.4687369465827942,
0.5896754264831543,
0.586079478263855,
1.0098375082015991,
-0.7166398763656616,
0.08989961445331573... |
func (cts *CuddlyToyService) GetAllCuddlyToys() ([]CuddlyToy, error) {
//TODO: CALL GetAllDogs and GetAllMonkeys here
rows, err := cts.DB.Query("SELECT id, name, energy_level FROM monkeys UNION SELECT id, name, energy_level FROM dogs")
if err != nil {
return nil, err
}
defer rows.Close()
cuddlyToys := []Cud... | [
-0.35591787099838257,
-0.33822500705718994,
0.39619553089141846,
0.015462003648281097,
-0.007819099351763725,
-0.22232821583747864,
-0.35109952092170715,
-0.5206741690635681,
-1.0848157405853271,
-0.32724887132644653,
-1.0846850872039795,
0.4965553283691406,
-0.4931105375289917,
1.47104322... |
func (s Secret) MarshalYAML() (interface{}, error) {
if s != "" {
return "<secret>", nil
}
return nil, nil
} | [
0.9318260550498962,
0.4479339122772217,
0.34747248888015747,
1.226710319519043,
-0.35265374183654785,
0.036946918815374374,
-0.16892634332180023,
0.9490394592285156,
1.3356083631515503,
-0.039981648325920105,
-0.3228941261768341,
0.7770082950592041,
0.5558100938796997,
0.4754939377307892,
... |
func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {
type plain Secret
return unmarshal((*plain)(s))
} | [
0.23407533764839172,
0.6251274347305298,
0.4601699709892273,
0.2592615783214569,
-0.7388904690742493,
-0.8085328340530396,
0.3827340006828308,
0.5580933094024658,
0.6369590759277344,
0.4877322316169739,
-0.8629910349845886,
0.6901314854621887,
0.644496500492096,
-0.0888056606054306,
0.55... |
func StreamMediaRelations() chan *MediaRelation {
channel := make(chan *MediaRelation)
url := "media-relationships?page[limit]=20&include=source,destination"
ticker := time.NewTicker(1000 * time.Millisecond)
rateLimit := ticker.C
go func() {
defer close(channel)
defer ticker.Stop()
for {
page, err := Ge... | [
0.00956097524613142,
-0.02205820195376873,
0.5163828134536743,
-1.147178292274475,
0.07374482601881027,
-0.07266809046268463,
-0.18280279636383057,
-0.8893312811851501,
-0.09563759714365005,
-0.45731642842292786,
0.9168044328689575,
1.1346358060836792,
-1.1835664510726929,
0.51672196388244... |
func (m *ItemCalendarRequestBuilder) AllowedCalendarSharingRolesWithUser(user *string)(*ItemCalendarAllowedCalendarSharingRolesWithUserRequestBuilder) {
return NewItemCalendarAllowedCalendarSharingRolesWithUserRequestBuilderInternal(m.pathParameters, m.requestAdapter, user)
} | [
0.006586239207535982,
0.19004657864570618,
0.32766950130462646,
0.4866259694099426,
-1.4711493253707886,
1.1044232845306396,
0.4935299754142761,
-0.4775141179561615,
0.41161927580833435,
-1.3095353841781616,
0.32668063044548035,
0.4689822196960449,
-0.17689386010169983,
-0.2809069454669952... |
func (m *ItemCalendarRequestBuilder) CalendarPermissions()(*ItemCalendarCalendarPermissionsRequestBuilder) {
return NewItemCalendarCalendarPermissionsRequestBuilderInternal(m.pathParameters, m.requestAdapter)
} | [
-0.49689239263534546,
0.16818399727344513,
0.358415424823761,
0.5324268937110901,
-0.7954645156860352,
-0.005465706344693899,
-0.16267022490501404,
-0.5236160159111023,
0.3709610104560852,
-0.5618059635162354,
0.2435833066701889,
0.3870941400527954,
-0.9273036122322083,
-1.0028899908065796... |
func (m *ItemCalendarRequestBuilder) CalendarPermissionsById(id string)(*ItemCalendarCalendarPermissionsCalendarPermissionItemRequestBuilder) {
urlTplParams := make(map[string]string)
for idx, item := range m.pathParameters {
urlTplParams[idx] = item
}
if id != "" {
urlTplParams["calenda... | [
0.005449682008475065,
0.2520643174648285,
0.10931652039289474,
0.21253737807273865,
-1.2226091623306274,
-0.4803406298160553,
-0.08498738706111908,
-0.6487403512001038,
0.51934814453125,
0.415567547082901,
-0.09461750090122223,
-0.028699325397610664,
-0.7215892672538757,
-0.437043219804763... |
func (m *ItemCalendarRequestBuilder) CalendarView()(*ItemCalendarCalendarViewRequestBuilder) {
return NewItemCalendarCalendarViewRequestBuilderInternal(m.pathParameters, m.requestAdapter)
} | [
-0.5981317758560181,
-0.31358838081359863,
0.40349581837654114,
0.2753458023071289,
-0.871134340763092,
-0.018595216795802116,
-0.2030053287744522,
-0.10696449875831604,
0.27457407116889954,
-1.5497735738754272,
0.8206738233566284,
1.110662817955017,
-0.32697921991348267,
-0.96333301067352... |
func (m *ItemCalendarRequestBuilder) CalendarViewById(id string)(*ItemCalendarCalendarViewEventItemRequestBuilder) {
urlTplParams := make(map[string]string)
for idx, item := range m.pathParameters {
urlTplParams[idx] = item
}
if id != "" {
urlTplParams["event%2Did"] = id
}
return... | [
-0.205049067735672,
-0.22187967598438263,
0.2232634574174881,
0.15599900484085083,
-1.4135085344314575,
-0.6498897671699524,
-0.006285110488533974,
-0.16477803885936737,
0.40819963812828064,
-0.7141024470329285,
0.2844248414039612,
0.6120277643203735,
-0.2228732705116272,
-0.15739293396472... |
func NewItemCalendarRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarRequestBuilder) {
m := &ItemCalendarRequestBuilder{
}
m.urlTemplate = "{+baseurl}/groups/{group%2Did}/calendar{?%24select... | [
-0.8522924780845642,
-0.764461100101471,
0.5150671601295471,
0.02456297166645527,
-0.745577335357666,
0.35259535908699036,
0.34221071004867554,
-0.34070098400115967,
-0.04797215759754181,
-0.8891858458518982,
0.2671315371990204,
0.5183046460151672,
-0.9823892116546631,
-0.454730361700058,
... |
func NewItemCalendarRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarRequestBuilder) {
urlParams := make(map[string]string)
urlParams["request-raw-url"] = rawUrl
return NewItemCalendarRequestBuilderInternal(urlParams,... | [
-0.8335408568382263,
-0.9377335906028748,
0.554693877696991,
0.7020084857940674,
-0.4927561581134796,
0.2554943561553955,
-0.09839960187673569,
0.09052065014839172,
0.7419027090072632,
-1.409766674041748,
0.2680955231189728,
-0.07963787019252777,
-0.6609023809432983,
-0.5121700763702393,
... |
func (m *ItemCalendarRequestBuilder) Events()(*ItemCalendarEventsRequestBuilder) {
return NewItemCalendarEventsRequestBuilderInternal(m.pathParameters, m.requestAdapter)
} | [
-0.6682815551757812,
-0.1805548518896103,
0.44352439045906067,
0.14960119128227234,
0.3100014328956604,
-0.0629194900393486,
0.16408860683441162,
0.2435159832239151,
0.9999326467514038,
-1.6907970905303955,
0.03542913869023323,
0.1878376603126526,
-0.40282630920410156,
-1.0773921012878418,... |
func (m *ItemCalendarRequestBuilder) EventsById(id string)(*ItemCalendarEventsEventItemRequestBuilder) {
urlTplParams := make(map[string]string)
for idx, item := range m.pathParameters {
urlTplParams[idx] = item
}
if id != "" {
urlTplParams["event%2Did"] = id
}
return NewItemCale... | [
-0.29706838726997375,
-0.122735895216465,
0.2832907736301422,
-0.0890357568860054,
-0.0876072347164154,
-0.5587842464447021,
0.5115596055984497,
-0.14019861817359924,
0.4981502890586853,
-0.4855540096759796,
-0.3714369237422943,
0.09056901931762695,
-0.35802188515663147,
-0.541019320487976... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.