text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (c Cents) Int() int { return int(c) }
[ 0.7568768858909607, 0.09228795021772385, 0.09276904910802841, -1.9775642156600952, -0.22403550148010254, 0.8443694710731506, 0.19871650636196136, -0.509283185005188, -0.900966227054596, -0.5797515511512756, -0.22071132063865662, -0.3580770790576935, -0.3783469498157501, 0.03739462047815323...
func (c Cents) Int64() int64 { return int64(c) }
[ -0.2053776979446411, 0.4664803445339203, 0.04206197336316109, -0.4370289742946625, 0.37261727452278137, 0.006440684199333191, -0.31703686714172363, -0.3225322961807251, -0.019625438377261162, -0.49347543716430664, 0.3134084641933441, -0.7608055472373962, -0.6927875876426697, 0.204542428255...
func (c Cents) ToMillicents() Millicents { return Millicents(c.Int() * 1000) }
[ 0.40041881799697876, -0.24297595024108887, 0.05157201737165451, -1.8715938329696655, -0.6403761506080627, -0.8953671455383301, -0.4350133538246155, -0.5531629323959351, 1.45381498336792, 0.4510374367237091, -0.3441615402698517, -0.5748469233512878, -0.17449761927127838, 0.3263227343559265,...
func (c Cents) ToDollarString() string { d := float64(c) / 100.0 s := fmt.Sprintf("$%.2f", d) return s }
[ 0.6432145833969116, -0.1756858229637146, 0.7605607509613037, -1.6836416721343994, -0.9353567361831665, 1.024863600730896, -0.6181262135505676, -0.9955855011940002, 0.12842057645320892, -0.2602240741252899, 0.7855199575424194, -0.7747388482093811, 0.687083899974823, -0.16322876513004303, ...
func (c Cents) ToDollarFloatNoRound() float64 { d := float64(c) / 100.0 return d }
[ 0.7763043642044067, 0.18255077302455902, 0.36539241671562195, -1.404188871383667, 0.17742322385311127, 0.7075759768486023, -0.11438237130641937, -1.1099328994750977, -0.10813455283641815, -1.2915674448013306, 0.3940437436103821, -0.55360347032547, -0.3963998854160309, 0.6243485808372498, ...
func CalculateWorkloadCommandParameters(qps int, duration time.Duration, config *Config) { config.WorkloadOperationCount = int64(qps) * int64(duration.Seconds()) config.workloadCommand = fmt.Sprint( fmt.Sprintf(" -p redis.host=%s", config.RedisHost), fmt.Sprintf(" -p redis.port=%d", config.RedisPort), fmt.Spr...
[ -0.46458563208580017, 0.04830876737833023, 0.8191947937011719, -1.0701396465301514, 0.08332554250955582, 0.540036678314209, -0.06193455681204796, -0.40482625365257263, -0.06535952538251877, 0.3975025415420532, -0.2421325445175171, -0.11032753437757492, -0.3003408908843994, 0.35981732606887...
func RunCLI(cli *cli.Context) error { setResolv() c := newConfig() c.setSection(cli.String("name")) d := New(cli.Args()) l := newLines(d) l.output(d) return nil }
[ -0.03493073210120201, 0.03061690181493759, 0.47734737396240234, 0.10230953991413116, -0.21081480383872986, -0.12493132054805756, -0.7244750261306763, -0.3117011487483978, -1.5130318403244019, -0.15941399335861206, -0.7807493209838867, -0.34339970350265503, 0.282223641872406, 0.363742828369...
func JWKSClient(s jwks.JWKSSource) jwks.JWKSClient { return jwks.NewDefaultClient( s, time.Hour, // Refresh keys every 1 hour 12*time.Hour, // Expire keys after 12 hours ) }
[ -0.10273662209510803, 0.27822890877723694, 0.409591406583786, -1.3450145721435547, -1.3029032945632935, -0.7042163014411926, -0.5185145735740662, -1.5155857801437378, 0.3180125057697296, -0.3706113398075104, -1.0305285453796387, 0.27693670988082886, 0.3385438919067383, -0.21284610033035278...
func JWKSWebSource(url string) *jwks.WebSource { return jwks.NewWebSource(url) }
[ 0.15132854878902435, 0.6090313792228699, 0.22930316627025604, -0.2785424590110779, -1.3548763990402222, -0.7058900594711304, 0.5676624774932861, -0.3650107681751251, 0.8925655484199524, -0.1864190250635147, -1.0174635648727417, 0.10879247635602951, -0.05551765114068985, 0.39427727460861206...
func JWKSFileSource(filepath string) (*jwks.DummySource, error) { b, err := ioutil.ReadFile(filepath) if err != nil { return nil, err } return JWKSByteSource(b) }
[ -0.061058178544044495, 0.9338417649269104, 0.27038338780403137, -1.087530255317688, -0.6436518430709839, -0.2395867556333542, 0.6446727514266968, -0.4189242124557495, 0.11253970861434937, 0.5048632621765137, -1.3064361810684204, -0.24651868641376495, 0.09081562608480453, -0.300623804330825...
func JWKSByteSource(b []byte) (*jwks.DummySource, error) { var keyset jose.JSONWebKeySet if err := json.Unmarshal(b, &keyset); err != nil { return nil, err } return jwks.NewDummySource(&keyset), nil }
[ -0.3942197263240814, 0.758573055267334, 0.2971709966659546, -1.3408559560775757, -1.0553969144821167, -1.327979326248169, 0.47359469532966614, -0.8522840738296509, 1.1462516784667969, 0.5968109965324402, -1.5033867359161377, -0.0022704729344695807, -0.20693641901016235, 0.04351088777184486...
func GenerateJWKSWithNewRSAKeys(publicKeyID string, privateKeyID string) (jose.JSONWebKeySet, error) { key, err := rsa.GenerateKey(rand.Reader, 4096) if err != nil { return jose.JSONWebKeySet{}, err } pub := jose.JSONWebKey{Key: key.Public(), KeyID: publicKeyID, Algorithm: string(jose.RS256), Use: "sig"} priv :...
[ -0.40952354669570923, -0.26848188042640686, 0.6718396544456482, -0.10889030992984772, -0.738893449306488, -0.8161898255348206, -0.45042645931243896, -1.0841295719146729, 0.394435316324234, 0.3276101052761078, -0.3461541533470154, 0.8860134482383728, 0.0789887011051178, 1.7694355249404907, ...
func (t *Transport) NewOutbound(chooser peer.Chooser) *Outbound { return &Outbound{ once: lifecycle.NewOnce(), transport: t, chooser: chooser, } }
[ -0.6618017554283142, -0.918545663356781, 0.22539022564888, -0.22254951298236847, -0.7200735211372375, 0.3026037812232971, -1.2010716199874878, -0.7207181453704834, 0.13490967452526093, 0.5472978949546814, -0.499967485666275, 0.6372532844543457, -0.16164875030517578, 0.36692431569099426, ...
func (t *Transport) NewSingleOutbound(addr string) *Outbound { chooser := peerchooser.NewSingle(hostport.PeerIdentifier(addr), t) return t.NewOutbound(chooser) }
[ -0.25962209701538086, -0.379408597946167, 0.36167338490486145, -0.12156474590301514, -1.1175296306610107, 0.1643783450126648, -0.6875605583190918, 0.2657003104686737, 0.5233961343765259, 0.05608660727739334, -1.105719804763794, 0.4152882397174835, 0.4572101831436157, 0.3068503439426422, ...
func (o *Outbound) TransportName() string { return TransportName }
[ -0.3810708224773407, -0.6967301964759827, 0.5736082196235657, 0.17421138286590576, -0.6756256818771362, 0.6964048743247986, 0.743638813495636, -0.4656384289264679, -0.007218632381409407, 0.8358234167098999, -0.41972973942756653, 0.8497027158737183, -0.2998855710029602, -0.36120545864105225...
func (o *Outbound) Chooser() peer.Chooser { return o.chooser }
[ -0.10712305456399918, -1.010236144065857, 0.38040846586227417, 0.3128219544887543, -0.7864930033683777, 0.9320843815803528, -0.004796287510544062, -0.3285265564918518, -0.03415409475564957, -0.16675837337970734, 0.18897415697574615, 0.3751545548439026, -0.11144468933343887, 0.3228173851966...
func (o *Outbound) Call(ctx context.Context, req *transport.Request) (*transport.Response, error) { if req == nil { return nil, yarpcerrors.InvalidArgumentErrorf("request for tchannel outbound was nil") } if err := o.once.WaitUntilRunning(ctx); err != nil { return nil, intyarpcerrors.AnnotateWithInfo(yarpcerrors...
[ -0.9174773693084717, -0.047619063407182693, 1.0863896608352661, -0.6320759654045105, -0.2278432548046112, 0.12430546432733536, -1.1289632320404053, -1.1670678853988647, -0.24900713562965393, 0.3690674901008606, 0.980336606502533, 0.15853634476661682, -0.24699191749095917, 0.474476605653762...
func (p *tchannelPeer) Call(ctx context.Context, req *transport.Request) (*transport.Response, error) { return callWithPeer(ctx, req, p.getPeer(), p.transport.headerCase) }
[ -0.822853147983551, -0.2132309526205063, 0.5406190752983093, -0.1959644854068756, -0.34796345233917236, 0.5860805511474609, -1.672847032546997, -1.1081775426864624, -0.1123112365603447, 0.3646524250507355, 0.723727285861969, -0.4400186836719513, -0.5694009065628052, 0.3710196614265442, 0...
func callWithPeer(ctx context.Context, req *transport.Request, peer *tchannel.Peer, headerCase headerCase) (*transport.Response, error) { // NB(abg): Under the current API, the local service's name is required // twice: once when constructing the TChannel and then again when // constructing the RPC. var call *tchan...
[ -0.45541635155677795, -0.3398589789867401, 0.984830915927887, -0.14854754507541656, -0.3689410388469696, -0.20354719460010529, -0.8393296003341675, -1.0858174562454224, 0.27372977137565613, 0.40121492743492126, 0.3859061002731323, -0.8246976137161255, -0.5491666793823242, 0.560000121593475...
func (o *Outbound) Transports() []transport.Transport { return []transport.Transport{o.transport} }
[ -0.6897774934768677, -0.4679952561855316, 0.3468437194824219, -0.7123981714248657, 0.5842244625091553, 0.6082590222358704, -0.29876402020454407, -1.4726190567016602, 1.187433123588562, -0.8053433895111084, -1.002278208732605, 0.7924752831459045, -0.16658851504325867, -0.1314120888710022, ...
func (o *Outbound) Start() error { return o.once.Start(o.chooser.Start) }
[ -0.42439740896224976, -0.2944173514842987, 0.3378007113933563, 0.8601905703544617, 0.4467902183532715, 0.040472112596035004, 0.07011038064956665, 0.1566053330898285, -0.3259471356868744, 0.6762851476669312, -0.5826660990715027, 1.7971404790878296, 0.006585091818124056, 0.6701585650444031, ...
func (o *Outbound) Stop() error { return o.once.Stop(o.chooser.Stop) }
[ -1.562345027923584, -0.33537057042121887, 0.280174195766449, 0.30653178691864014, 0.22737371921539307, 0.5937893986701965, -0.04740559309720993, -0.315318763256073, -0.8068737387657166, 0.8183296322822571, -0.6032404899597168, 0.9036444425582886, -0.29028984904289246, -0.02335134707391262,...
func (o *Outbound) IsRunning() bool { return o.once.IsRunning() }
[ -1.0803987979888916, -0.032564785331487656, 0.5725016593933105, 0.6307411193847656, 0.43038251996040344, 0.46657535433769226, -0.4969104528427124, -0.0357535257935524, 0.3526066839694977, -0.11454745382070541, -1.0974148511886597, 0.6792938709259033, -0.8750720620155334, -0.032853811979293...
func (o *Outbound) Introspect() introspection.OutboundStatus { state := "Stopped" if o.IsRunning() { state = "Running" } var chooser introspection.ChooserStatus if i, ok := o.chooser.(introspection.IntrospectableChooser); ok { chooser = i.Introspect() } else { chooser = introspection.ChooserStatus{ Name:...
[ -0.23463040590286255, -0.7079607844352722, 0.8344977498054504, -1.335175633430481, -0.5038713216781616, 0.6574485301971436, -0.3413998782634735, -0.2345821112394333, 0.2555277943611145, 0.41348782181739807, 0.19385400414466858, 0.29178667068481445, -0.3484387695789337, 0.09836381673812866,...
func _posAngleRads(rads float64) float64 { var tmp float64 if rads < 0.0 { tmp = rads + M_2PI } else { tmp = rads } if rads >= M_2PI { tmp -= M_2PI } return tmp }
[ -0.491416871547699, -0.6045742630958557, 0.2778969705104828, -1.8686355352401733, -0.9535173177719116, -0.15973776578903198, -0.5659003853797913, -0.05416259542107582, -0.041148871183395386, -0.23819401860237122, 0.7592758536338806, -0.003830928122624755, 0.026887748390436172, 0.6752266883...
func geoAlmostEqualThreshold(p1 *GeoCoord, p2 *GeoCoord, threshold float64) bool { return math.Abs(p1.lat-p2.lat) < threshold && math.Abs(p1.lon-p2.lon) < threshold }
[ 0.6310091018676758, -1.4132367372512817, 0.45085421204566956, 0.24832473695278168, -0.7993187308311462, 0.9111175537109375, -1.7904589176177979, -0.5087425708770752, -0.838306725025177, 0.4590485394001007, -0.42464983463287354, 0.43044885993003845, 0.6843442916870117, -0.7296159267425537, ...
func geoAlmostEqual(p1 *GeoCoord, p2 *GeoCoord) bool { return geoAlmostEqualThreshold(p1, p2, EPSILON_RAD) }
[ 0.4256426990032196, -1.067823052406311, 0.44231534004211426, 0.20903190970420837, -0.3649831712245941, 1.3650882244110107, -1.6204845905303955, -0.5398141145706177, -0.880233883857727, 1.1782299280166626, -0.3603146970272064, 0.13907551765441895, -0.011791454628109932, -0.37698689103126526...
func setGeoDegs(p *GeoCoord, latDegs float64, lonDegs float64) { _setGeoRads(p, degsToRads(latDegs), degsToRads(lonDegs)) }
[ 0.018955422565340996, 0.7750630974769592, 0.14571398496627808, -0.773769736289978, 0.5247579216957092, 0.6486145853996277, -0.9727678894996643, 0.18409082293510437, -0.3510095775127411, 0.5947302579879761, -0.39178189635276794, 0.023516220971941948, 0.012383862398564816, 0.1650514751672744...
func _setGeoRads(p *GeoCoord, latRads float64, lonRads float64) { p.lat = latRads p.lon = lonRads }
[ 0.14752931892871857, -0.32236528396606445, 0.1402626782655716, -1.9320852756500244, 0.11841845512390137, 0.4557666778564453, -1.4674299955368042, -0.1984604150056839, 0.2124069184064865, 0.41361910104751587, 0.5252817273139954, 0.857295036315918, 0.5199270248413086, 0.09553366899490356, ...
func degsToRads(degrees float64) float64 { return degrees * M_PI_180 }
[ -0.70924973487854, 0.6173693537712097, 0.08834774792194366, -2.5698204040527344, -0.39895308017730713, -0.4715867340564728, -1.047721028327942, -0.8571226596832275, 0.12872478365898132, -0.24776798486709595, 0.6332313418388367, 0.41973355412483215, 0.0203215591609478, 0.3704426884651184, ...
func radsToDegs(radians float64) float64 { return radians * M_180_PI }
[ -0.7511317729949951, 0.3310478925704956, 0.11327948421239853, -1.6417423486709595, -0.34627923369407654, 0.11464498192071915, -0.9212053418159485, -0.3201053738594055, 0.4814484715461731, 0.5148029923439026, -0.21617580950260162, -0.3530391454696655, 0.18928033113479614, 1.0328081846237183...
func constrainLat(lat float64) float64 { for lat > M_PI_2 { lat = lat - M_PI } return lat }
[ 0.2374669909477234, -0.7814498543739319, 0.42806053161621094, -0.43725845217704773, -1.421849250793457, 0.9180448651313782, -0.3373888432979584, -0.2390630692243576, -0.8788000345230103, -0.6574738621711731, 0.705512285232544, -0.6661068797111511, -0.09146270900964737, 0.060436591506004333...
func constrainLng(lng float64) float64 { for lng > M_PI { lng = lng - (2 * M_PI) } for lng < -M_PI { lng = lng + (2 * M_PI) } return lng }
[ 0.09083419293165207, -0.3725033402442932, 0.4191451072692871, -0.6906262040138245, -1.3664954900741577, 0.863075315952301, -0.9081029891967773, 0.18073096871376038, -0.16429975628852844, -0.2490229457616806, 0.09649703651666641, -0.31223437190055847, -0.25287750363349915, 0.739712297916412...
func _geoDistRads(p1 *GeoCoord, p2 *GeoCoord) float64 { // use spherical triangle with p1 at A, p2 at B, and north pole at C bigC := math.Abs(p2.lon - p1.lon) if bigC > M_PI { // assume we want the complement // note that in this case they can't both be negative lon1 := p1.lon if lon1 < 0.0 { lon1 += 2.0 * ...
[ 1.0263320207595825, -0.3745092749595642, 0.7488030195236206, -1.0866676568984985, 0.10395543277263641, 0.8094771504402161, -0.6832235455513, 0.04139621555805206, -0.29813438653945923, 0.13177186250686646, 0.6459866762161255, 0.34001636505126953, 0.35878682136535645, -0.1895400732755661, ...
func _geoDistKm(p1 *GeoCoord, p2 *GeoCoord) float64 { return EARTH_RADIUS_KM * _geoDistRads(p1, p2) }
[ 0.7189142107963562, -0.04847042262554169, 0.2751832604408264, 0.05621848627924919, -0.699109673500061, 0.8326025605201721, -0.4089737832546234, 0.49275466799736023, -1.2451142072677612, 1.01512610912323, 0.5458709597587585, 0.051056936383247375, 0.8110499382019043, -0.4242686629295349, 0...
func _geoAzimuthRads(p1 *GeoCoord, p2 *GeoCoord) float64 { return math.Atan2(math.Cos(p2.lat)*math.Sin(p2.lon-p1.lon), math.Cos(p1.lat)*math.Sin(p2.lat)- math.Sin(p1.lat)*math.Cos(p2.lat)*math.Cos(p2.lon-p1.lon)) }
[ 0.322325199842453, -0.7827485799789429, 0.2901258170604706, -0.9429934620857239, -0.1912391185760498, 0.5392298698425293, -1.5248504877090454, -0.07577984780073166, -0.3229796886444092, 0.680482029914856, 0.761810302734375, 0.20518413186073303, 0.08615517616271973, -0.22339795529842377, ...
func _geoAzDistanceRads(p1 *GeoCoord, az float64, distance float64, p2 *GeoCoord) { if distance < EPSILON { *p2 = *p1 return } az = _posAngleRads(az) // check for due north/south azimuth if az < EPSILON || math.Abs(az-M_PI) < EPSILON { if az < EPSILON { // due north p2.lat = p1.lat + distance } else {...
[ 0.15948262810707092, -0.8495360612869263, 0.7377451062202454, -0.889937162399292, 0.1381572186946869, 1.062324047088623, -0.8522129058837891, 0.4267325699329376, 0.45927193760871887, 0.3556666374206543, 0.502993106842041, 0.2034832388162613, 0.38956254720687866, 0.3671293556690216, 0.902...
func NewTable(ctx *pulumi.Context, name string, args *TableArgs, opts ...pulumi.ResourceOption) (*Table, error) { if args == nil || args.InstanceName == nil { return nil, errors.New("missing required argument 'InstanceName'") } if args == nil { args = &TableArgs{} } var resource Table err := ctx.RegisterReso...
[ 0.24207431077957153, 1.2941590547561646, 0.6016213893890381, -0.09599296003580093, 0.6118617057800293, 0.8030558228492737, 0.09416967630386353, 0.03879047930240631, -0.7981997728347778, 0.058269649744033813, -0.029114043340086937, 0.23364397883415222, -0.25510725378990173, -0.4859068691730...
func GetTable(ctx *pulumi.Context, name string, id pulumi.IDInput, state *TableState, opts ...pulumi.ResourceOption) (*Table, error) { var resource Table err := ctx.ReadResource("gcp:bigtable/table:Table", name, id, state, &resource, opts...) if err != nil { return nil, err } return &resource, nil }
[ 0.36291322112083435, 0.6115970611572266, 0.22603002190589905, 0.4290503263473511, 0.6089481711387634, 0.0876663476228714, -0.2939477562904358, -0.4287375211715698, 0.3782789707183838, -0.5382480025291443, 0.5176182985305786, 0.5292478203773499, 0.33369916677474976, -1.0745532512664795, -...
func NewClient(login, updatePassword, captchaImage goa.Endpoint) *Client { return &Client{ LoginEndpoint: login, UpdatePasswordEndpoint: updatePassword, CaptchaImageEndpoint: captchaImage, } }
[ -0.49215954542160034, -1.3518128395080566, 0.19765909016132355, 0.7172485589981079, -0.33429986238479614, 0.46846094727516174, 0.1478145718574524, 0.15012013912200928, 0.40177422761917114, -0.35928481817245483, 0.055047519505023956, 0.05828595161437988, 0.21995417773723602, -0.928933918476...
func (c *Client) Login(ctx context.Context, p *LoginPayload) (res *Session, err error) { var ires interface{} ires, err = c.LoginEndpoint(ctx, p) if err != nil { return } return ires.(*Session), nil }
[ -0.7000018358230591, -0.15184545516967773, 0.4476756453514099, 0.5011992454528809, -0.2746215760707855, -0.06178728863596916, 0.008675328455865383, -0.8827220797538757, 0.8811140656471252, -0.3955215811729431, -0.08013199269771576, 0.4678441882133484, -0.8140044212341309, -1.13209581375122...
func (c *Client) UpdatePassword(ctx context.Context, p *UpdatePasswordPayload) (res *SuccessResult, err error) { var ires interface{} ires, err = c.UpdatePasswordEndpoint(ctx, p) if err != nil { return } return ires.(*SuccessResult), nil }
[ -1.4801832437515259, -0.3661855459213257, 0.6643979549407959, 0.6463863253593445, 0.3662673830986023, 0.18155844509601593, 0.40770575404167175, 0.03251492977142334, 0.7382714152336121, 0.6220649480819702, -0.2838056683540344, 0.6463136076927185, -1.1602613925933838, -0.4565931260585785, ...
func (c *Client) CaptchaImage(ctx context.Context) (res *Captcha, err error) { var ires interface{} ires, err = c.CaptchaImageEndpoint(ctx, nil) if err != nil { return } return ires.(*Captcha), nil }
[ -0.9711676239967346, -0.3069309890270233, 0.5802448391914368, 0.4637007713317871, -0.2959337532520294, 0.10221853107213974, -0.06200990453362465, -0.17575959861278534, -0.14372624456882477, 0.6044027209281921, -0.024592678993940353, 0.09378445148468018, -0.2476801723241806, 0.0972775518894...
func TestSyncer(t *testing.T) { // we have process with the same ID id := "sameid" address := fmt.Sprint("localhost:9999") cfg := client.Config{ EndPoint: address, LockTimeout: time.Duration(10) * time.Second, } cli, err := client.NewClient(cfg) if err != nil { fmt.Println(err) return } processCoun...
[ 0.22067813575267792, 0.8173012137413025, 0.6606102585792542, -0.2047974169254303, 0.6001619696617126, -0.07164066284894943, 0.3768610954284668, -0.33041390776634216, -0.11712931096553802, -0.3650197982788086, -0.3687221109867096, 0.43190890550613403, -0.6690767407417297, -0.175959363579750...
func (d *Data) GetStep(id uint32) (uint32, error) { if 0 < d.CommonStep { return uint32(d.CommonStep), nil } return d.Points.GetStep(id) }
[ 0.2614365816116333, 1.14934241771698, 0.29739540815353394, 0.5950537919998169, 0.46477416157722473, -0.18319840729236603, 0.16063621640205383, -0.5841154456138611, 0.02881423756480217, -0.8025391101837158, -0.02781843952834606, -0.24574901163578033, -0.1404120773077011, 0.4664384126663208,...
func (d *Data) GetAggregation(id uint32) (string, error) { function, err := d.Points.GetAggregation(id) if err != nil { return function, err } if function == "any" || function == "anyLast" { return "last", nil } return function, nil }
[ -0.43067213892936707, 0.7948668599128723, 0.45667141675949097, -0.29765114188194275, 0.09589534252882004, -1.139714002609253, 0.22422927618026733, -0.8117691874504089, 0.14050735533237457, 0.4700028896331787, 0.5964966416358948, 0.2714862823486328, 0.5029953122138977, 0.48407265543937683, ...
func prepareData(ctx context.Context, targets int, fetcher func() *point.Points) *data { data := &data{ Data: &Data{Points: point.NewPoints()}, b: make(chan io.ReadCloser, 1), e: make(chan error, targets), mut: sync.RWMutex{}, wg: sync.WaitGroup{}, } data.wg.Add(1) extraPoints := make(chan *poin...
[ -0.3125109076499939, 0.6816236972808838, 0.49589499831199646, -0.07411442697048187, -0.5335114598274231, 0.6350590586662292, -0.45467421412467957, -0.36450621485710144, 0.4206494688987732, -0.2067350298166275, 0.18042005598545074, 0.3666348159313202, 0.7498416304588318, 0.5159871578216553,...
func (d *data) setSteps(cond *conditions) { if cond.aggregated { d.CommonStep = cond.step return } d.Points.SetSteps(cond.steps) }
[ 0.502148449420929, 0.6889033913612366, 0.14528203010559082, 0.329397052526474, 0.3839377164840698, 1.0009024143218994, 0.5011849999427795, 0.4333899915218353, -0.3384864032268524, -0.5947791337966919, 0.4728527367115021, -0.17317023873329163, 0.6562042236328125, 1.5611987113952637, -0.63...
func dataSplitAggregated(data []byte, atEOF bool) (advance int, token []byte, err error) { if len(data) == 0 && atEOF { // stop return 0, nil, nil } nameLen, readBytes, err := ReadUvarint(data) tokenLen := int(readBytes) + int(nameLen) if err != nil || len(data) < tokenLen { return splitErrorHandler(&data, ...
[ -0.4725991189479828, 0.2680785059928894, 0.825889527797699, -1.0749934911727905, -0.3746700584888458, -0.28237178921699524, -0.0839303731918335, 0.4620281159877777, 0.16756916046142578, 0.10164620727300644, 0.15486279129981995, -0.12192363291978836, -0.011536584235727787, 1.180690050125122...
func dataSplitUnaggregated(data []byte, atEOF bool) (advance int, token []byte, err error) { if len(data) == 0 && atEOF { // stop return 0, nil, nil } nameLen, readBytes, err := ReadUvarint(data) tokenLen := int(readBytes) + int(nameLen) if err != nil || len(data) < tokenLen { return splitErrorHandler(&data...
[ -0.527269184589386, 0.31624117493629456, 0.8615027666091919, -0.6501232981681824, -0.0014534746296703815, -0.2598351836204529, -0.02412767894566059, 0.5967201590538025, 0.30546367168426514, 0.022417951375246048, 0.2957614064216614, -0.03365832939743996, -0.0027388310991227627, 1.0462460517...
func (d *data) parseResponse(ctx context.Context, bodyReader io.ReadCloser, cond *conditions) error { pp := d.Points dataSplit := dataSplitUnaggregated if cond.aggregated { dataSplit = dataSplitAggregated } // Prevent starting parser if context is done if err := contextIsValid(ctx); err != nil { return ctx.E...
[ -0.0012391951167955995, -0.045671168714761734, 0.929534375667572, 0.4236084520816803, -0.1993897259235382, -0.45060840249061584, 0.46059808135032654, -0.0939924418926239, 0.42275479435920715, 0.11003028601408005, 0.3787069320678711, -0.6702511310577393, -0.3057466745376587, 0.2168088406324...
func Port(port string) Option { if !strings.Contains(port, ":") { port = ":" + port } return func(args *Options) { args.Port = port } }
[ 0.1362488567829132, 0.14001213014125824, 0.3650483787059784, -0.27392739057540894, 0.6193946599960327, 0.6232681274414062, 0.5573176741600037, -0.20875954627990723, 0.41708311438560486, -0.05871451646089554, 0.5105350613594055, 0.09150233864784241, -0.4026646018028259, -0.5786921977996826,...
func HTTP(port string) Option { if !strings.Contains(port, ":") { port = ":" + port } return func(args *Options) { args.HTTP = port } }
[ 0.08488507568836212, 0.22724390029907227, 0.49834269285202026, -0.18478521704673767, 0.4375383257865906, 1.3718926906585693, 0.185567244887352, -0.1855023354291916, -0.3469211459159851, -0.1408747434616089, 0.34031134843826294, 0.6539205312728882, 0.38924872875213623, -0.6765210032463074, ...
func Join(host string) Option { return func(args *Options) { args.SingleNode = false args.Join = host } }
[ 0.4938165545463562, 1.0389411449432373, 0.33874645829200745, 0.6400550007820129, 0.3192344605922699, 1.268706202507019, 0.4606361389160156, 0.9361748695373535, -0.37377527356147766, -0.20788440108299255, 0.10519323498010635, 0.060956574976444244, -1.0527644157409668, 0.37750545144081116, ...
func Name(name string) Option { return func(args *Options) { args.Name = name args.Named = true } }
[ 0.11896836012601852, -0.06954234838485718, 0.6238881945610046, -0.616003155708313, -0.21744105219841003, 0.0817260593175888, 0.40081673860549927, -0.27822697162628174, 0.10962390899658203, 0.8512330651283264, -0.7953856587409973, -0.36383774876594543, 0.20234709978103638, -0.06600321084260...
func DataDir(path string) Option { if s, err := os.Stat(path); err == nil && s.IsDir() { return func(args *Options) { args.DataDir = path } } return func(args *Options) { } }
[ 0.35554054379463196, 0.3855553865432739, 0.752617597579956, -0.5144082903862, -0.31554684042930603, 0.7282374501228333, 0.12197321653366089, -0.14546382427215576, 0.4411468505859375, -0.8970184326171875, 0.3100050985813141, 1.128372311592102, 0.8207821249961853, 1.5483952760696411, -1.08...
func NewActivity(metadata *activity.Metadata) activity.Activity { return &MyActivity{metadata: metadata} }
[ 0.5254675149917603, -1.2250394821166992, 0.07614469528198242, 0.38101768493652344, -0.5346868634223938, -0.05096015706658363, -0.028699614107608795, -0.4048473834991455, -0.09228713810443878, -0.7047272324562073, 0.9237696528434753, 0.4914596676826477, -0.19386348128318787, -0.948610663414...
func confirmOne(confirms <-chan amqp.Confirmation) { log.Debug("waiting for confirmation of one publishing") if confirmed := <-confirms; confirmed.Ack { log.Debug("confirmed delivery with delivery tag: %d", confirmed.DeliveryTag) } else { log.Debug("failed delivery of delivery tag: %d", confirmed.DeliveryTag) ...
[ -0.11776310950517654, -0.43821093440055847, 0.6115430593490601, 0.6090224981307983, 0.759468138217926, 0.39377158880233765, -0.4380474388599396, -0.1410239040851593, -0.7750102877616882, 0.624925434589386, -0.4607885479927063, 0.2955416142940521, 0.039836663752794266, 1.2964255809783936, ...
func MakeConvolutionCoder(r, k int, poly []uint16) *ConvolutionCoder { if len(poly) != r { panic("The number of polys should match the rate") } return &ConvolutionCoder{ r: r, k: k, poly: poly, cc: correctwrap.Correct_convolutional_create(int64(r), int64(k), &poly[0]), } }
[ 0.8331354856491089, -0.3921377956867218, 0.37194016575813293, 0.7398826479911804, -1.2813525199890137, 0.05936674773693085, -0.4542996883392334, -0.3669712245464325, 0.35342538356781006, 0.3406267464160919, 0.06140881031751633, -0.3595607578754425, 0.15584421157836914, -0.05022328719496727...
func (cc *ConvolutionCoder) EncodedSize(dataLength int) int { return int(correctwrap.Correct_convolutional_encode_len(cc.cc, int64(dataLength))) }
[ 0.4029451012611389, 0.014824867248535156, 0.5081331133842468, -0.32758575677871704, -0.899993360042572, -0.3554680049419403, 0.20485492050647736, 0.08320407569408417, 1.1002247333526611, -0.6144935488700867, -0.903559684753418, 0.6324946284294128, -0.1644725650548935, 0.6835680603981018, ...
func (cc *ConvolutionCoder) DecodedSize(numBits int) int { return numBits / (8 * cc.r) }
[ 0.6140241622924805, 0.2508282959461212, 0.3828889727592468, -0.4047245681285858, -0.7213050723075867, -0.05064041540026665, 0.5831161141395569, -0.31440097093582153, 0.9192319512367249, -1.0710623264312744, -0.8550055623054504, -0.1761367917060852, -0.682258665561676, 0.7504642605781555, ...
func (cc *ConvolutionCoder) EncodeSoft(data []byte) (output []byte) { encoded := cc.Encode(data) output = make([]byte, cc.EncodedSize(len(data))) bl := len(encoded) for i := 0; i < bl && i*8 < len(output); i++ { d := encoded[i] for z := 7; z >= 0; z-- { output[i*8+(7-z)] = 0 if d&(1<<uint(z)) == 0 { ...
[ 0.42284995317459106, 0.3530077338218689, 0.5672913193702698, 0.9924312233924866, -1.0121790170669556, -0.4887922704219818, -0.03491437807679176, -0.961402177810669, 1.2054136991500854, -0.16646453738212585, -0.23201964795589447, 0.1594512015581131, -0.2922373414039612, 1.4503679275512695, ...
func (cc *ConvolutionCoder) Encode(data []byte) (output []byte) { frameBits := cc.EncodedSize(len(data)) bl := frameBits/8 + 1 if frameBits%8 == 0 { bl -= 1 } output = make([]byte, bl) correctwrap.Correct_convolutional_encode(cc.cc, &data[0], int64(len(data)), &output[0]) return output }
[ -0.29937511682510376, 0.5160887241363525, 0.5350102782249451, 1.3481818437576294, -0.5179846286773682, -0.6098316311836243, 0.12306644022464752, -0.5065311193466187, 0.9703143835067749, 0.37227320671081543, 0.3010801374912262, 0.31840112805366516, -0.871041476726532, 1.1026637554168701, ...
func (cc *ConvolutionCoder) Decode(data []byte) (output []byte) { frameBits := int64(len(data)) * 8 output = make([]byte, int(frameBits)/(8*cc.r)) correctwrap.Correct_convolutional_decode(cc.cc, &data[0], frameBits, &output[0]) return output }
[ -0.32417476177215576, 0.015552711673080921, 0.5238956212997437, 1.0798171758651733, -0.6531417965888977, -0.7290063500404358, 0.0710839331150055, -0.5575240254402161, 0.82061368227005, 0.27516743540763855, 0.28334957361221313, 0.2259780764579773, -0.9831558465957642, 1.2986823320388794, ...
func (cc *ConvolutionCoder) DecodeSoft(data []byte) (output []byte) { frameBits := int64(len(data)) output = make([]byte, int(frameBits)/(8*cc.r)) correctwrap.Correct_convolutional_decode_soft(cc.cc, &data[0], frameBits, &output[0]) return output }
[ -0.03671959787607193, -0.13341499865055084, 0.549615740776062, 1.362288475036621, -1.342302918434143, -0.8366713523864746, -0.06019209697842598, -0.7401265501976013, 1.0583559274673462, -0.6328349709510803, -0.32175981998443604, 0.1626794934272766, -0.2581845223903656, 1.347960352897644, ...
func (cc *ConvolutionCoder) Close() { correctwrap.Correct_convolutional_destroy(cc.cc) }
[ -0.1458599865436554, -0.6391593813896179, 0.2694961428642273, 0.22151221334934235, -0.5279780030250549, 0.6707633137702942, 0.3042440712451935, 0.1365332156419754, -0.21027423441410065, -0.07734056562185287, 0.4442000985145569, 0.30416449904441833, -0.12877771258354187, 1.6973592042922974,...
func MustNewControlPlane() *ControlPlane { cp := &ControlPlane{} cp.prepareEcho() cp.Encryptor = crypto.MustNewEncryptor() cp.Hasher = crypto.MustNewHasher() cp.Validator = validator.New() repo, enforcer, err := repo.NewRepoEnforcer(cp.Logger) if err != nil { panic(err) } cp.Repo = repo cp.Enforcer = enfor...
[ 0.12851879000663757, -0.6460750102996826, 0.5957372188568115, 0.3234861493110657, -0.034448981285095215, 0.691735029220581, -0.3186386525630951, -0.6279048919677734, -0.4342060685157776, -0.03513422980904579, -0.801845371723175, -0.4623425602912903, -0.39455023407936096, 0.8196035027503967...
func (cp *ControlPlane) Start() { cp.Logger.Infof("ControlPlane started on %s:%d", config.ENV.Host, config.ENV.ControlPlanePort) go cp.Echo.Start( fmt.Sprintf("%s:%d", config.ENV.Host, config.ENV.ControlPlanePort), ) }
[ 0.31235194206237793, -1.173891305923462, 0.5319633483886719, 0.17302951216697693, 0.5004227161407471, 1.040140986442566, 0.19699695706367493, 0.7841149568557739, -1.3361051082611084, 0.20877769589424133, -0.7006963491439819, 1.1562148332595825, -0.3943081796169281, 0.47574764490127563, 0...
func (cp *ControlPlane) Stop() { cp.Repo.Close() cp.Echo.Close() }
[ -0.37858331203460693, -0.8931260704994202, 0.13593171536922455, -0.2580398619174957, 0.5339380502700806, 1.730360746383667, 0.2686726450920105, 0.09640849381685257, -1.1220498085021973, -0.20493778586387634, -0.19494661688804626, -0.3576713502407074, -0.7679632902145386, 0.9403940439224243...
func (or *ObliviousReplica) Kill() { or.dead = true or.l.Close() }
[ -0.46311435103416443, -0.3488033413887024, 0.12278452515602112, 0.3710234761238098, -0.2244391292333603, 1.5588407516479492, 0.03650336340069771, 0.970121443271637, 1.0372711420059204, 0.40500423312187195, -0.28643420338630676, 0.21039000153541565, 0.25962206721305847, -0.21407879889011383...
func StartServer(me string) *ObliviousReplica { or := new(ObliviousReplica) or.me = me rpcs := rpc.NewServer() rpcs.Register(or) or.UID = GetMD5Hash(me) os.Mkdir("data", 0700) or.dataPath = "data/replica-" + or.UID os.Mkdir(or.dataPath, 0700) os.Remove(me) l, e := net.Listen(Network, me); if ...
[ -0.33681178092956543, -0.34499308466911316, 0.9538916945457458, -0.212972030043602, -0.19307208061218262, -0.2057340145111084, -0.20230142772197723, 0.1293758600950241, 0.60292649269104, -0.23310993611812592, -0.09033670276403427, 0.642932653427124, -1.4019932746887207, -0.2960599660873413...
func GetWorkRequestResourceMetadataKeyEnumValues() []WorkRequestResourceMetadataKeyEnum { values := make([]WorkRequestResourceMetadataKeyEnum, 0) for _, v := range mappingWorkRequestResourceMetadataKey { values = append(values, v) } return values }
[ -2.0084197521209717, -1.063675880432129, 0.6123610734939575, 0.744340717792511, 0.44113439321517944, 0.2274126410484314, -0.14493203163146973, -0.7311179637908936, -0.15061406791210175, -0.4268220365047455, 0.08708060532808304, 0.21835899353027344, 0.2147846221923828, 0.5699495077133179, ...
func NewDefaultRouterTable(service string, conf *cheshire.ServerConfig) (*RouterTable, error) { rt := NewRouterTable(service) //create new router entry entry := dynmap.New() jsonPort, ok := conf.GetInt("ports.json") if !ok { return nil, fmt.Errorf("No ports.json in server config") } entry.PutWithDot("ports.jso...
[ -0.25736895203590393, -0.07487386465072632, 0.7700762748718262, -0.012102261185646057, -0.025776514783501625, -0.28033193945884705, 0.8599259257316589, -0.3031189739704132, -0.909270167350769, 0.5079358816146851, -0.7537516951560974, 0.5904695987701416, -0.5591503977775574, 1.0262317657470...
func (this *RouterTable) UpdateRevision() (previous, current int64) { prev := this.Revision this.Revision = time.Now().Unix() //reset the dynmap this.DynMap = dynmap.NewDynMap() return prev, this.Revision }
[ -1.1362723112106323, -0.5004797577857971, 0.6066654920578003, -0.25417470932006836, -0.14431200921535492, -0.8823317289352417, 0.3372785449028015, 1.1805174350738525, -0.15576526522636414, 0.20488639175891876, -0.1938227415084839, 0.3396109640598297, -0.3455703556537628, -0.284398108720779...
func (this *RouterTable) Rebuild() (*RouterTable, error) { total := 0 //set TotalPartitions for _, e := range this.Entries { total += len(e.Partitions) } this.TotalPartitions = total mp := this.toDynMap() table, err := ToRouterTable(mp) if err != nil { return nil, err } return table, nil }
[ -0.6306171417236328, -1.0522871017456055, 0.5680467486381531, -0.2336483597755432, -0.15433059632778168, -0.4467281699180603, 0.549799919128418, 0.3352218270301819, -0.42494699358940125, -0.24328559637069702, 0.5100470781326294, -0.1867763251066208, -0.21041244268417358, -0.663437485694885...
func (this *RouterTable) AddEntries(entry ...*RouterEntry) (*RouterTable, error) { //copy the router table routerTable, err := this.Rebuild() if err != nil { return routerTable, err } entries := make([]*RouterEntry, 0) //build a new entries array with every *except the ones we are adding for _, e := range ro...
[ -0.5347987413406372, -0.030962159857153893, 0.847726583480835, 0.5967824459075928, 0.6694897413253784, -0.11228091269731522, -0.29034560918807983, 0.47672945261001587, -0.2631240785121918, 0.42398184537887573, 0.7693257331848145, -0.5412507653236389, -0.5808243751525879, -0.004969419911503...
func ToRouterTable(mp *dynmap.DynMap) (*RouterTable, error) { t := &RouterTable{} var ok bool t.Service, ok = mp.GetString("service") if !ok { return nil, fmt.Errorf("No Service in the table %s", mp) } t.Revision, ok = mp.GetInt64("revision") if !ok { return nil, fmt.Errorf("No Revision in the table %s", m...
[ -0.349407434463501, -0.3148273825645447, 0.9615485072135925, -0.3134525418281555, 0.11466462910175323, -0.7672651410102844, 0.5203444957733154, 0.3359031677246094, -0.5800939202308655, 0.08214756846427917, 0.4808829128742218, 0.03673240914940834, -0.27397599816322327, -0.14944347739219666,...
func (this *RouterTable) toDynMap() *dynmap.DynMap { mp := dynmap.NewDynMap() mp.Put("service", this.Service) mp.Put("revision", this.Revision) mp.Put("total_partitions", this.TotalPartitions) mp.Put("replication_factor", this.ReplicationFactor) mp.Put("partition_keys", this.PartitionKeys) entries := make([]*dy...
[ -0.7643245458602905, -0.28891637921333313, 0.7295295000076294, -0.6302358508110046, 0.36744579672813416, -0.7064477801322937, 0.4837630093097687, 0.40780290961265564, 0.23271559178829193, -0.7615301609039307, -0.4787037968635559, 0.016408132389187813, 0.41575416922569275, -0.17254191637039...
func (this *RouterTable) repPartitions(partition int, entry *RouterEntry) ([]int, error) { if true { return make([]int, 0), nil } //TODO: There is something wrong with the following logic.. //This method could be much better optimized, but //it is fairly rare, so we wont worry about it.. entries := make([]int,...
[ -1.138574481010437, -0.14310330152511597, 0.8634136319160461, -0.08396539092063904, -0.5258610248565674, -0.8237097263336182, 0.07561355084180832, 0.6696056127548218, 0.39631691575050354, 0.8756280541419983, 0.35216963291168213, 0.24449338018894196, -0.9216899871826172, -0.405443012714386,...
func (this *RouterTable) PartitionEntries(partition int) ([]*RouterEntry, error) { if partition >= this.TotalPartitions { return make([]*RouterEntry, 0), fmt.Errorf("Requested partition %d is out of bounds (%d) ", partition, this.TotalPartitions) } return this.EntriesPartition[partition], nil }
[ -0.5007554292678833, 0.09807257354259491, 0.7443122863769531, 0.12380443513393402, 0.011033332906663418, -0.966714084148407, -0.21845309436321259, -0.006928767077624798, -0.1131153553724289, 0.17190921306610107, 0.833660364151001, -0.03527709096670151, -0.8533749580383301, -0.1124279126524...
func ToRouterEntry(mp *dynmap.DynMap) (*RouterEntry, error) { e := &RouterEntry{ PartitionsMap: make(map[int]bool), } var ok bool e.Address, ok = mp.GetString("address") if !ok { return nil, fmt.Errorf("No Address in Entry: %s", mp) } e.JsonPort = mp.MustInt("ports.json", 0) e.HttpPort = mp.MustInt("ports....
[ -0.3509106934070587, -0.781637966632843, 0.7176961302757263, -1.0102009773254395, 0.1261860877275467, -0.5842150449752808, 0.5173261165618896, 0.1074671819806099, 0.04316730052232742, 0.3489954173564911, 0.06433767825365067, 0.6101194024085999, -0.7697173357009888, -0.24622926115989685, ...
func (this *RouterEntry) Id() string { return fmt.Sprintf("%s:%d", this.Address, this.JsonPort) }
[ -0.006700931582599878, -1.1143852472305298, 0.6627419590950012, -0.9294358491897583, 0.6117048263549805, 1.0181236267089844, -0.5324968695640564, 0.46218976378440857, 0.780796468257904, 0.3167707026004791, 0.11046745628118515, 0.5688658356666565, -0.2795617878437042, -0.6525508165359497, ...
func invertBit7(hexOctet string) (string, error) { i, err := strconv.ParseUint(hexOctet, 16, 8) if err != nil { return "", err } s := "" for k, b := range intToBitArray(uint8(i)) { if k == 6 { s = fmt.Sprintf("%s%d", s, (b+1)%2) } else { s = fmt.Sprintf("%s%d", s, b) } } return parseBinStringToHex...
[ -0.3321560025215149, 0.44605374336242676, 0.7474308609962463, -0.15293926000595093, -0.6989298462867737, 0.6855912208557129, -0.37683364748954773, 0.15175354480743408, -0.3975569009780884, 0.13205330073833466, -0.13008469343185425, -0.09929274767637253, -0.567215621471405, 0.95118850469589...
func ComputeLinkLocalAddress(macAddress string, outInterface string) (string, error) { nMac, err := mac.NormalizeMACAddress(macAddress) if err != nil { return "", err } s, err := invertBit7(nMac[:2]) if err != nil { return "", err } mac := fmt.Sprintf("fe80::%s%s:%sff:fe%s:%s%s", s, nMac[2:4], nMac[4:6], ...
[ 0.034344278275966644, -0.434721976518631, 0.6966971158981323, -0.5704201459884644, -0.6336976885795593, -0.47510796785354614, 1.0174827575683594, 0.5549761652946472, 0.82815021276474, 0.2812114655971527, 0.6382417678833008, 1.3450002670288086, -0.1836397498846054, 0.48892053961753845, 0....
func (terraformer *Terraformer) Validate() error { success, programOutput, err := terraformer.Run("validate") log.Info(programOutput) if err != nil { return err } if !success { return errors.New("Failed to execute 'terraform validate'") } return nil }
[ 0.2112598866224289, 0.2227291464805603, 0.5395745635032654, 0.43176406621932983, 1.046402096748352, 0.24649493396282196, 0.36398032307624817, -0.5089040994644165, -1.1052305698394775, 0.02639327198266983, 0.7244425415992737, -0.050984952598810196, -0.3398141860961914, 0.6824523210525513, ...
func (o OptString) OrElse(s string) string { if o.value == nil { return s } return *o.value }
[ 0.5316411256790161, 0.3652406632900238, 0.3850998282432556, -0.505338728427887, 0.4218577742576599, -1.0501724481582642, -0.38061976432800293, -1.009067177772522, 0.386432409286499, 0.4857366979122162, 0.5901164412498474, -0.370474249124527, -0.22480320930480957, -0.9995376467704773, -0....
func (o OptString) IsPresent() bool { return o.value != nil }
[ 0.2547183632850647, -0.43382528424263, 0.5452463030815125, -0.33677077293395996, 0.516895055770874, 0.18831603229045868, -0.3074738383293152, 0.28865301609039307, 0.5142812132835388, 1.1514216661453247, 0.10782996565103531, -0.22429822385311127, -0.7926223874092102, -0.5032414793968201, ...
func (o OptString) IsNotEmpty() bool { return o.value != nil && len(*o.value) > 0 }
[ -0.24817150831222534, -0.11090848594903946, 0.4366866648197174, 0.10780443996191025, 0.4945128262042999, -0.7474092245101929, -0.9258251190185547, -0.3695708215236664, -0.1581994742155075, 1.5441702604293823, -1.3433196544647217, -0.27708008885383606, -0.21213221549987793, -0.6954119205474...
func (o OptString) Filter(f func(string) bool) OptString { if f != nil && o.value != nil && !f(*o.value) { return OptString{value: nil} } return o }
[ 0.3214600086212158, 0.12580527365207672, 0.38614124059677124, -0.11621008068323135, -0.9831777811050415, -0.2685664892196655, -0.1236312985420227, 0.027915608137845993, 0.07236937433481216, 0.8272839784622192, 0.5329632759094238, 0.4848746061325073, 0.4864940941333771, -0.5709497332572937,...
func (o OptString) IfPresent(f func(string)) { if f != nil && o.value != nil { f(*o.value) } }
[ 0.5993843078613281, -0.41653069853782654, 0.5812717080116272, -0.6530159711837769, 0.24903906881809235, -0.1163172572851181, -0.21696214377880096, 0.21649996936321259, -0.13514481484889984, 1.1769511699676514, 0.30688294768333435, -0.08386184275150299, 0.4703422784805298, -0.39414039254188...
func (o OptString) IfNotEmpty(f func(string)) { if f != nil && o.IsNotEmpty() { f(*o.value) } }
[ 0.34865349531173706, 0.1880231350660324, 0.7077587842941284, 0.1773042380809784, 0.4439378082752228, -0.5756284594535828, -0.5403687953948975, -0.556479275226593, -0.5176799893379211, 1.3272666931152344, -0.9960848689079285, 0.09688086062669754, 0.8291974663734436, -0.9288156032562256, -...
func (o OptString) Map(f func(string) string) OptString { if f != nil && o.value != nil { v := f(*o.value) return OptString{value: &v} } return o }
[ -0.10007971525192261, 0.2482956051826477, 0.5618022680282593, -0.06882404536008835, -1.0576895475387573, 0.19149474799633026, -0.7312068343162537, 0.06009310111403465, 0.7963863015174866, 1.1873726844787598, 0.6879837512969971, 0.28419238328933716, 1.4639461040496826, -0.9875181317329407, ...
func (o *OptString) Scan(src interface{}) error { if src == nil { *o = OptString{value: nil} return nil } switch src.(type) { case []byte: str := string(src.([]byte)) *o = OptString{value: &str} return nil case string: str := src.(string) *o = OptString{value: &str} return nil case OptString: *...
[ -0.3569629192352295, -0.20568619668483734, 0.6822319030761719, -0.014304744079709053, -0.8869549632072449, -0.6106364727020264, -0.3989346921443939, -0.60357666015625, 0.68938148021698, -0.22249427437782288, 0.013380385003983974, 1.2265090942382812, -0.013061972334980965, -0.14223746955394...
func spawnInALoop() { for i := 0; i < 10; i++ { // Our goroutine is a closure, and closures can // access variables in the outer scope, so we can // grab i here to give each goroutine an ID, right? // (Hint: wrong.) go func() { fmt.Println("Goroutine", i) }() // <- Don't forget to call () the closure }...
[ 0.34403905272483826, 0.45297062397003174, 0.8894402384757996, 0.1266147941350937, 0.9497025609016418, -0.11485079675912857, 0.3193207383155823, 0.3104371130466461, 0.1214410811662674, 0.24379178881645203, -0.7051575779914856, 0.1338626891374588, -0.7444149851799011, -0.16463276743888855, ...
func (server *NATSKafkaBridge) connectToNATS() error { server.natsLock.Lock() defer server.natsLock.Unlock() if !server.running { return nil // already stopped } server.logger.Noticef("connecting to NATS core") config := server.config.NATS options := []nats.Option{ nats.MaxReconnects(config.MaxReconnects)...
[ -0.8559904098510742, -0.17406538128852844, 0.6397680044174194, -0.48287391662597656, -0.40328359603881836, 0.08362820744514465, -0.34001490473747253, -1.331947922706604, -0.711887776851654, 0.674480676651001, -0.32124757766723633, 0.12864217162132263, -0.03169296681880951, 1.13204634189605...
func (server *NATSKafkaBridge) connectToSTAN() error { server.natsLock.Lock() defer server.natsLock.Unlock() if server.stan != nil { return nil // already connected } if server.config.STAN.ClusterID == "" { server.logger.Noticef("skipping NATS streaming connection, not configured") return nil } server.l...
[ -0.8315645456314087, -0.2190157175064087, 0.636725127696991, 0.23840349912643433, -0.02556203305721283, -0.3998185694217682, 0.4093139171600342, -0.9070483446121216, -1.0529050827026367, 0.6754099726676941, -0.21680256724357605, 0.6415372490882874, 0.06008806824684143, 0.9824717044830322, ...
func (r *Requirement) Apply(available float64, factor float64) *Usage { amount := r.used(available) effect := amount / (r.norm * factor) return &Usage{effect, amount} }
[ -0.36654552817344666, -0.7465746998786926, 0.5407880544662476, -0.13566091656684875, -1.087911605834961, 0.21199390292167664, -0.02321971207857132, 0.5415237545967102, 0.6236397624015808, 0.6301630735397339, 0.8561792373657227, 0.01010188553482294, -0.5904673337936401, 0.3131301701068878, ...
func (s *StandardProcess) skillFactor() float64 { /* * Factor is the product of the relevant skills and their impact */ requiredScale := 1.0 for skill, requirement := range s.requiredSkills { requiredScale = requiredScale * requirement.Apply(s.actor.skills[skill], 1.0).Effect } /* * Factor is the sum of th...
[ -0.3559175431728363, -0.6736056804656982, 0.5368455648422241, -1.1871461868286133, -0.5978690981864929, -0.06255333125591278, 0.99176025390625, -0.13861504197120667, 0.12413904815912247, -0.06043606251478195, -0.23980408906936646, 0.7745556831359863, 0.09138872474431992, 0.6733843088150024...
func (s *StandardProcess) consume(mirror *ResourceMirror, costFactor float64) float64 { /* * Factor is the product of the availability of the required resources */ requiredFactor := 1.0 for resource, requirement := range s.requiredResources { usage := requirement.Apply(mirror.Left(resource), costFactor) requ...
[ 0.011552570387721062, -0.43021878600120544, 0.4978892207145691, -0.8346039652824402, -0.5251826643943787, -0.16088536381721497, 0.5050766468048096, 0.34741008281707764, -0.19594380259513855, 0.6641324758529663, 0.11752822250127792, 0.7872974872589111, 0.17665895819664001, 0.501459717750549...
func (s *StandardProcess) appendOutput(productionFactor float64, mirror *ResourceMirror) { for resource, units := range s.standardOutput { mirror.Produce(resource, productionFactor * units) } }
[ -0.024844111874699593, 0.10376232862472534, 0.21447573602199554, 0.19919614493846893, -0.4892767071723938, -0.2670191526412964, 0.6943297386169434, 0.07894932478666306, -0.46353569626808167, -0.3662376403808594, 0.17703448235988617, 0.30290859937667847, 0.12520910799503326, 0.6691560745239...