text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (s ListRepositoriesInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.MaxResults != nil {
v := *s.MaxResults
metadata := protocol.Metadata{}
e.SetValue(protocol.QueryTarget, "max-resul... | [
-0.4482329189777374,
0.47579503059387207,
0.15892958641052246,
-1.4465055465698242,
0.3361671268939972,
-0.1649266928434372,
-0.3531210422515869,
0.191609725356102,
0.03817756846547127,
-0.09144823998212814,
-0.2714819312095642,
-0.008414855226874352,
-0.5726850628852844,
0.079684361815452... |
func (s ListRepositoriesOutput) String() string {
return awsutil.Prettify(s)
} | [
0.5690455436706543,
-0.3126027584075928,
0.12700830399990082,
-0.7193167805671692,
-0.5531484484672546,
-0.39332905411720276,
0.3014315962791443,
-0.677310585975647,
0.19265659153461456,
-0.39759525656700134,
0.395007848739624,
0.09849362075328827,
0.5953180193901062,
-0.10573135316371918,... |
func (s ListRepositoriesOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.NextToken != nil {
v := *s.NextToken
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "nextToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Repositories != nil {
v := s.R... | [
-0.1120552346110344,
0.8661061525344849,
0.017930880188941956,
-1.1662509441375732,
0.2697239816188812,
-0.5589659810066223,
-0.20216619968414307,
0.3593244254589081,
0.21313127875328064,
-0.05184111371636391,
-0.10840802639722824,
-0.2918405532836914,
-0.5784585475921631,
0.41704347729682... |
func (r ListRepositoriesRequest) Send(ctx context.Context) (*ListRepositoriesResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &ListRepositoriesResponse{
ListRepositoriesOutput: r.Request.Data.(*ListRepositoriesOutput),
response: &aw... | [
-1.2393674850463867,
0.2765299379825592,
0.19165395200252533,
-0.4781244695186615,
0.30074170231819153,
-0.8438747525215149,
-0.7078565955162048,
-0.5910804271697998,
0.9639704823493958,
-0.08375602960586548,
-0.18263860046863556,
0.08743274956941605,
-0.06046995893120766,
0.26598456501960... |
func (r *ListRepositoriesResponse) SDKResponseMetdata() *aws.Response {
return r.response
} | [
-0.13515342772006989,
-0.042558375746011734,
0.21799840033054352,
-0.9352614283561707,
0.11518140882253647,
-0.36242976784706116,
-0.9962413311004639,
-0.09676903486251831,
1.6482969522476196,
-0.015811273828148842,
-0.38722479343414307,
-0.9509002566337585,
0.3388204276561737,
-0.50197482... |
func getBit(num int, i int) bool {
return (num & (1 << i)) != 0
} | [
0.44900453090667725,
0.35703328251838684,
0.5070441365242004,
1.118528127670288,
0.0917094424366951,
0.9898649454116821,
-0.0701695904135704,
-0.6011149287223816,
-0.629304051399231,
-0.5353525280952454,
0.015717806294560432,
0.29825296998023987,
-0.9513277411460876,
-0.7657774686813354,
... |
func setBit(num int, i int) int {
return num | (1 << i)
} | [
-0.04247099906206131,
0.36409425735473633,
0.17518043518066406,
0.9138219356536865,
-0.6613764762878418,
1.1230067014694214,
0.4122430682182312,
-0.9341906309127808,
-1.0334807634353638,
-0.10361221432685852,
-0.04697594419121742,
0.46803152561187744,
-0.7734233140945435,
-0.37819761037826... |
func clearBit(num int, i int) int {
// create a mask where only the value at i is 0 and everything else is 1
// 100..0 -> 011..1
mask := ^1 << i
// perform an and on our number with the mask
return num & mask
} | [
-0.37837156653404236,
0.0025900278706103563,
0.6079283356666565,
0.7857117652893066,
-0.9635467529296875,
0.8332205414772034,
0.11756692826747894,
-0.9230822920799255,
-0.45970600843429565,
0.48186638951301575,
0.3807394206523895,
0.7769293785095215,
-0.2009110301733017,
-0.514541506767273... |
func clearBitsMSBThroughI(num int, i int) int {
// create a mask where the bits from the MSB through i are 0 and everything past i is 1
mask := (1 << i) - 1
return num & mask
} | [
0.17579545080661774,
0.2571209967136383,
0.5593281984329224,
0.628265380859375,
-1.0543274879455566,
0.7371589541435242,
0.7103091478347778,
-1.252601146697998,
-0.019620371982455254,
0.06960132718086243,
-0.6351484060287476,
0.7642585635185242,
-1.240508794784546,
-0.058028001338243484,
... |
func clearBitsIThroughLSB(num int, i int) int {
// create a mask where the bits from i to the LSB are 0 and everything before i is 1
mask := -1 << (i + 1)
return num & mask
} | [
0.3076619505882263,
0.43942493200302124,
0.5760058760643005,
0.6926447153091431,
-0.879252016544342,
0.9516928791999817,
0.42037779092788696,
-0.9350099563598633,
0.1008768081665039,
0.44627487659454346,
-0.05455446243286133,
1.1991395950317383,
-0.8464049696922302,
-0.35678544640541077,
... |
func updateBit(num int, i int, valIs1 bool) int {
// set our bit value
val := 0
if valIs1 {
val = 1
}
// create a mask to clear the ith bit in our number
clearMask := ^(1 << i)
// create a mask to set the ith bit in our number
valueMask := val << i
return (num & clearMask) | valueMask
} | [
-0.8844324350357056,
0.5389459729194641,
0.581019401550293,
0.929412305355072,
-0.8325158357620239,
0.6504425406455994,
0.04587438330054283,
-0.5410248637199402,
-0.5248775482177734,
0.6700171828269958,
0.39835163950920105,
0.451571524143219,
-0.7527684569358826,
-0.32092130184173584,
0.... |
func configureOperatorProfiler(ctx context.Context) *execute.OperatorProfiler {
profilerNames := []string{"operator"}
execOptsConfig := lang.ExecOptsConfig{}
execOptsConfig.ConfigureProfiler(ctx, profilerNames)
deps := execute.GetExecutionDependencies(ctx)
return deps.ExecutionOptions.OperatorProfiler
} | [
-0.24065428972244263,
-0.06264276057481766,
0.6798491477966309,
0.34608063101768494,
-0.27843931317329407,
0.11902441084384918,
0.28264400362968445,
-0.4234696626663208,
0.221212238073349,
0.6830567121505737,
-0.48676273226737976,
-1.016727089881897,
-0.5557411909103394,
0.8956692814826965... |
func New(upstream string, director Director) *SocketProxy {
return &SocketProxy{
path: upstream,
director: director,
}
} | [
-0.5377070903778076,
0.2759052813053131,
0.2729623019695282,
-1.1657617092132568,
-2.1380245685577393,
-0.522579550743103,
-0.6102877855300903,
0.06859686225652695,
-0.2314429134130478,
0.0025248469319194555,
-0.3295193910598755,
1.5707862377166748,
-0.4846946895122528,
-0.1212955415248870... |
func Gin(port int, setup func(*gin.Engine)) *cobra.Command {
cmd := &cobra.Command{
Use: "start",
Short: "start a gin server",
}
actualPort := cmd.Flags().Int("port", port, fmt.Sprintf("port to bind to, defaults to %d", port))
cmd.RunE = func(cmd *cobra.Command, args []string) error {
srv := gin.Default()... | [
-0.3609934151172638,
0.17966324090957642,
0.7538095116615295,
-0.15188100934028625,
0.6429435610771179,
-0.19503328204154968,
0.7517185807228088,
0.6335194706916809,
-0.6744098663330078,
-0.5558937788009644,
-0.1721097230911255,
0.4358552396297455,
-0.046122148633003235,
-0.220162287354469... |
func NewObserver(cfg ElectionConfig, scope tally.Scope, role string, newLeaderCallback func(string) error) (Observer, error) {
log.WithFields(log.Fields{"role": role}).Debug("Creating new observer of election")
client, err := zookeeper.New(cfg.ZKServers, &store.Config{ConnectionTimeout: zkConnErrRetry})
if err != ni... | [
-0.027472931891679764,
-0.4301786422729492,
0.3874761462211609,
-0.3723052740097046,
-0.6103042960166931,
-0.008468984626233578,
0.46649405360221863,
-0.10431879758834839,
0.1450357437133789,
0.8803513646125793,
-0.0854758471250534,
-0.22864565253257751,
-0.5694072246551514,
0.534261703491... |
func (o *observer) Start() error {
o.Lock()
defer o.Unlock()
if o.running {
return errors.New("Already observing election, cannot Start again")
}
o.running = true
o.metrics.Start.Inc(1)
o.metrics.Running.Update(1)
log.WithFields(log.Fields{"role": o.role}).Info("Watching for leadership changes")
go o.obser... | [
0.3675745725631714,
-0.022265460342168808,
0.4285818338394165,
-0.19597651064395905,
0.17540185153484344,
0.23305967450141907,
0.1619894653558731,
0.230259969830513,
-0.5413547158241272,
0.7198594212532043,
-0.27333059906959534,
0.9438047409057617,
0.18363015353679657,
0.26934564113616943,... |
func (o *observer) Stop() {
o.Lock()
defer o.Unlock()
if o.running {
o.running = false
close(o.stopChan)
o.follower.Stop()
o.metrics.Stop.Inc(1)
o.metrics.Running.Update(0)
}
} | [
-0.5432614684104919,
0.2843448221683502,
0.3860124945640564,
-0.28525489568710327,
0.1456867754459381,
0.33978399634361267,
1.1832932233810425,
-0.31588438153266907,
-1.1156574487686157,
0.1375150829553604,
-0.4908007085323334,
-0.7371297478675842,
-0.7392876148223877,
0.04234491288661957,... |
func (o *observer) CurrentLeader() (string, error) {
o.Lock()
defer o.Unlock()
if o.running {
return o.leader, nil
}
return "", errors.New("observer is not running")
} | [
-0.06540835648775101,
-0.9154020547866821,
0.5372373461723328,
0.28523990511894226,
-0.6170116662979126,
0.2679206132888794,
-0.09454446285963058,
-0.5374384522438049,
0.2217472940683365,
0.36828887462615967,
0.6154116988182068,
0.34836819767951965,
-0.8324624300003052,
0.2277746945619583,... |
func (o *observer) waitForEvent() error {
leaderCh, errCh := o.follower.FollowElection()
for {
select {
case leader, ok := <-leaderCh:
if !ok {
return nil
}
o.Lock() // make sure we lock around modifying the current leader, and invoking callback
log.WithFields(log.Fields{"role": o.role, "leader": ... | [
0.7325301766395569,
-0.3067629933357239,
0.4676007926464081,
-0.2622246742248535,
0.03653454780578613,
-0.2725435793399811,
0.019689323380589485,
-0.7734406590461731,
0.784882128238678,
-0.232603520154953,
0.05847178027033806,
-0.259735107421875,
0.06708075106143951,
0.5545775294303894,
... |
func (o *observer) observe() {
for {
select {
case <-o.stopChan:
return
default:
err := o.waitForEvent()
if err != nil {
log.WithFields(log.Fields{
"role": o.role,
"error": err,
}).Errorf("Failure observing election; retrying")
// if we already stop the observer, return without sl... | [
0.08812259137630463,
-0.5051823258399963,
0.43998953700065613,
-0.41623759269714355,
0.5008421540260315,
-0.5620303153991699,
-0.21053476631641388,
-0.09920430928468704,
-0.47628262639045715,
0.40947073698043823,
-0.1521972417831421,
-0.7400943040847778,
-0.3514643907546997,
0.160880133509... |
func Success(file *os.File) *log.Logger {
LogSucc := log.New(file, "SUCCESS: ", log.Ldate|log.Ltime|log.Lshortfile)
return LogSucc
} | [
0.663114607334137,
-0.3324473798274994,
0.45904988050460815,
-0.007216901984065771,
-1.3711955547332764,
1.045149326324463,
-0.3412659168243408,
0.18414157629013062,
-0.43132835626602173,
-0.1444287747144699,
-0.7190483808517456,
0.43185174465179443,
1.596805214881897,
0.8126427531242371,
... |
func Failure(file *os.File) *log.Logger {
LogFail := log.New(file, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile)
return LogFail
} | [
0.31917867064476013,
-0.3291497826576233,
0.4153730869293213,
-0.39236441254615784,
-0.7304086685180664,
0.38077467679977417,
-0.6426537036895752,
-0.8141636848449707,
-0.5258943438529968,
-0.45046713948249817,
-0.8321584463119507,
0.004968245513737202,
0.8167415261268616,
1.25380277633667... |
func Info(file *os.File) *log.Logger {
LogInfo := log.New(file, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile)
return LogInfo
} | [
0.8275411128997803,
-0.6878899931907654,
0.5289539098739624,
-0.4186089336872101,
-0.4934224486351013,
0.6444283127784729,
-0.6438060402870178,
-0.37930816411972046,
-1.4002867937088013,
-0.17370229959487915,
-0.6094722151756287,
0.04692588001489639,
1.1245514154434204,
0.9685313105583191,... |
func LogInit() *os.File {
file, err := os.OpenFile("../log.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println("Error opening log.txt file", err)
os.Exit(1)
}
return file
} | [
0.3249644339084625,
-0.9063902497291565,
0.8377065062522888,
-0.7534570097923279,
-0.13451170921325684,
1.2405816316604614,
0.07871689647436142,
0.010682566091418266,
-0.723039984703064,
-0.23878686130046844,
-0.015788443386554718,
0.30368572473526,
-0.5721297860145569,
-0.6627240180969238... |
func LogSchInit() *os.File {
file, err := os.OpenFile("../log_schedular.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println("Error opening log.txt file", err)
os.Exit(1)
}
return file
} | [
0.9347782135009766,
-0.8233329653739929,
0.6919377446174622,
-0.53476482629776,
-0.31709176301956177,
1.093766450881958,
0.01716451719403267,
0.4894953966140747,
-0.9933053851127625,
0.0724007785320282,
0.19901931285858154,
0.5048806667327881,
-0.48867759108543396,
-0.860265851020813,
0.... |
func LogManInit() *os.File {
file, err := os.OpenFile("../log_manager.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println("Error opening log.txt file", err)
os.Exit(1)
}
return file
} | [
0.12327197194099426,
-1.4754104614257812,
0.6732127070426941,
-1.0456866025924683,
-0.17925947904586792,
0.8596667647361755,
-0.40615329146385193,
0.14907413721084595,
-0.5426214933395386,
-0.505623459815979,
0.10875553637742996,
0.7195004820823669,
-0.5442628264427185,
0.01406191755086183... |
func LogAgentInit() *os.File {
file, err := os.OpenFile("../log_agent.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println("Error opening log.txt file", err)
os.Exit(1)
}
return file
} | [
0.5760977268218994,
-1.7980295419692993,
0.6803020238876343,
-0.9780416488647461,
0.014134695753455162,
0.8896703124046326,
-0.0785687267780304,
0.31377092003822327,
-0.31592148542404175,
0.2676144242286682,
-0.1907750517129898,
0.35734203457832336,
-0.5709397196769714,
-0.5166875123977661... |
func LogValInit() *os.File {
file, err := os.OpenFile("../log_validator.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println("Error opening log.txt file", err)
os.Exit(1)
}
return file
} | [
0.6729224324226379,
-1.3049705028533936,
0.6799185276031494,
-0.6508889198303223,
-0.33682334423065186,
1.338506817817688,
-0.012264168821275234,
0.3785691559314728,
-0.7769675850868225,
-0.31733089685440063,
0.15296125411987305,
0.7519858479499817,
-0.24599559605121613,
-0.189087614417076... |
func New() *Colorer {
return &Colorer{}
} | [
-0.34553730487823486,
-1.601125955581665,
0.11078308522701263,
-0.35870158672332764,
-0.9676660895347595,
-0.5117180943489075,
-0.18826189637184143,
-0.8328108787536621,
-0.9359886646270752,
-1.1538536548614502,
0.22358933091163635,
0.7129578590393066,
0.2899309992790222,
1.729472637176513... |
func (c *Colorer) Color(text string, colorName string) (colored string, ok bool) {
switch colorName {
case "black":
return c.Black(text), true
case "red":
return c.Red(text), true
case "green":
return c.Green(text), true
case "yellow":
return c.Yellow(text), true
case "blue":
return c.Blue(text), true
... | [
-0.542768120765686,
-0.5920189619064331,
0.8615512847900391,
-0.5408288240432739,
-0.9083164930343628,
0.31614795327186584,
-1.1753901243209839,
0.04588347300887108,
-0.15201324224472046,
0.8898390531539917,
0.16637460887432098,
0.45386871695518494,
-0.9154130816459656,
0.8315818905830383,... |
func (c *Colorer) Black(text string) string {
return color.BlackString(text)
} | [
-0.5406829118728638,
-1.2272498607635498,
0.23170997202396393,
-0.2750672399997711,
-0.5253016352653503,
0.900951087474823,
-0.13024267554283142,
-0.5549594759941101,
0.4434855580329895,
0.08071897178888321,
0.40963998436927795,
1.2773914337158203,
0.06612846255302429,
0.3148992955684662,
... |
func (c *Colorer) Red(text string) string {
return color.RedString(text)
} | [
-0.35975897312164307,
0.12364721298217773,
0.1903713494539261,
-0.060863956809043884,
-0.9417643547058105,
0.9193536639213562,
-0.7387050986289978,
-0.2135695368051529,
0.4034249782562256,
-0.07543930411338806,
-0.1478472650051117,
0.9858744740486145,
-0.8380926251411438,
1.288330316543579... |
func (c *Colorer) Green(text string) string {
return color.GreenString(text)
} | [
0.13390976190567017,
0.04436687007546425,
0.3875095248222351,
-0.05375586822628975,
-0.666637122631073,
1.7446621656417847,
-1.4558120965957642,
0.14979670941829681,
0.21062640845775604,
-0.3209145665168762,
0.05699643865227699,
0.37831348180770874,
-0.0007139110239222646,
-0.2664909958839... |
func (c *Colorer) Yellow(text string) string {
return color.YellowString(text)
} | [
-0.10430734604597092,
-0.5923148393630981,
0.1585928350687027,
-0.7998745441436768,
-0.8613889813423157,
0.5817081928253174,
-0.2901402711868286,
-0.7659640312194824,
0.23356325924396515,
-0.6850555539131165,
-0.7114375233650208,
0.8083776831626892,
0.5022971034049988,
0.23661255836486816,... |
func (c *Colorer) Blue(text string) string {
return color.BlueString(text)
} | [
-0.757664144039154,
-1.5152162313461304,
0.26033538579940796,
0.20369569957256317,
-0.41743481159210205,
0.6602830290794373,
-0.9971706867218018,
-0.16740669310092926,
-0.3997438848018646,
-0.564986526966095,
0.3850571811199188,
1.1710155010223389,
-0.6198857426643372,
0.14304739236831665,... |
func (c *Colorer) Magenta(text string) string {
return color.MagentaString(text)
} | [
-0.33212196826934814,
-1.1695716381072998,
0.14737622439861298,
-0.41315552592277527,
-0.46278563141822815,
0.2260398417711258,
-1.0776312351226807,
-0.5888959169387817,
0.07005637139081955,
-0.10334967821836472,
0.664584755897522,
-0.3413802683353424,
-0.712474524974823,
0.493668228387832... |
func (c *Colorer) Cyan(text string) string {
return color.CyanString(text)
} | [
-0.4956333637237549,
-1.0942859649658203,
0.3070931136608124,
-1.1995817422866821,
-0.7482942938804626,
0.9101018905639648,
0.4970247149467468,
0.3171089291572571,
-0.13854654133319855,
-0.44252902269363403,
-0.412590891122818,
0.26923879981040955,
-0.11356736719608307,
0.48789113759994507... |
func (c *Colorer) White(text string) string {
return color.WhiteString(text)
} | [
-1.0281825065612793,
-0.23229064047336578,
0.2191382348537445,
-0.9997624158859253,
-0.13899993896484375,
0.3136495351791382,
-0.14170052111148834,
-0.7775261998176575,
0.04804033041000366,
-0.5270463824272156,
-0.062031086534261703,
0.572550892829895,
-0.3426751494407654,
1.05266225337982... |
func CellFromCellID(id CellID) Cell {
c := Cell{}
c.id = id
f, i, j, o := c.id.faceIJOrientation()
c.face = int8(f)
c.level = int8(c.id.Level())
c.orientation = int8(o)
c.uv = ijLevelToBoundUV(i, j, int(c.level))
return c
} | [
0.3741499185562134,
-0.9391589760780334,
0.1492352932691574,
0.4983101487159729,
-0.02690376713871956,
-0.19452828168869019,
0.6479310393333435,
-0.940264880657196,
0.26068469882011414,
-0.4145800769329071,
-0.01891615055501461,
-0.4397244155406952,
0.599294900894165,
0.21554751694202423,
... |
func CellFromPoint(p Point) Cell {
return CellFromCellID(cellIDFromPoint(p))
} | [
0.8471612334251404,
-0.6945615410804749,
0.09603478759527206,
1.371086597442627,
-0.0920744240283966,
0.15141361951828003,
-0.7586302161216736,
-0.7285063862800598,
0.31089460849761963,
-0.7031213641166687,
0.9681684970855713,
-0.8567276000976562,
0.3864692747592926,
0.23476862907409668,
... |
func CellFromLatLng(ll LatLng) Cell {
return CellFromCellID(CellIDFromLatLng(ll))
} | [
0.7371257543563843,
-0.8564972877502441,
0.10830456763505936,
0.24433326721191406,
-0.48030269145965576,
0.17784464359283447,
-0.33156803250312805,
-0.253974050283432,
0.44881677627563477,
-0.4097406566143036,
0.790216863155365,
-0.4084920585155487,
1.095818281173706,
0.6529634594917297,
... |
func (c Cell) Face() int {
return int(c.face)
} | [
-0.18997186422348022,
0.43409374356269836,
0.4305199980735779,
1.0913400650024414,
0.3508526086807251,
0.31348052620887756,
1.4792693853378296,
-0.47719359397888184,
-0.4098378121852875,
-0.4070126414299011,
-0.6792668104171753,
-0.102852962911129,
-0.4719790518283844,
0.6811873316764832,
... |
func oppositeFace(face int) int {
return (face + 3) % 6
} | [
-1.1633851528167725,
0.1235329732298851,
0.46824273467063904,
-0.29374414682388306,
-0.3980848491191864,
0.6929657459259033,
0.8561007976531982,
-0.2729901075363159,
0.12654434144496918,
-0.3348923623561859,
-0.9066526293754578,
-0.76739102602005,
-0.7863444685935974,
-0.05544130504131317,... |
func (c Cell) Level() int {
return int(c.level)
} | [
0.07465066760778427,
0.9233016967773438,
0.101960688829422,
0.6761724352836609,
0.10851674526929855,
0.38396796584129333,
0.8891535401344299,
-0.11172711104154587,
-0.8838170766830444,
0.11433184891939163,
-0.9609759449958801,
-0.5074897408485413,
-0.4587535262107849,
0.7527061104774475,
... |
func (c Cell) ID() CellID {
return c.id
} | [
1.132816195487976,
-0.6644995212554932,
0.08302450180053711,
1.3156089782714844,
0.7843817472457886,
1.031310796737671,
0.6243146657943726,
0.25914719700813293,
0.7682614922523499,
-0.8471072912216187,
0.146981880068779,
0.07974287867546082,
-0.13143932819366455,
0.8303273320198059,
0.21... |
func (c Cell) IsLeaf() bool {
return c.level == MaxLevel
} | [
0.5013291835784912,
-0.3202798366546631,
0.1734909564256668,
0.5129623413085938,
-0.15283110737800598,
0.9006430506706238,
-0.6994722485542297,
-0.0703844353556633,
0.8674750924110413,
-0.18024171888828278,
-0.5135498046875,
-0.17403888702392578,
-0.6815540790557861,
0.2870086133480072,
... |
func (c Cell) SizeIJ() int {
return sizeIJ(int(c.level))
} | [
0.0796160027384758,
0.8040814399719238,
0.370618999004364,
0.39949965476989746,
-0.5848979949951172,
-0.23579621315002441,
0.6741558313369751,
-0.24687892198562622,
-0.6964631080627441,
0.1463744342327118,
0.036505088210105896,
-1.525138258934021,
-0.9617878794670105,
0.6844977140426636,
... |
func (c Cell) SizeST() float64 {
return c.id.sizeST(int(c.level))
} | [
1.0022826194763184,
0.7826098799705505,
0.15291933715343475,
-0.5689685344696045,
0.578079342842102,
-0.7451567649841309,
-0.5283209681510925,
-1.179629921913147,
-0.8319389820098877,
0.28675687313079834,
-0.1448919028043747,
-0.6741451621055603,
-0.5875219106674194,
0.08792359381914139,
... |
func (c Cell) Vertex(k int) Point {
return Point{faceUVToXYZ(int(c.face), c.uv.Vertices()[k].X, c.uv.Vertices()[k].Y).Normalize()}
} | [
0.40835943818092346,
0.029295779764652252,
0.12360234558582306,
0.9229594469070435,
-0.3914293050765991,
-0.11923854053020477,
0.3829742670059204,
0.6726802587509155,
0.275974839925766,
0.594841718673706,
-0.452790230512619,
0.18515770137310028,
0.43585866689682007,
-0.7117881774902344,
... |
func (c Cell) Edge(k int) Point {
switch k {
case 0:
return Point{vNorm(int(c.face), c.uv.Y.Lo).Normalize()} // Bottom
case 1:
return Point{uNorm(int(c.face), c.uv.X.Hi).Normalize()} // Right
case 2:
return Point{vNorm(int(c.face), c.uv.Y.Hi).Mul(-1.0).Normalize()} // Top
default:
return Point{uNorm(int(c.... | [
-0.3708682656288147,
0.16279983520507812,
0.640998363494873,
0.9817309379577637,
0.2539314031600952,
0.10971766710281372,
0.16184140741825104,
0.3282651901245117,
-0.0915590301156044,
1.0131003856658936,
0.6501399874687195,
-0.8551495671272278,
-0.4123806655406952,
0.28624898195266724,
0... |
func (c Cell) BoundUV() r2.Rect {
return c.uv
} | [
-0.3308664560317993,
-1.1024795770645142,
0.6453857421875,
1.1343809366226196,
0.30711108446121216,
0.4830107092857361,
0.4458302855491638,
0.5120922327041626,
0.26361557841300964,
-0.8812552690505981,
0.028839407488703728,
0.6890833973884583,
0.4614441692829132,
-0.2495916783809662,
0.2... |
func (c Cell) Center() Point {
return Point{c.id.rawPoint().Normalize()}
} | [
0.6188338398933411,
-0.055270593613386154,
0.012456749565899372,
0.845626711845398,
0.09227040410041809,
0.008283214643597603,
-0.8008555769920349,
0.4018499553203583,
0.9574964046478271,
0.2839709222316742,
0.3126395046710968,
0.27974778413772583,
0.0801016241312027,
-0.44066518545150757,... |
func (c Cell) Children() ([4]Cell, bool) {
var children [4]Cell
if c.id.IsLeaf() {
return children, false
}
// Compute the cell midpoint in uv-space.
uvMid := c.id.centerUV()
// Create four children with the appropriate bounds.
cid := c.id.ChildBegin()
for pos := 0; pos < 4; pos++ {
children[pos] = Cell{... | [
-0.7052315473556519,
0.31198930740356445,
0.8943809270858765,
-0.10734935104846954,
-0.44047772884368896,
-0.1144733726978302,
0.20357032120227814,
-0.2065228521823883,
-0.12108529359102249,
0.156132772564888,
-0.6668887734413147,
-0.9653470516204834,
-0.3675132691860199,
-0.26383775472640... |
func (c Cell) ExactArea() float64 {
v0, v1, v2, v3 := c.Vertex(0), c.Vertex(1), c.Vertex(2), c.Vertex(3)
return PointArea(v0, v1, v2) + PointArea(v0, v2, v3)
} | [
0.4493958652019501,
0.1552242785692215,
0.5049672722816467,
0.7295003533363342,
0.811773419380188,
0.42957785725593567,
0.5057014226913452,
-0.20624959468841553,
0.424915611743927,
1.1864885091781616,
0.24866479635238647,
-0.26717880368232727,
-0.5183557271957397,
0.4563238024711609,
-0.... |
func (c Cell) ApproxArea() float64 {
// All cells at the first two levels have the same area.
if c.level < 2 {
return c.AverageArea()
}
// First, compute the approximate area of the cell when projected
// perpendicular to its normal. The cross product of its diagonals gives
// the normal, and the length of the... | [
-0.1478356420993805,
0.11611591279506683,
0.5059352517127991,
-0.04455975815653801,
-0.5771922469139099,
0.10002930462360382,
1.0198917388916016,
0.016513559967279434,
0.4032031297683716,
0.22430041432380676,
0.87884122133255,
0.16071881353855133,
-0.7537593245506287,
1.0478044748306274,
... |
func (c Cell) AverageArea() float64 {
return AvgAreaMetric.Value(int(c.level))
} | [
-0.3819306194782257,
-0.1289324164390564,
0.13807913661003113,
-0.15107461810112,
-0.29122528433799744,
-0.023781877011060715,
0.6289747953414917,
-0.2652449607849121,
-0.8329682946205139,
0.5886233448982239,
0.9134706258773804,
0.5861966013908386,
-0.5611304044723511,
1.418850302696228,
... |
func (c Cell) IntersectsCell(oc Cell) bool {
return c.id.Intersects(oc.id)
} | [
0.21676672995090485,
0.7312721610069275,
0.44072505831718445,
0.4149554371833801,
0.9878693222999573,
-0.03872428461909294,
0.29768508672714233,
-0.34445396065711975,
-0.16762800514698029,
0.3254741132259369,
0.13655707240104675,
-0.418857216835022,
-0.25132596492767334,
0.0814055800437927... |
func (c Cell) ContainsCell(oc Cell) bool {
return c.id.Contains(oc.id)
} | [
0.6752725839614868,
0.09656184166669846,
0.2579781115055084,
0.47948986291885376,
0.704783022403717,
0.335922509431839,
0.057723429054021835,
-0.6425514817237854,
0.4341098666191101,
-0.14233407378196716,
-0.13540415465831757,
0.28080111742019653,
0.058966267853975296,
0.22011399269104004,... |
func (c Cell) CellUnionBound() []CellID {
return c.CapBound().CellUnionBound()
} | [
0.09137080609798431,
-0.8612520098686218,
0.5825363993644714,
1.3026933670043945,
0.65004563331604,
0.3643280565738678,
-0.678777277469635,
0.25910884141921997,
1.0591869354248047,
-0.1417044997215271,
-1.0360440015792847,
0.6747118234634399,
0.22114983201026917,
0.4509347975254059,
0.32... |
func (c Cell) latitude(i, j int) float64 {
var u, v float64
switch {
case i == 0 && j == 0:
u = c.uv.X.Lo
v = c.uv.Y.Lo
case i == 0 && j == 1:
u = c.uv.X.Lo
v = c.uv.Y.Hi
case i == 1 && j == 0:
u = c.uv.X.Hi
v = c.uv.Y.Lo
case i == 1 && j == 1:
u = c.uv.X.Hi
v = c.uv.Y.Hi
default:
panic("i and/... | [
-0.1735578179359436,
-0.14106915891170502,
0.509424090385437,
-0.09728517383337021,
-0.2593125104904175,
-0.27116188406944275,
-0.0025318865664303303,
-0.510333776473999,
-0.6746214628219604,
1.0341731309890747,
0.25941744446754456,
-0.523505449295044,
-0.6462855339050293,
-0.4398320615291... |
func (c Cell) longitude(i, j int) float64 {
var u, v float64
switch {
case i == 0 && j == 0:
u = c.uv.X.Lo
v = c.uv.Y.Lo
case i == 0 && j == 1:
u = c.uv.X.Lo
v = c.uv.Y.Hi
case i == 1 && j == 0:
u = c.uv.X.Hi
v = c.uv.Y.Lo
case i == 1 && j == 1:
u = c.uv.X.Hi
v = c.uv.Y.Hi
default:
panic("i and... | [
-0.4630608856678009,
-0.4219111204147339,
0.5840079188346863,
0.23016506433486938,
-0.05691274255514145,
-0.40719926357269287,
-0.1808469593524933,
0.06431596726179123,
0.21900318562984467,
0.31412839889526367,
-0.2757854163646698,
-0.6651486158370972,
-0.5824170708656311,
-0.1971794962882... |
func (c Cell) RectBound() Rect {
if c.level > 0 {
// Except for cells at level 0, the latitude and longitude extremes are
// attained at the vertices. Furthermore, the latitude range is
// determined by one pair of diagonally opposite vertices and the
// longitude range is determined by the other pair.
//
... | [
0.24665719270706177,
-0.03885836899280548,
0.7831816077232361,
0.44934338331222534,
-0.42850562930107117,
0.15924710035324097,
0.36202946305274963,
0.026651987805962563,
0.004990746267139912,
-0.1509159356355667,
0.5013019442558289,
0.39862409234046936,
0.15280666947364807,
0.2016535699367... |
func (c Cell) CapBound() Cap {
// We use the cell center in (u,v)-space as the cap axis. This vector is very close
// to GetCenter() and faster to compute. Neither one of these vectors yields the
// bounding cap with minimal surface area, but they are both pretty close.
cap := CapFromPoint(Point{faceUVToXYZ(int(c... | [
0.25225692987442017,
-0.695123553276062,
0.6664240956306458,
1.07517671585083,
-0.3195059895515442,
0.464055597782135,
0.006435983814299107,
-0.48465773463249207,
0.8315702080726624,
0.20945219695568085,
0.175033301115036,
0.07012524455785751,
0.37798410654067993,
0.4657544791698456,
0.4... |
func (c Cell) ContainsPoint(p Point) bool {
// We can't just call XYZtoFaceUV, because for points that lie on the
// boundary between two faces (i.e. u or v is +1/-1) we need to return
// true for both adjacent cells.
//
// We can get away with not checking the face if the point matches the face of
// the cell he... | [
-0.10187113285064697,
-0.04963448643684387,
0.4586576223373413,
0.8582545518875122,
-0.5279552936553955,
0.8412930369377136,
0.03401783108711243,
0.11333277821540833,
0.47622260451316833,
-0.1346900314092636,
0.22399134933948517,
-0.46638208627700806,
-0.6058326959609985,
-0.13864621520042... |
func (c Cell) Encode(w io.Writer) error {
e := &encoder{w: w}
c.encode(e)
return e.err
} | [
0.08898716419935226,
0.45450738072395325,
0.1319282054901123,
0.8127599358558655,
0.008393202908337116,
-0.033373862504959106,
0.49411389231681824,
-0.526763916015625,
-0.4417726397514343,
-0.04016724228858948,
0.46029597520828247,
-0.29022812843322754,
-0.17099633812904358,
0.663004100322... |
func (c *Cell) Decode(r io.Reader) error {
d := &decoder{r: asByteReader(r)}
c.decode(d)
return d.err
} | [
-0.06141498684883118,
-0.09415402263402939,
0.3731353282928467,
0.492849200963974,
-0.23143236339092255,
-0.6747465133666992,
-0.36483317613601685,
-0.5938645601272583,
-0.036890774965286255,
-0.45999306440353394,
0.2764303684234619,
-0.6389461755752563,
-0.4160770773887634,
0.475806891918... |
func (c Cell) vertexChordDist2(p Point, xHi, yHi bool) s1.ChordAngle {
x := c.uv.X.Lo
y := c.uv.Y.Lo
if xHi {
x = c.uv.X.Hi
}
if yHi {
y = c.uv.Y.Hi
}
return ChordAngleBetweenPoints(p, PointFromCoords(x, y, 1))
} | [
1.0364290475845337,
-1.1899528503417969,
0.5316170454025269,
0.5483242869377136,
-0.3649384081363678,
0.37263205647468567,
-0.045733191072940826,
-0.16578836739063263,
0.20078465342521667,
0.46910911798477173,
-0.16210031509399414,
1.3075151443481445,
-0.20002375543117523,
-1.1810848712921... |
func (c Cell) uEdgeIsClosest(p Point, vHi bool) bool {
u0 := c.uv.X.Lo
u1 := c.uv.X.Hi
v := c.uv.Y.Lo
if vHi {
v = c.uv.Y.Hi
}
// These are the normals to the planes that are perpendicular to the edge
// and pass through one of its two endpoints.
dir0 := r3.Vector{v*v + 1, -u0 * v, -u0}
dir1 := r3.Vector{v*v... | [
-0.03729502856731415,
-0.04620366916060448,
0.781333327293396,
0.47439512610435486,
-0.48541468381881714,
0.6055840253829956,
0.04844145476818085,
0.28645601868629456,
-0.03279021382331848,
0.7360074520111084,
0.6385514736175537,
-0.07747962325811386,
-0.5069753527641296,
-0.43277674913406... |
func (c Cell) vEdgeIsClosest(p Point, uHi bool) bool {
v0 := c.uv.Y.Lo
v1 := c.uv.Y.Hi
u := c.uv.X.Lo
if uHi {
u = c.uv.X.Hi
}
dir0 := r3.Vector{-u * v0, u*u + 1, -v0}
dir1 := r3.Vector{-u * v1, u*u + 1, -v1}
return p.Dot(dir0) > 0 && p.Dot(dir1) < 0
} | [
-0.10073797404766083,
0.12201464921236038,
0.7271566987037659,
0.9443650245666504,
0.018194356933236122,
0.4370952248573303,
-0.13528768718242645,
-0.45380401611328125,
0.5597801208496094,
0.7717242240905762,
0.5648223161697388,
0.12086983770132065,
-0.839117169380188,
-0.29233211278915405... |
func edgeDistance(ij, uv float64) s1.ChordAngle {
// Let P by the target point and let R be the closest point on the given
// edge AB. The desired distance PR can be expressed as PR^2 = PQ^2 + QR^2
// where Q is the point P projected onto the plane through the great circle
// through AB. We can compute the distan... | [
-0.13982565701007843,
-0.4179614782333374,
0.6476207971572876,
-0.20893138647079468,
-0.08895613998174667,
0.5765950083732605,
0.6379511952400208,
0.42669448256492615,
0.8933817148208618,
0.6315131783485413,
0.4890243411064148,
0.8276212215423584,
-0.5898863077163696,
-0.7719124555587769,
... |
func (c Cell) distanceInternal(targetXYZ Point, toInterior bool) s1.ChordAngle {
// All calculations are done in the (u,v,w) coordinates of this cell's face.
target := faceXYZtoUVW(int(c.face), targetXYZ)
// Compute dot products with all four upward or rightward-facing edge
// normals. dirIJ is the dot product for... | [
-0.12159556150436401,
-0.5465304851531982,
1.109243631362915,
0.047337550669908524,
-0.6334147453308105,
0.12570643424987793,
0.6357555389404297,
0.05936731398105621,
0.6153765916824341,
0.16644226014614105,
0.42948609590530396,
0.3056807518005371,
-0.42282429337501526,
-0.8850688338279724... |
func (c Cell) Distance(target Point) s1.ChordAngle {
return c.distanceInternal(target, true)
} | [
-0.2595299482345581,
-0.17268848419189453,
0.23707078397274017,
0.9047074913978577,
-0.6614716649055481,
0.7182961106300354,
0.1152876541018486,
0.2751225233078003,
0.9734637141227722,
0.6812731027603149,
0.3303501307964325,
0.042248886078596115,
0.5600593090057373,
-0.6174121499061584,
... |
func (c Cell) MaxDistance(target Point) s1.ChordAngle {
// First check the 4 cell vertices. If all are within the hemisphere
// centered around target, the max distance will be to one of these vertices.
targetUVW := faceXYZtoUVW(int(c.face), target)
maxDist := maxChordAngle(c.vertexChordDist2(targetUVW, false, fal... | [
0.16097399592399597,
-0.22883211076259613,
0.541120171546936,
0.7697886228561401,
-0.23725010454654694,
0.6198223233222961,
0.045628298074007034,
-0.05078515782952309,
0.8220909237861633,
0.15044346451759338,
0.39432814717292786,
-0.08991031348705292,
-0.40189647674560547,
-0.7395676970481... |
func (c Cell) BoundaryDistance(target Point) s1.ChordAngle {
return c.distanceInternal(target, false)
} | [
0.2386184185743332,
-0.39446988701820374,
0.38183173537254333,
0.6109259724617004,
0.14731012284755707,
0.5304968357086182,
-0.15151971578598022,
0.13440316915512085,
0.7487283945083618,
0.4499686062335968,
-0.15110456943511963,
0.7028777003288269,
-0.7407721281051636,
-0.6626831889152527,... |
func (c Cell) DistanceToEdge(a, b Point) s1.ChordAngle {
// Possible optimizations:
// - Currently the (cell vertex, edge endpoint) distances are computed
// twice each, and the length of AB is computed 4 times.
// - To fix this, refactor GetDistance(target) so that it skips calculating
// the distance to ... | [
-0.4480237662792206,
0.10075494647026062,
0.7005759477615356,
0.41310930252075195,
0.22668451070785522,
-0.34184691309928894,
-0.1401868760585785,
0.2665604054927826,
0.21084731817245483,
1.0545450448989868,
0.22946208715438843,
0.11209502816200256,
-0.7443427443504333,
-0.7967281341552734... |
func (c Cell) MaxDistanceToEdge(a, b Point) s1.ChordAngle {
// If the maximum distance from both endpoints to the cell is less than π/2
// then the maximum distance from the edge to the cell is the maximum of the
// two endpoint distances.
maxDist := maxChordAngle(c.MaxDistance(a), c.MaxDistance(b))
if maxDist <= ... | [
0.13485433161258698,
-0.2227325439453125,
0.5853984951972961,
0.34687158465385437,
0.03552517294883728,
0.4125829041004181,
-0.061245787888765335,
0.16513116657733917,
0.2836489975452423,
0.9431869983673096,
0.4088384509086609,
-0.11716718971729279,
0.006909238174557686,
-0.963630199432373... |
func (c Cell) DistanceToCell(target Cell) s1.ChordAngle {
// If the cells intersect, the distance is zero. We use the (u,v) ranges
// rather than CellID intersects so that cells that share a partial edge or
// corner are considered to intersect.
if c.face == target.face && c.uv.Intersects(target.uv) {
return 0
... | [
-0.2509789764881134,
-0.08984370529651642,
0.6954575181007385,
-0.008173917420208454,
0.04127049073576927,
0.21669165790081024,
0.8168213367462158,
-0.147051140666008,
0.6315653324127197,
0.8415154814720154,
-0.18922759592533112,
0.21444305777549744,
-0.45905861258506775,
-0.60906594991683... |
func (c Cell) MaxDistanceToCell(target Cell) s1.ChordAngle {
// Need to check the antipodal target for intersection with the cell. If it
// intersects, the distance is the straight ChordAngle.
// antipodalUV is the transpose of the original UV, interpreted within the opposite face.
antipodalUV := r2.Rect{target.uv.... | [
0.22962816059589386,
0.1142476499080658,
0.6743596196174622,
0.4800509512424469,
-0.16745080053806305,
0.3084452748298645,
0.20262545347213745,
-0.30620092153549194,
0.47814106941223145,
0.28834038972854614,
0.3234414756298065,
-0.05705869570374489,
-0.3097158670425415,
-0.8739091157913208... |
func (m *SharedStorageConfig) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateIops(formats); err != nil {
res = append(res, err)
}
if err := m.validateQuantity(formats); err != nil {
res = append(res, err)
}
if err := m.validateSize(formats); err != nil {
res = append(res, e... | [
0.4017643630504608,
0.20190148055553436,
0.519216775894165,
0.22540372610092163,
0.16857536137104034,
0.10328662395477295,
0.5322008728981018,
-0.05937695503234863,
-0.553165078163147,
0.14059995114803314,
-0.7293626070022583,
-0.46359625458717346,
-0.3548375368118286,
0.874880850315094,
... |
func BigByZip(target *big.Int) uint32 {
if target.Sign() == 0 {
return 0
}
c := uint(3)
e := uint(len(target.Bytes()))
var mantissa uint
if e <= c {
mantissa = uint(target.Bits()[0])
shift := 8 * (c - e)
mantissa <<= shift
} else {
shift := 8 * (e - c)
mantissaNum := target.Rsh(target, shift)
manti... | [
-0.31557855010032654,
0.21671251952648163,
0.7223396301269531,
0.21963593363761902,
-0.03216835483908653,
-0.2328733503818512,
0.3014581799507141,
0.5143163204193115,
1.0458282232284546,
0.22202232480049133,
-0.5369092226028442,
0.4846307337284088,
-0.21941480040550232,
-0.1420819759368896... |
func BitsUnzip(bits uint32) *big.Int {
mantissa := bits & 0xffffff00
mantissa >>= 8
e := uint(bits & 0xff)
c := uint(3)
var bn *big.Int
if e <= c {
shift := 8 * (c - e)
mantissa >>= shift
bn = big.NewInt(int64(mantissa))
} else {
bn = big.NewInt(int64(mantissa))
shift := 8 * (e - c)
bn.Lsh(bn, shift)... | [
-0.23764380812644958,
0.9415359497070312,
0.6467049717903137,
-0.32530927658081055,
-0.5901064872741699,
0.3716883957386017,
0.16399060189723969,
-0.1278521567583084,
0.8310880661010742,
-0.49979856610298157,
-0.7799698710441589,
0.328439861536026,
-0.5326299667358398,
0.1531745195388794,
... |
func visit(url string) {
c := getCollector()
page := GetPage(url)
loge := log.WithFields(log.Fields{
"Site": url,
"State": page.State,
})
loge.Infoln("Entered visit .. ")
// OnRequest is called just before the request is sent, we will create
// our page
c.OnRequest(func(r *colly.Request) {
page.Start ... | [
-0.3621201813220978,
0.44926297664642334,
1.0701149702072144,
-0.3039477467536926,
0.7099878787994385,
-0.46172666549682617,
0.29387935996055603,
-0.3969312310218811,
-0.06461402773857117,
0.05017642676830292,
0.022774657234549522,
0.17488229274749756,
-0.432323694229126,
0.416805803775787... |
func (c *ChannelBucket) Lock() {
c.mutex.Lock()
} | [
0.2412116378545761,
0.1116597130894661,
0.3431480824947357,
-0.6165624856948853,
1.33029043674469,
0.6455146074295044,
0.051070570945739746,
-0.638634979724884,
-0.05020769685506821,
-1.7564821243286133,
-0.5456944704055786,
0.09496047347784042,
-0.6512860655784607,
-0.18904924392700195,
... |
func (c *ChannelBucket) Unlock() {
c.mutex.Unlock()
} | [
-0.0037873010151088238,
-0.23536288738250732,
0.37404534220695496,
-0.5023531913757324,
0.7143479585647583,
-0.04147680476307869,
-0.11435812711715698,
0.196448415517807,
-0.14461354911327362,
-0.9835171699523926,
-0.4295172393321991,
0.3770674765110016,
-0.865169882774353,
-0.474884092807... |
func NewChannelList() *ChannelList {
l := &ChannelList{channels: []*ChannelBucket{}}
// split hashmap to many bucket
log.Debug("create %d ChannelBucket", Conf.ChannelBucketCount)
for i := 0; i < Conf.ChannelBucketCount; i++ {
b := &ChannelBucket{
data: map[string]*Channel{},
mutex: &sync.Mutex{},
}
l.c... | [
0.09352189302444458,
-0.7425369024276733,
0.394862562417984,
-0.3150637745857239,
0.4394689202308655,
-0.07487700879573822,
-0.4376704692840576,
-0.1839352399110794,
-0.02947702631354332,
0.19192950427532196,
-0.6739742159843445,
-0.3450883626937866,
0.43005919456481934,
0.5335756540298462... |
func (l *ChannelList) Count() int {
c := 0
for i := 0; i < Conf.ChannelBucketCount; i++ {
c += len(l.channels[i].data)
}
return c
} | [
0.2700282633304596,
-0.3894866704940796,
0.5719801783561707,
-0.7994634509086609,
0.46105992794036865,
0.15922902524471283,
-0.16103976964950562,
-0.014238598756492138,
-1.0533002614974976,
0.11270628869533539,
-1.2467693090438843,
-0.4653480052947998,
0.019129132851958275,
1.1995972394943... |
func (l *ChannelList) Bucket(key string) *ChannelBucket {
idx := int(hash.HashCrc32String(key) % uint32(Conf.ChannelBucketCount))
return l.channels[idx]
} | [
-0.02559061348438263,
0.05958615615963936,
0.22757352888584137,
-0.05439380928874016,
-0.009635789319872856,
0.2739165723323822,
-0.11268914490938187,
-0.42225879430770874,
-0.10003647208213806,
-0.23663488030433655,
-0.24520552158355713,
0.7745287418365479,
-0.19798249006271362,
0.1691393... |
func (l *ChannelList) validate(key string) error {
if len(nodeWeightMap) == 0 {
log.Debug("no node found")
return ErrChannelKey
}
nodeId := nodeHash.Hash(key)
log.Debug("match node:%s hash node:%s", Conf.ZookeeperNodeId, nodeId)
if Conf.ZookeeperNodeId != nodeId {
log.Warn("User: %s node:%s not match this no... | [
0.13891854882240295,
0.08214062452316284,
0.4824817478656769,
-0.2827938199043274,
0.3202303946018219,
-0.20030489563941956,
-0.05278788134455681,
-0.016292303800582886,
-0.22671635448932648,
0.5604255199432373,
0.48805227875709534,
0.092849962413311,
-0.47450801730155945,
1.03317022323608... |
func (l *ChannelList) Add(key string, c *Channel) error {
// add a new conn
b := l.Bucket(key)
b.Lock()
if _, ok := b.data[key]; ok {
b.Unlock()
log.Info("User: %s refresh conn bucket expire time", key)
return nil
} else {
b.data[key] = c
b.Unlock()
log.Info("User: %s add a new conn", key)
ChStat.Inc... | [
-0.7294104695320129,
-0.32890084385871887,
0.5443853139877319,
0.16996720433235168,
0.5926967263221741,
0.14819644391536713,
-1.3765188455581665,
-0.10626789182424545,
0.21261771023273468,
0.24356813728809357,
-0.566196084022522,
0.08935794234275818,
-0.4618646502494812,
0.5274919867515564... |
func (l *ChannelList) Get(key string) *Channel {
// get a conn bucket
b := l.Bucket(key)
b.Lock()
if c, ok := b.data[key]; ok {
b.Unlock()
ChStat.IncrAccess()
return c
}
b.Unlock()
return nil
} | [
-0.605961263179779,
-0.14350177347660065,
0.5629387497901917,
-0.11552563309669495,
0.46989354491233826,
-0.9486963152885437,
-1.0344969034194946,
-0.4495088756084442,
-0.40821191668510437,
-0.20684252679347992,
-0.28148335218429565,
0.7905964255332947,
-0.5591918230056763,
-0.327698856592... |
func (l *ChannelList) Remove(key string) *Channel {
// get a conn bucket
b := l.Bucket(key)
b.Lock()
if c, ok := b.data[key]; ok {
delete(b.data, key)
b.Unlock()
c.Close()
log.Info("User: %s removed conn", key)
ChStat.IncrRemove()
return c
}
b.Unlock()
return nil
} | [
-0.49973106384277344,
-0.4151495397090912,
0.569553554058075,
-0.3504929840564728,
-0.8017470240592957,
-0.9500314593315125,
-0.5907205939292908,
0.24172665178775787,
0.47086790204048157,
-0.015695609152317047,
-0.6967793703079224,
-0.13375623524188995,
-1.2016141414642334,
-0.181905895471... |
func (l *ChannelList) Close() {
channels := make([]*Channel, 0, l.Count())
for _, c := range l.channels {
c.Lock()
for _, c := range c.data {
channels = append(channels, c)
}
c.Unlock()
}
// close all channels
for _, c := range channels {
if err := c.Close(); err != nil {
log.Error("c.Close() error... | [
-0.2220277190208435,
-0.46721377968788147,
0.530913770198822,
-0.6255699396133423,
0.3162649869918823,
0.2015945017337799,
0.0034443847835063934,
-0.3208256959915161,
-0.4995003938674927,
-0.2900146245956421,
0.20894111692905426,
-0.11293599009513855,
-0.6729267835617065,
1.0755535364151,
... |
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) {
if err := types.ValidateGenesis(genState); err != nil {
panic(err)
}
k.SetParams(ctx, genState.Params)
moduleAcc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName)
k.accountKeeper.SetModuleAccount(ctx, moduleAcc)
for _, record... | [
-0.5803700685501099,
-0.004548882599920034,
0.6712638139724731,
0.1797681599855423,
0.8968115448951721,
0.03465573117136955,
0.7719645500183105,
0.2034597545862198,
-0.6253412961959839,
0.7848803400993347,
-0.5475479364395142,
0.20949915051460266,
0.706904947757721,
1.1713744401931763,
0... |
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
params := k.GetParams(ctx)
var budgetRecords []types.BudgetRecord
k.IterateAllTotalCollectedCoins(ctx, func(record types.BudgetRecord) (stop bool) {
budgetRecords = append(budgetRecords, record)
return false
})
return types.NewGenesisState(... | [
-0.4874376952648163,
0.27392759919166565,
0.6066309213638306,
0.1376318484544754,
0.07161911576986313,
-0.019278623163700104,
0.14691483974456787,
-0.34313836693763733,
-0.30559301376342773,
0.8680753707885742,
-0.3926844894886017,
0.3157024681568146,
-0.26524588465690613,
0.56227660179138... |
func NewPoetDb(store database.Database, log log.Log) *PoetDb {
return &PoetDb{store: store, poetProofRefSubscriptions: make(map[poetProofKey][]chan []byte), log: log}
} | [
-0.1376776397228241,
0.386659175157547,
0.18192332983016968,
0.2101481556892395,
-1.5121302604675293,
-0.21949779987335205,
0.26484283804893494,
0.5407997369766235,
0.3233775198459625,
0.7255843877792358,
-0.7367279529571533,
0.46393224596977234,
-0.8424719572067261,
0.8715769052505493,
... |
func (db *PoetDb) HasProof(proofRef []byte) bool {
_, err := db.GetProofMessage(proofRef)
return err == nil
} | [
0.23990799486637115,
0.8002285957336426,
0.48347967863082886,
-0.1438625007867813,
-0.33060795068740845,
-0.34314459562301636,
0.016731612384319305,
0.3387824296951294,
0.06774050742387772,
0.3768230974674225,
-0.025239188224077225,
-0.693828821182251,
-1.0153913497924805,
1.45415747165679... |
func (db *PoetDb) ValidateAndStore(proofMessage *types.PoetProofMessage) error {
if err := db.Validate(proofMessage.PoetProof, proofMessage.PoetServiceID,
proofMessage.RoundID, proofMessage.Signature); err != nil {
return err
}
err := db.storeProof(proofMessage)
return err
} | [
-0.1869712918996811,
0.11689365655183792,
0.3987122178077698,
0.2037111073732376,
-0.3042418360710144,
0.4404064118862152,
0.5933720469474792,
-0.2655680775642395,
0.6750809550285339,
-0.3300214409828186,
0.3896162807941437,
-0.1926136612892151,
-1.454153060913086,
0.8468007445335388,
0.... |
func (db *PoetDb) ValidateAndStoreMsg(data []byte) error {
var proofMessage types.PoetProofMessage
err := types.BytesToInterface(data, &proofMessage)
if err != nil {
return err
}
return db.ValidateAndStore(&proofMessage)
} | [
-0.23002296686172485,
1.0241971015930176,
0.28358879685401917,
0.24316637217998505,
-0.4688628017902374,
0.11370553076267242,
0.656119167804718,
-0.26340070366859436,
0.4955320954322815,
-0.2259795069694519,
-0.15590450167655945,
-0.3732304275035858,
-1.1568604707717896,
1.4120714664459229... |
func (db *PoetDb) Validate(proof types.PoetProof, poetID []byte, roundID string, signature []byte) error {
const shortIDlth = 5 // check the length to prevent a panic in the errors
if len(poetID) < shortIDlth {
return types.ProcessingError(fmt.Sprintf("invalid poet id %x", poetID))
}
root, err := calcRoot(proof.M... | [
-0.09673159569501877,
-0.011667379178106785,
0.3467806577682495,
0.29820558428764343,
-0.2889229655265808,
-0.178079292178154,
0.46326759457588196,
-0.010473361238837242,
-0.39534762501716614,
0.1515505313873291,
0.3128345012664795,
-0.179787278175354,
-1.0246939659118652,
0.66621369123458... |
func (db *PoetDb) SubscribeToProofRef(poetID []byte, roundID string) chan []byte {
key := makeKey(poetID, roundID)
ch := make(chan []byte, 1)
db.addSubscription(key, ch)
if poetProofRef, err := db.getProofRef(key); err == nil {
db.publishProofRef(key, poetProofRef)
}
return ch
} | [
0.3828069865703583,
-0.1621851623058319,
0.4529420733451843,
-0.7471181154251099,
-0.16706803441047668,
-0.6051247119903564,
0.22841297090053558,
-1.1546416282653809,
-0.03167373687028885,
0.44553595781326294,
0.5184904932975769,
1.6249098777770996,
-1.2378182411193848,
0.638908326625824,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.