text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (c *Cluster) Join(nodeID, addr string) error { log.Printf("received request to join node %s at %s", nodeID, addr) if c.raft.State() != raft.Leader { return ErrNotLeader } f := c.raft.AddVoter(raft.ServerID(nodeID), raft.ServerAddress(addr), 0, 0) if err := f.Error(); err != nil { return err } log.Print...
[ 0.17934264242649078, 0.742023766040802, 0.4595491588115692, -0.18299412727355957, 0.20128779113292694, 0.45717254281044006, -0.6581456661224365, 0.07134135812520981, -0.05218745023012161, 0.35769814252853394, 0.04562391713261604, 1.4466782808303833, -0.9348081946372986, 0.1956406682729721,...
func (c *Cluster) Slots(ids ...int) map[int]*Slot { if len(ids) == 0 { return c.slots } parts := make(map[int]*Slot, len(ids)) for _, id := range ids { parts[id] = c.slots[id] } return parts }
[ -1.0360428094863892, 0.3372393548488617, 0.27019810676574707, -0.2949606776237488, -0.3211706280708313, 0.054846398532390594, 0.2721942067146301, 0.21613112092018127, 0.17193876206874847, -0.4409979283809662, 0.15862412750720978, -0.302871435880661, -0.12854674458503723, -0.253221333026886...
func (c *Cluster) Groups(ids ...int) map[int]Group { c.mu.RLock() defer c.mu.RUnlock() if len(ids) == 0 { return c.groups } parts := make(map[int]Group, len(ids)) for _, id := range ids { parts[id] = c.groups[id] } return parts }
[ -1.7161821126937866, 0.48711350560188293, 0.22847943007946014, -0.14624831080436707, 0.16477461159229279, -0.10172819346189499, -0.00656146602705121, -0.72096186876297, -0.10328108817338943, -0.7970220446586609, 0.07600764185190201, 0.31285396218299866, -0.4662063419818878, -0.182878121733...
func (c *Cluster) getSlotID(key string) int { return int(crc32.ChecksumIEEE([]byte(key)) % SlotNum) }
[ 0.5892528891563416, 0.45680150389671326, 0.20794513821601868, -0.22900791466236115, -0.7229957580566406, -0.0039024935103952885, 0.6302306056022644, 0.13346169888973236, 0.17010974884033203, 0.46190014481544495, 0.4995492100715637, 0.49240589141845703, -1.221484899520874, 0.545472323894500...
func (c *Cluster) MapToSlot(key string) (*Slot, error) { slotID := c.getSlotID(key) slot := c.slots[slotID] g, from, err := slot.GetWorkingGroups() if err != nil { return nil, err } // If the key belongs to a slot which is in migration, always // trigger a key migration first to ensure that the key has been ...
[ -0.7331379055976868, 0.6105473041534424, 0.45267727971076965, -0.7339911460876465, -0.7970107197761536, -0.1436692178249359, 0.01982242986559868, -0.43649065494537354, -0.17371612787246704, 1.0573006868362427, 0.9952002763748169, 0.27389898896217346, -0.21119247376918793, 0.020096678286790...
func (_m *ExpiryStore) GetIPBanExpiration(ip net.IP) (time.Time, error) { ret := _m.Called(ip) var r0 time.Time var r1 error if rf, ok := ret.Get(0).(func(net.IP) (time.Time, error)); ok { return rf(ip) } if rf, ok := ret.Get(0).(func(net.IP) time.Time); ok { r0 = rf(ip) } else { r0 = ret.Get(0).(time.Tim...
[ -1.1165707111358643, 0.7793945074081421, 0.7640239000320435, 1.0220754146575928, -0.10940088331699371, -0.38372671604156494, 0.42278778553009033, 0.33022022247314453, -0.27768033742904663, 0.8589900732040405, -0.24582763016223907, -0.5090102553367615, -0.6320130825042725, 0.396687209606170...
func (_e *ExpiryStore_Expecter) GetIPBanExpiration(ip interface{}) *ExpiryStore_GetIPBanExpiration_Call { return &ExpiryStore_GetIPBanExpiration_Call{Call: _e.mock.On("GetIPBanExpiration", ip)} }
[ -0.17022939026355743, 0.7821495532989502, 0.6598134636878967, 0.9474780559539795, -0.3038579523563385, -0.4477396607398987, -0.2301466464996338, 0.14918969571590424, 0.4943216145038605, 0.7894321084022522, -0.35507088899612427, -0.5002481341362, -0.9519510865211487, 0.11894138902425766, ...
func (_m *ExpiryStore) GetPeerBanExpiration(id peer.ID) (time.Time, error) { ret := _m.Called(id) var r0 time.Time var r1 error if rf, ok := ret.Get(0).(func(peer.ID) (time.Time, error)); ok { return rf(id) } if rf, ok := ret.Get(0).(func(peer.ID) time.Time); ok { r0 = rf(id) } else { r0 = ret.Get(0).(tim...
[ -0.541907787322998, -0.21987363696098328, 0.8672012090682983, 0.49347445368766785, 0.5255938172340393, -0.2445780634880066, -0.10535561293363571, -0.055458661168813705, -0.08496241271495819, 0.12320060282945633, -1.1323833465576172, -0.22378380596637726, -0.7840057611465454, 1.017539024353...
func (_e *ExpiryStore_Expecter) GetPeerBanExpiration(id interface{}) *ExpiryStore_GetPeerBanExpiration_Call { return &ExpiryStore_GetPeerBanExpiration_Call{Call: _e.mock.On("GetPeerBanExpiration", id)} }
[ -0.08831363916397095, 0.013600246980786324, 0.6875428557395935, 0.42233726382255554, 0.0665573999285698, -0.11222697049379349, -0.9411637783050537, -0.009885906241834164, 0.40386250615119934, 0.24840039014816284, -0.7957660555839539, -0.27125197649002075, -0.908775269985199, 0.596972167491...
func (_m *ExpiryStore) SetIPBanExpiration(ip net.IP, expiry time.Time) error { ret := _m.Called(ip, expiry) var r0 error if rf, ok := ret.Get(0).(func(net.IP, time.Time) error); ok { r0 = rf(ip, expiry) } else { r0 = ret.Error(0) } return r0 }
[ -1.0748370885849, 0.1578848510980606, 0.44879141449928284, 0.532319188117981, 0.27251410484313965, -0.5195506811141968, 0.011171860620379448, 0.217818483710289, -0.3036421239376068, 1.0720576047897339, -0.7977170944213867, -1.0689616203308105, -0.4997197091579437, 0.06856968998908997, 0....
func (_e *ExpiryStore_Expecter) SetIPBanExpiration(ip interface{}, expiry interface{}) *ExpiryStore_SetIPBanExpiration_Call { return &ExpiryStore_SetIPBanExpiration_Call{Call: _e.mock.On("SetIPBanExpiration", ip, expiry)} }
[ -0.33845236897468567, 0.4970233738422394, 0.4941672384738922, 0.47144579887390137, -0.20287185907363892, -0.08072641491889954, -0.5720010995864868, 0.2813348174095154, 0.111785888671875, 1.2810558080673218, -0.7105280756950378, -0.4255608916282654, -0.8356963992118835, 0.13272488117218018,...
func (_m *ExpiryStore) SetPeerBanExpiration(id peer.ID, expiry time.Time) error { ret := _m.Called(id, expiry) var r0 error if rf, ok := ret.Get(0).(func(peer.ID, time.Time) error); ok { r0 = rf(id, expiry) } else { r0 = ret.Error(0) } return r0 }
[ -0.8160505294799805, -0.7082716226577759, 0.6758897304534912, -0.06800156086683273, 0.8862804174423218, -0.3586421012878418, -0.13026544451713562, -0.05771499499678612, -0.19794873893260956, 0.49500688910484314, -1.6339499950408936, -0.524364173412323, -0.5246235728263855, 0.60259944200515...
func (_e *ExpiryStore_Expecter) SetPeerBanExpiration(id interface{}, expiry interface{}) *ExpiryStore_SetPeerBanExpiration_Call { return &ExpiryStore_SetPeerBanExpiration_Call{Call: _e.mock.On("SetPeerBanExpiration", id, expiry)} }
[ -0.4454805254936218, -0.15532521903514862, 0.6690075397491455, -0.00632417993620038, 0.16854366660118103, 0.20177309215068817, -0.854838490486145, 0.15650565922260284, 0.22328945994377136, 0.6764208674430847, -1.2627283334732056, -0.13240589201450348, -0.82321697473526, 0.6700367331504822,...
func NewExpiryStore(t mockConstructorTestingTNewExpiryStore) *ExpiryStore { mock := &ExpiryStore{} mock.Mock.Test(t) t.Cleanup(func() { mock.AssertExpectations(t) }) return mock }
[ -0.4123135209083557, -0.7632090449333191, -0.1616981327533722, -0.6735023856163025, -0.7414262890815735, 0.1358131319284439, -0.27357998490333557, 0.3247925043106079, 0.1924557089805603, -0.12497740238904953, -1.2461678981781006, -0.8869100213050842, -0.4464828670024872, 0.515740692615509,...
func Wrapf(err error, msg string, args ...interface{}) error { wrappedError := errors.Wrapf(err, msg, args...) if customErr, ok := err.(Error); ok { return Error{ errorType: customErr.errorType, originalError: wrappedError, message: customErr.message, } } return Error{errorType: NoType, orig...
[ -0.4844399392604828, -0.36016836762428284, 0.008298340253531933, 0.403989315032959, -0.5832443833351135, -0.14556199312210083, 0.266521155834198, 0.2775466740131378, -0.025846071541309357, 0.3014233708381653, 0.5432190299034119, 0.7535144090652466, 0.43982040882110596, 0.3267863988876343, ...
func TestAllAnagrams1(t *testing.T) { a := allAnagrams("god") fmt.Printf("%v\n", a) assert.Equal(t, 6, len(a)) }
[ 0.6283650994300842, 0.32786157727241516, 0.40332943201065063, 0.43661805987358093, -0.31137585639953613, 0.670960545539856, 0.30148810148239136, 0.06201035529375076, 0.667957603931427, -0.3115291893482208, -0.7458299398422241, 0.45798200368881226, 0.07054205983877182, 0.6904290914535522, ...
func New(untypedConfig *any.Any, logger *zap.Logger, scope tally.Scope) (module.Module, error) { config := &configv1.Config{} if err := untypedConfig.UnmarshalTo(config); err != nil { return nil, err } store, ok := service.Registry[experimentstore.Name] if !ok { return nil, errors.New("could not find experime...
[ -0.613311767578125, 0.10593130439519882, 0.20065951347351074, -0.8977387547492981, -0.12291201204061508, -0.40036579966545105, -0.18203295767307281, -0.4705647826194763, 0.5380102396011353, 0.26514530181884766, 0.7057321071624756, 0.6163285374641418, 0.31439468264579773, 1.1791670322418213...
func setUp(t *testing.T, start ...bool) (*Conn, *testState) { ctrl := gomock.NewController(t) st := state.NewMockTracker(ctrl) nc := MockNetConn(t) c := SimpleClient("test", "test", "Testing IRC") c.initialise() ctx := context.Background() c.st = st c.sock = nc c.cfg.Flood = true // Tests can take a while oth...
[ 0.29060816764831543, -0.34778204560279846, 0.7671548128128052, -0.06652870774269104, -0.10423828661441803, 0.04412079602479935, 0.8307836651802063, 0.17296262085437775, -0.3807171583175659, -0.07978805899620056, -0.7425960898399353, -0.5078267455101013, -0.9462708830833435, -0.117832973599...
func TestEOF(t *testing.T) { c, s := setUp(t) // Since we're not using tearDown() here, manually call Finish() defer s.ctrl.Finish() // Set up a handler to detect whether disconnected handlers are called dcon := callCheck(t) c.Handle(DISCONNECTED, dcon) // Simulate EOF from server s.nc.Close() // Verify tha...
[ 0.33259910345077515, 0.7782483100891113, 0.26739126443862915, 0.0572449155151844, 1.1295804977416992, 0.5984561443328857, 0.4674239456653595, 0.021471597254276276, 0.1450221687555313, -0.9469074010848999, -0.5948487520217896, -0.923262357711792, -0.1353638619184494, 0.26155373454093933, ...
func (c *Client) MigrateWorkspace(ctx context.Context, params *MigrateWorkspaceInput, optFns ...func(*Options)) (*MigrateWorkspaceOutput, error) { if params == nil { params = &MigrateWorkspaceInput{} } result, metadata, err := c.invokeOperation(ctx, "MigrateWorkspace", params, optFns, addOperationMigrateWorkspace...
[ -1.6081454753875732, 1.220594882965088, 0.6445393562316895, 0.3593893051147461, 0.5276948809623718, -0.5324655175209045, 0.39907586574554443, -1.6994417905807495, 1.2199721336364746, -0.0874541774392128, -0.5263904333114624, 1.0067529678344727, -1.043092966079712, -0.3401578962802887, -1...
func (o *DeleteCoreV1NamespacedEventReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewDeleteCoreV1NamespacedEventOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err ...
[ 0.12154385447502136, -0.7663879990577698, 0.7387472987174988, 0.5469930768013, -0.5252437591552734, -0.9788169860839844, -0.06295870244503021, -0.17174872756004333, 1.175620198249817, 0.46398091316223145, 0.8741201758384705, -0.05936757102608681, -0.9685133099555969, 0.314684122800827, 0...
func NewDeleteCoreV1NamespacedEventOK() *DeleteCoreV1NamespacedEventOK { return &DeleteCoreV1NamespacedEventOK{} }
[ 0.5345155000686646, -0.5686551332473755, 0.2710534632205963, 0.8839218020439148, -0.9272398352622986, 0.8458648920059204, 0.3202163577079773, 0.27965494990348816, 1.0108320713043213, 0.6141185164451599, 0.37610986828804016, 0.25907471776008606, 0.21266263723373413, 1.202260971069336, 0.3...
func NewDeleteCoreV1NamespacedEventAccepted() *DeleteCoreV1NamespacedEventAccepted { return &DeleteCoreV1NamespacedEventAccepted{} }
[ 0.5786605477333069, -0.2920418083667755, 0.5169589519500732, -0.22022640705108643, -1.6917011737823486, 0.5795474648475647, 0.5477432608604431, -0.08478981256484985, 1.0048927068710327, 0.07222722470760345, 0.27252691984176636, 0.7526400089263916, -0.05185343325138092, 0.8436920642852783, ...
func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized { return &DeleteCoreV1NamespacedEventUnauthorized{} }
[ -0.09727545082569122, -0.31726133823394775, 0.551583468914032, 0.552269458770752, -1.296456217765808, 0.13004712760448456, -0.2269909530878067, 0.7458944916725159, 1.2670345306396484, -0.6097432374954224, 0.48201993107795715, 1.322064757347107, -0.17668616771697998, 0.63142329454422, 0.4...
func (a Apps) Apply(configFile string) error { for _, app := range a { cmd, err := app.Apply(configFile) if err != nil { app.log.WithFields(logrus.Fields{ "app": app.Name, "cmd": cmd, "error": err, }).Fatal("Failed running apply") return err } } return nil }
[ -0.031906645745038986, -0.4385985732078552, 0.5843783617019653, 1.186842679977417, -0.09836719930171967, 0.9227515459060669, 0.4598183333873749, 0.891001284122467, -0.3980211913585663, 0.3649608790874481, 0.06190022826194763, -0.5564066171646118, -0.022113051265478134, 1.448641300201416, ...
func (a Apps) Destroy() error { for _, app := range a { cmd, err := app.Destroy(false) if err != nil { app.log.WithFields(logrus.Fields{ "app": app.Name, "cmd": cmd, "error": err, }).Fatal("Failed running destroy") return err } } return nil }
[ -0.08665104955434799, -0.3218348026275635, 0.5226354598999023, 0.6809320449829102, 0.5667938590049744, 0.659464955329895, 0.5802433490753174, 0.04378177225589752, 0.1087830513715744, 0.7712937593460083, 0.4721469283103943, -0.5668450593948364, -0.25791677832603455, 1.3647292852401733, 0....
func (a Apps) Simulate(configFile string) error { for _, app := range a { cmd, err := app.Simulate(configFile) if err != nil { app.log.WithFields(logrus.Fields{ "app": app.Name, "cmd": cmd, "error": err, }).Fatal("Failed running simulate") return err } } return nil }
[ -0.32018032670021057, 0.6461982727050781, 0.6185153126716614, 0.7865106463432312, 0.4072341024875641, 0.320317804813385, 0.2972378730773926, -0.20911481976509094, -0.4023010730743408, 0.7606798410415649, -0.016502132639288902, -0.39812156558036804, 0.14509892463684082, 0.36666980385780334,...
func testSpecialNamedRoots(t *testing.T, asciiScheme string) { assertar := assert.New(t) // init nodes, _, names := inter.ASCIIschemeToDAG(asciiScheme) p, _, input := FakePoset(nodes) // process events for _, event := range names { input.SetEvent(event) p.PushEventSync(event.Hash()) } // check each for nam...
[ 0.22378018498420715, 0.5378889441490173, 0.7749039530754089, 0.19307415187358856, -0.11680494248867035, -0.13683800399303436, 0.11786496639251709, -0.25523921847343445, 0.5068157911300659, 0.5066723227500916, -0.24028170108795166, 0.7393032312393188, -0.4185026288032532, 0.3803237974643707...
func CalculateCoinbase(height BlockHeight) Currency { blockHeight := uint64(height) if blockHeight == 0 { return NewCurrency64(0) } else if blockHeight == 1 { return NewCurrency64(FirstCoinbase).Mul(SiacoinPrecision) } else if blockHeight == 2 { return NewCurrency64(SecondCoinbase).Mul(SiacoinPrecision) } /...
[ 0.3085802495479584, -0.47030818462371826, 0.9611284732818604, 0.5519406795501709, -0.7211374044418335, -1.3074365854263306, -0.04094701632857323, -0.5150115489959717, -0.7340526580810547, 0.3933594822883606, -0.6629205942153931, -0.47622576355934143, -1.328794240951538, 0.42422452569007874...
func CalculateNumSiacoins(height BlockHeight) Currency { initial := AirdropValue.Add(DeveloperAirdropValue).Add(ContributorAirdropValue).Add(PoolAirdropValue) if height == 0 { return initial } else if height == 1 { return initial.Add(NewCurrency64(FirstCoinbase).Mul(SiacoinPrecision)) } else if height == 2 { ...
[ 0.7362418174743652, 0.6823799014091492, 0.7887336611747742, 0.5187010169029236, -0.2233789712190628, -1.492857575416565, 0.41502082347869873, -0.47078317403793335, -0.11293662339448929, 0.6652741432189941, -0.44557949900627136, -0.2919326722621918, -0.1661248356103897, 0.5606311559677124, ...
func (h BlockHeader) ID() BlockID { return BlockID(crypto.HashObject(h)) }
[ 0.9844335317611694, -0.7641472220420837, 0.42734065651893616, 1.222817301750183, -0.156846821308136, 0.8923729062080383, -0.23002150654792786, -0.2428789585828781, 0.5196085572242737, -0.1842757910490036, -0.8832128047943115, 0.01356838084757328, -1.050595760345459, 0.33769235014915466, ...
func (b Block) CalculateMinerFees() Currency { fees := NewCurrency64(0) for _, txn := range b.Transactions { for _, fee := range txn.MinerFees { fees = fees.Add(fee) } } return fees }
[ 0.4128786325454712, -0.11798161268234253, 0.4205600619316101, -0.22235384583473206, -0.18966683745384216, -1.0704697370529175, -0.2528650164604187, -0.04506663233041763, -0.09472664445638657, 0.351502001285553, -0.43218711018562317, -0.3594285845756531, -1.0628790855407715, 1.4315745830535...
func (b Block) CalculateSubsidies(height BlockHeight) (Currency, Currency) { if uint64(height) == 0 { return NewCurrency64(0), NewCurrency64(0) } if uint64(height) == 1 { return NewCurrency64(FirstCoinbase).Mul(SiacoinPrecision), NewCurrency64(0) } if uint64(height) == 2 { return NewCurrency64(SecondCoinbase...
[ 0.5599068999290466, 0.24835287034511566, 0.6935078501701355, 0.5731923580169678, -0.5405603647232056, -0.7747235298156738, 0.3009944558143616, -0.4830508232116699, -0.3951156437397003, 0.2544177770614624, -0.7908981442451477, 0.20770470798015594, -0.8607167601585388, 0.7354201078414917, ...
func (b Block) Header() BlockHeader { return BlockHeader{ ParentID: b.ParentID, Nonce: b.Nonce, Timestamp: b.Timestamp, MerkleRoot: b.MerkleRoot(), } }
[ 0.1821608990430832, -0.3408881723880768, 0.5828734636306763, 1.1936017274856567, -0.20806537568569183, 0.27673444151878357, -0.1600451022386551, -0.33459702134132385, 0.34351903200149536, -0.33444133400917053, -0.22228465974330902, 0.5333393812179565, -0.9517943263053894, -0.25764906406402...
func (b Block) ID() BlockID { return b.Header().ID() }
[ 0.8439294695854187, -0.8221681714057922, 0.5918087363243103, 1.4542232751846313, 0.08161641657352448, 0.7396944165229797, 0.04740575700998306, -0.09577266126871109, 0.5523267388343811, -0.5085209012031555, -0.5791733264923096, 0.22612692415714264, -0.8829176425933838, 0.7506256103515625, ...
func (b Block) MerkleTree() *crypto.MerkleTree { tree := crypto.NewTree() var buf bytes.Buffer e := encoding.NewEncoder(&buf) for _, payout := range b.MinerPayouts { payout.MarshalSia(e) tree.Push(buf.Bytes()) buf.Reset() } for _, txn := range b.Transactions { txn.MarshalSia(e) tree.Push(buf.Bytes()) ...
[ 0.5678688883781433, -0.12129537016153336, 0.6984338760375977, 0.07757101953029633, -0.7499660849571228, 0.1456369012594223, -0.4789407551288605, -0.5164852142333984, 0.81095951795578, 0.3215826153755188, 0.3365902900695801, 0.45925164222717285, -0.7031940817832947, 0.7333911657333374, -0...
func (b Block) MerkleRoot() crypto.Hash { return b.MerkleTree().Root() }
[ 0.9158738851547241, 0.2700793147087097, 0.49653613567352295, -0.0833699107170105, -0.6761185526847839, 0.5219138264656067, -0.3182516396045685, -0.5215362310409546, 0.26305004954338074, 0.898433268070221, -0.8645814657211304, 1.165649175643921, -0.9601210951805115, 0.49786195158958435, -...
func (b Block) MinerPayoutID(i uint64) SiacoinOutputID { return SiacoinOutputID(crypto.HashAll( b.ID(), i, )) }
[ 0.5185685157775879, -0.4868701100349426, 0.27637046575546265, 0.04622301831841469, -0.8253266215324402, 0.46048039197921753, 0.4046897888183594, -0.1481579691171646, 0.16887833178043365, 0.4157504439353943, 0.02984512969851494, -0.6197786927223206, -0.6476116180419922, 0.12752526998519897,...
func (b Block) MerkleBranches() []string { mbranch := crypto.NewTree() var buf bytes.Buffer for _, payout := range b.MinerPayouts { payout.MarshalSia(&buf) mbranch.Push(buf.Bytes()) buf.Reset() } for _, txn := range b.Transactions { txn.MarshalSia(&buf) mbranch.Push(buf.Bytes()) buf.Reset() } // //...
[ 0.29030027985572815, -0.07328666746616364, 0.8822051286697388, 0.07635233551263809, -0.5588307976722717, 0.0963081419467926, -0.20006145536899567, -0.6124656796455383, 0.10598330199718475, 0.5449860692024231, -0.08293948322534561, 0.13516394793987274, -1.220455527305603, 0.6397051215171814...
func GetCustomer(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) fmt.Fprint(w, vars["customers_id"]) }
[ 0.7009573578834534, -0.9312382936477661, 0.5556266903877258, 0.7139236927032471, 0.07820457220077515, -0.21243317425251007, 0.12555164098739624, 0.07771361619234085, -0.5431457161903381, 0.01470422837883234, 1.1331146955490112, 1.4870164394378662, -0.1358383297920227, 0.953642725944519, ...
func InitializeConnection(addrs []string, timeout int, authDatabase string, username string, password string, workDatabase string) (conn MongoDBConnect, err error) { conn = MongoDBConnect{} //creating DialInfo object to establish a session to MongoDB mongoDBDialInfo := &mgo.DialInfo{ Addrs: addrs, Timeout: ...
[ -0.33463141322135925, 0.21959637105464935, 0.7488501667976379, 0.2502812147140503, 0.408063143491745, -0.021949157118797302, 0.1658373475074768, -0.18791265785694122, 0.2353793829679489, 0.6693981289863586, -0.3174210786819458, 0.49981701374053955, -0.35133638978004456, 0.3590221703052521,...
func (mongoDBConnection MongoDBConnect) GetSocketConn() (session *mgo.Session) { session = mongoDBConnection.mongoSession.Copy() return }
[ -0.16764822602272034, -0.21546022593975067, 0.7371971011161804, 0.11561377346515656, -0.7205050587654114, -0.7372279763221741, -0.08503402024507523, -0.8326761722564697, 0.9747289419174194, -0.13924932479858398, -0.5147363543510437, 1.4583686590194702, 0.0773765966296196, 0.305963277816772...
func (mongoDBConnection MongoDBConnect) GetCollection(session *mgo.Session, collectionName string) (collection *mgo.Collection) { collection = session.DB(mongoDBConnection.database).C(collectionName) return }
[ 0.0022714980877935886, -0.5701097846031189, 0.5091912746429443, 0.17803651094436646, 0.13099324703216553, -0.4327678084373474, -0.531935453414917, -0.6788086891174316, 0.16393274068832397, 0.5992868542671204, 0.04084193706512451, 0.5895003080368042, -0.0628914013504982, 0.4672277271747589,...
func (mongoDBConnect MongoDBConnect) CloseSession() { defer mongoDBConnect.mongoSession.Close() }
[ -0.45991626381874084, -1.3854602575302124, 0.5268799662590027, -0.39980149269104004, 0.3944731056690216, 1.285264492034912, -0.061317771673202515, -0.8889939188957214, 0.6567696928977966, -0.054958343505859375, 0.2604996860027313, 0.13655692338943481, -0.557559609413147, 0.7431559562683105...
func InitializeAtlasConnection(username string, password string, id string) (*mongo.Client, error) { LOGGER.Infof("\t* Establishing Mongo DB connection...") urlEncodedPassword := url.QueryEscape(password) envVersion := os.Getenv(global_environment.ENV_KEY_ENVIRONMENT_VERSION) ConnectionURI := "mongodb+srv://" + us...
[ 0.37604042887687683, -0.16927951574325562, 0.6813015937805176, 0.008589806966483593, -0.012980548664927483, 0.37102437019348145, -0.3082736134529114, -0.1264416128396988, -0.713438093662262, 0.2630137503147125, 0.2921154201030731, 0.8274149298667908, -0.08975096046924591, 0.077620685100555...
func ParseResult(cursor *mongo.Cursor, ctx context.Context) ([]byte, error) { var interfaces []interface{} defer cursor.Close(ctx) for cursor.Next(ctx) { var temp map[string]interface{} err := cursor.Decode(&temp) if err != nil { return []byte{}, errors.New("Encounter error while decoding cursor") } int...
[ -0.10341652482748032, 0.14004826545715332, 0.6396456360816956, 0.03834256902337074, -0.5444607138633728, -0.620257556438446, 0.1701338291168213, -0.9040820002555847, 0.2677849531173706, 0.07701396197080612, -0.8018389940261841, -0.2354537397623062, -0.9967356324195862, 1.0399407148361206, ...
func parseConfig(config interface{}) { jsonString, err := json.Marshal(config) if err != nil { manager.Logger.Errorf("Failed parsing config to interface: %v", err) } err = json.Unmarshal(jsonString, &currentConfig) if err != nil { manager.Logger.Errorf("Failed parsing json to struct: %v", err) } manager.MaxR...
[ -0.44958075881004333, -0.6260942816734314, 0.4100710451602936, -0.23421712219715118, -0.4725642800331116, 0.5772934556007385, 0.6311988234519958, 0.06222144886851311, 0.4112319052219391, 0.0416402630507946, -0.4080585241317749, -0.05965595692396164, -0.2647114396095276, 1.1547985076904297,...
func NewEventPublisher(kafkaAddress string) (tracker.EventPublisher, *kafka.Writer, error) { // create the topics // if err := createTopics(kafkaAddress, issue.IssueEventChannel, project.ProjectEventChannel); err != nil { // return nil, nil, err // } // make a writer that produces messages, using the least-byte...
[ 0.8398817181587219, -1.0072355270385742, 0.3083256483078003, -0.22056905925273895, -0.17288070917129517, -0.7767965197563171, 0.007036845665425062, 1.0883663892745972, 0.1282646805047989, -0.16462649405002594, -0.02361156791448593, -0.9380950927734375, -0.7117987275123596, 1.02593088150024...
func (p *eventPublisher) PublishEvent(ctx context.Context, event interface{}) error { //message is the message we'll be creating and publishing var message kafka.Message //type switch to determine what event we're publishing and to build the correct message switch event := event.(type) { case issue.IssueEvent: ...
[ 0.22657723724842072, 0.10883115977048874, 0.43950155377388, 0.5367092490196228, 0.4716602861881256, 0.18799801170825958, 0.24257151782512665, 0.3988695442676544, -0.2394368201494217, 0.12333329766988754, 0.4741009473800659, 0.4531692862510681, -0.524100124835968, 1.0523837804794312, -0.0...
func createTopics(kafkaAddress string, topics ...string) error { conn, err := kafka.Dial("tcp", kafkaAddress) if err != nil { return errors.Wrap(err, "event-publisher.createTopics") } defer conn.Close() controller, err := conn.Controller() if err != nil { return errors.Wrap(err, "event-publisher.createTopic...
[ 0.8194078207015991, 0.13033731281757355, 0.45604580640792847, 0.6095379590988159, 0.37295836210250854, 0.22316986322402954, 0.0868595615029335, 0.327587366104126, -0.2537250220775604, 0.24524834752082825, 0.487573504447937, -1.2925949096679688, -0.23226118087768555, 0.26284968852996826, ...
func addAnyPortMapping( ctx context.Context, upnp upnpClient, externalPort uint16, internalPort uint16, internalClient string, leaseDuration time.Duration, ) (newPort uint16, err error) { if upnp, ok := upnp.(*internetgateway2.WANIPConnection2); ok { return upnp.AddAnyPortMapping( ctx, "", externalPor...
[ -1.0909850597381592, 0.32828518748283386, 0.8863943815231323, -0.31325963139533997, -0.3350767493247986, -0.0826541930437088, -0.1401912271976471, 0.6194746494293213, 1.3128435611724854, -0.5603097081184387, 0.005721026100218296, -0.09795863181352615, -0.3095664381980896, 0.025922013446688...
func getUPnPClient(ctx context.Context, gw netaddr.IP) (upnpClient, error) { if controlknobs.DisableUPnP() { return nil, nil } ctx, cancel := context.WithTimeout(ctx, 250*time.Millisecond) defer cancel() // Attempt to connect over the multiple available connection types concurrently, // returning the fastest. ...
[ -0.2852031886577606, -0.3315458297729492, 0.9933575987815857, 0.1956731230020523, -0.07403980195522308, -0.7458119988441467, 0.44052979350090027, -1.1645400524139404, 0.3110825717449188, -0.3023741543292999, 0.00924372673034668, 0.8217046856880188, -0.6830967664718628, 0.013921651057898998...
func (c *Client) getUPnPPortMapping( ctx context.Context, gw netaddr.IP, internal netaddr.IPPort, prevPort uint16, ) (external netaddr.IPPort, ok bool) { if controlknobs.DisableUPnP() { return netaddr.IPPort{}, false } now := time.Now() upnp := &upnpMapping{ gw: gw, internal: internal, } var clie...
[ -0.477621853351593, 0.10732048749923706, 1.145143985748291, -0.48352161049842834, -0.9021347165107727, -0.22363144159317017, -0.09079758822917938, 0.018596645444631577, 1.2037734985351562, -0.02144947648048401, 0.05079051852226257, 0.05443905293941498, -0.5679839253425598, -0.4105770587921...
func (k Keeper) AfterNodeCreated(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) { if k.hooks != nil { k.hooks.AfterNodeCreated(ctx, networkAddr, isIndexingNode) } }
[ 0.49370113015174866, 0.2725951671600342, -0.013500705361366272, -0.4263727068901062, -0.31095728278160095, 0.013268697075545788, 1.1310251951217651, 0.4707716107368469, 0.35819974541664124, -0.5167039036750793, 0.046482011675834656, -0.24106432497501373, 0.3101658225059509, 0.4611555039882...
func (k Keeper) BeforeNodeModified(ctx sdk.Context, network sdk.AccAddress, isIndexingNode bool) { if k.hooks != nil { k.hooks.BeforeNodeModified(ctx, network, isIndexingNode) } }
[ -0.2565515339374542, 0.5105144381523132, 0.23468784987926483, -0.5349258780479431, 0.830957293510437, -0.6315051317214966, 0.5691453814506531, 0.39119595289230347, 0.4400654733181, -0.3583627939224243, 0.11121562868356705, 0.41456377506256104, -0.29673343896865845, 0.16586047410964966, -...
func (k Keeper) AfterNodeRemoved(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) { if k.hooks != nil { k.hooks.AfterNodeRemoved(ctx, networkAddr, isIndexingNode) } }
[ 0.32231205701828003, -0.2570352554321289, 0.040486354380846024, -0.4068017601966858, -0.5708634257316589, -0.6154436469078064, 0.9834238886833191, 1.030700445175171, 0.665047824382782, 0.2186134159564972, -0.4535224139690399, -0.029139729216694832, -0.3802950978279114, 0.007763221859931946...
func (k Keeper) AfterNodeBonded(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) { if k.hooks != nil { k.hooks.AfterNodeBonded(ctx, networkAddr, isIndexingNode) } }
[ 0.49858883023262024, -0.4218605160713196, 0.22597143054008484, -0.2154306024312973, -0.608105480670929, -0.009345193393528461, 1.3278886079788208, -0.20899419486522675, 0.6901522874832153, -0.15079791843891144, -0.39830872416496277, 0.7011227011680603, -0.4617077708244324, 0.76636582612991...
func (k Keeper) AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) { if k.hooks != nil { k.hooks.AfterNodeBeginUnbonding(ctx, networkAddr, isIndexingNode) } }
[ -0.212179496884346, -0.19527025520801544, 0.3029116094112396, -0.5769798159599304, -0.8633784651756287, 0.13331712782382965, 1.8724712133407593, 0.8047686815261841, 0.6700323820114136, 0.18480683863162994, 0.3529432713985443, 0.8777144551277161, -0.7535256147384644, -0.25344985723495483, ...
func IsValidIPAddress(s string) bool { for i := 0; i < len(s); i++ { switch s[i] { case '.': return parseIPv4(s) case ':': return parseIPv6(s) } } return false }
[ -1.0577893257141113, -1.0575968027114868, 0.6398468017578125, 0.6115369200706482, -0.8067225813865662, 0.041395388543605804, -0.3887113332748413, 0.4640694558620453, 1.6166789531707764, 0.6287572383880615, -0.27095741033554077, -0.23239941895008087, -0.9134325981140137, -1.548054575920105,...
func IsValidCIDRList(s string) bool { cidrList := strings.Split(s, ",") for _, raw := range cidrList { cidr := strings.Trim(raw, " ") _, _, err := net.ParseCIDR(cidr) if err != nil { return false } } return true }
[ -0.6176929473876953, -0.4617449939250946, 0.2191503643989563, 0.1982269436120987, -0.007675310596823692, -0.31768667697906494, -0.9581397771835327, 0.9718170762062073, 0.4997673034667969, 0.664044976234436, -0.9295318126678467, -1.162536382675171, -1.0944968461990356, 0.21135352551937103, ...
func dtoi(s string) (n int, i int, ok bool) { n = 0 for i = 0; i < len(s) && '0' <= s[i] && s[i] <= '9'; i++ { n = n*10 + int(s[i]-'0') if n >= bigInt { return bigInt, i, false } } if i == 0 { return 0, 0, false } return n, i, true }
[ -0.24916090071201324, 0.004234968684613705, 0.709455668926239, -0.4180959165096283, -0.4848995506763458, -0.2501307427883148, 0.37610048055648804, 0.026644879952073097, -0.9583866596221924, 0.8275802135467529, -1.231016755104065, -0.7602232694625854, -0.24338267743587494, -0.70710414648056...
func IsIPv4(s string) bool { var p [IPv4len]byte for i := 0; i < IPv4len; i++ { if len(s) == 0 { // Missing octets. return false } if i > 0 { if s[0] != '.' { return false } s = s[1:] } n, c, ok := dtoi(s) if !ok || n > 0xFF { return false } s = s[c:] p[i] = byte(n) } if len(...
[ -0.8007633090019226, -0.14818137884140015, 0.5463470816612244, 0.5029982328414917, -0.8017212748527527, -0.7461799383163452, 0.14703141152858734, -0.6607951521873474, 0.43445441126823425, 0.16730251908302307, -0.35587799549102783, -0.3166826665401459, -0.4048566222190857, -0.81922590732574...
func ExtractPool(req PoolRequest) (*gitalypb.Repository, error) { poolRepo := req.GetObjectPool().GetRepository() if poolRepo == nil { return nil, errMissingPool } return poolRepo, nil }
[ -0.9438502192497253, 0.25624242424964905, 0.3648718595504761, -0.1667296588420868, 0.5160425901412964, -0.11351840198040009, 0.6723126769065857, 0.0222940593957901, 0.961634635925293, 0.07515611499547958, 0.39260226488113403, 0.32994353771209717, -0.34957802295684814, 0.036539576947689056,...
func (s *tmService) connWorker(ctx context.Context) { defer log.Printf("Conn worker stopped\n") for { select { case <-ctx.Done(): return case conn, ok := <-s.conn.serve: if !ok { return } ctx.Child("serve", s.connServe). ValueSet("conn", conn).Go() } } }
[ -0.5181920528411865, -0.5703918933868408, 0.5432254672050476, 0.20312391221523285, -0.027894213795661926, 0.14548251032829285, -0.09555921703577042, -0.061872731894254684, -0.6303249597549438, 0.5030573606491089, -1.0007376670837402, -0.6814374923706055, -0.36896777153015137, 0.94961947202...
func (s *tmService) connServe(ctx context.Context) { conn := ctx.Value("conn").(*websocket.Conn) defer conn.Close() ctx.PanicHandlerSet(func(ctx context.Context, panicVal interface{}) { if panicVal != true { log.Printf("Connection serve panic. %s\n", panicVal) debug.PrintStack() } ctx.Cancel(fmt.Errorf...
[ 0.4199615716934204, -0.3217456340789795, 0.7923858761787415, 0.19705545902252197, 0.6109206080436707, -0.282863587141037, -0.00694953091442585, -0.3567030727863312, -0.5312594175338745, 0.05175371840596199, -0.10765647143125534, 0.17864075303077698, -0.4736309051513672, 0.3318803012371063,...
func (*Message) Descriptor() ([]byte, []int) { return file_protos_addressbook_proto_rawDescGZIP(), []int{0} }
[ -0.8892649412155151, 1.2100484371185303, 0.5905975103378296, 0.2781769037246704, -0.26744791865348816, 0.18583254516124725, -0.24819830060005188, 0.23356746137142181, -0.5114384889602661, -0.8266510963439941, 0.2394729107618332, -0.06267694383859634, -0.18958942592144012, 1.112611055374145...
func longestPalindrome(s string) string { n := len(s) dp := make([][]bool, n) for i := 0; i < n; i++ { dp[i] = make([]bool, n) } max := [2]int{0, 0} for i := n - 1; i >= 0; i-- { for j := i; j < n; j++ { dp[i][j] = s[i] == s[j] if dp[i][j] && j-i > 2 { dp[i][j] = dp[i+1][j-1] } if dp[i][j] && ...
[ 0.2849462032318115, -0.3465753197669983, 0.8661161065101624, -0.05657581239938736, -0.9356496930122375, -0.37208127975463867, 0.1864250898361206, 0.3233151137828827, 0.3773002028465271, 0.4016819894313812, -0.6237147450447083, 0.14705882966518402, -0.878048300743103, -0.9398552775382996, ...
func main() { fmt.Println(longestPalindrome("babad")) }
[ 1.386567234992981, -0.8258651494979858, 0.3346394896507263, 0.40462687611579895, -0.00589417852461338, 1.251923680305481, 0.14608263969421387, 1.0372402667999268, -0.7043136358261108, -0.6536650657653809, 0.03682435303926468, 0.9728483557701111, -0.910776674747467, 0.00009820461127674207, ...
func MockResultFileLocationFromFile(f string) (*ResultFileLocation, error) { fileInfo, err := os.Stat(f) if err != nil { return nil, skerr.Wrapf(err, "could not stat %s", f) } // Read file into buffer and calculate the md5 in the process. file, err := os.Open(f) if err != nil { return nil, skerr.Wrapf(err, "...
[ -0.0717243179678917, -0.5789510011672974, 0.6910000443458557, -0.12801343202590942, -0.26347601413726807, -0.270644873380661, 1.403841257095337, -0.2549641728401184, -0.6719017624855042, -0.31498539447784424, -0.6881190538406372, -1.3252677917480469, -0.36759382486343384, -0.54391443729400...
func MockResultFileLocationWithContent(name string, content []byte, ts time.Time) *ResultFileLocation { hash := md5.New().Sum(content) mrf := &ResultFileLocation{} mrf.On("Name").Return(name) mrf.On("MD5").Return(hex.EncodeToString(hash)) mrf.On("Open", testutils.AnyContext).Return(ioutil.NopCloser(bytes.NewReade...
[ -0.24566614627838135, -1.100175380706787, 0.45389747619628906, -0.5236557126045227, -0.012491417117416859, -0.339934378862381, 0.5394985675811768, -0.6012517213821411, -0.47874000668525696, -0.11257612705230713, -0.7641733884811401, -1.3699971437454224, -0.5521511435508728, -0.936647236347...
func (m *Mutator) Mutate(request *admissionv1.AdmissionRequest) ([]mutator.PatchOperation, error) { var result []mutator.PatchOperation if request.DryRun != nil && *request.DryRun { return result, nil } if request.Operation == admissionv1.Create { return m.MutateCreate(request) } if request.Operation == admi...
[ -1.9834650754928589, 0.23556506633758545, 0.70661461353302, 0.7255566716194153, -0.20589493215084076, 0.20497289299964905, 0.5328367948532104, -0.6920934319496155, 0.9992416501045227, 0.6621453166007996, 0.2188747227191925, 0.5016729235649109, 0.3527938723564148, 0.9097150564193726, -0.2...
func (m *Mutator) MutateCreate(request *admissionv1.AdmissionRequest) ([]mutator.PatchOperation, error) { var result []mutator.PatchOperation var patch []mutator.PatchOperation var err error // Parse incoming object awsMachineDeploymentNewCR := &infrastructurev1alpha3.AWSMachineDeployment{} if _, _, err := mutat...
[ -1.0840564966201782, -0.038289036601781845, 0.6791038513183594, 0.29404217004776, -0.19544923305511475, 0.6516106128692627, 0.25070270895957947, -0.7973555326461792, 0.2586614191532135, 0.9651823043823242, 0.25698837637901306, -0.13992497324943542, 0.1285760998725891, 0.9725642204284668, ...
func (m *Mutator) MutateUpdate(request *admissionv1.AdmissionRequest) ([]mutator.PatchOperation, error) { var result []mutator.PatchOperation var patch []mutator.PatchOperation var err error // Parse incoming objects awsMachineDeploymentNewCR := &infrastructurev1alpha3.AWSMachineDeployment{} awsMachineDeployment...
[ -0.9980887770652771, -0.47666454315185547, 0.7700995802879333, 0.23854230344295502, -0.5113646984100342, 0.5124109983444214, -0.17032930254936218, -0.35613444447517395, 0.4363897144794464, 1.2348296642303467, 0.702747106552124, 0.12472783774137497, -0.22044962644577026, 0.8941724896430969,...
func (m *Mutator) MutateOnDemandPercentage(awsMachineDeployment infrastructurev1alpha3.AWSMachineDeployment) ([]mutator.PatchOperation, error) { var result []mutator.PatchOperation // Note: This will only work if the incoming CR has the .spec.provider.instanceDistribution // attribute defined. Otherwise the request ...
[ -1.044215202331543, -0.8786661028862, 0.6827263236045837, 0.07949459552764893, 0.08794225007295609, 0.41674020886421204, 0.5715853571891785, -0.3747779428958893, 0.1485375314950943, 1.0979864597320557, 0.27656692266464233, -0.310952365398407, -0.26405277848243713, 0.9114587306976318, 1.2...
func DefaultCluster(cfg *Config) (Client, error) { ctx := context.Background() client := &defaultCluster{ ctx: ctx, config: cfg, } if client.config.Port == "" { client.config.Port = fmt.Sprintf("%d", DefaultPort) } err := client.setupAPIAddr() if err != nil { return nil, err } err = client.resolv...
[ 0.16740202903747559, 0.45097485184669495, 0.3547912538051605, -0.22303178906440735, 0.7934098243713379, 0.05853891745209694, 0.35503703355789185, -0.12753412127494812, 0.172380268573761, -0.09069139510393143, 0.4856804311275482, 0.5347490310668945, -1.428088665008545, 0.013510323129594326,...
func Logging(f HandlerFunc) HandlerFunc { return func(ctx context.Context, r events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { logger := api.StandardLambdaLogger(ctx, pkg.EnvLogLevel) headerMap := map[string]string{} for _, header := range headersToLog { if val, ok := r.Headers[header];...
[ -0.1726074367761612, -0.4772736728191376, 0.8478208184242249, -0.5647891759872437, -0.46942588686943054, -0.08102967590093613, 0.14858762919902802, -0.05818509683012962, -0.36730197072029114, -0.1625584065914154, -0.014657340943813324, -0.16310548782348633, 0.847648561000824, -0.0998783186...
func NewInMemoryCache(expireIn time.Duration) *InMemoryCache { return &InMemoryCache{ expireIn: time.Now().Add(expireIn), data: make(map[string]*CacheEntry), } }
[ 0.6710106134414673, -0.7959204316139221, 0.3476928472518921, -0.18731427192687988, -1.2915736436843872, -0.3362305164337158, -1.2825011014938354, 0.45497778058052063, -0.37288615107536316, 0.41071832180023193, -0.5728691220283508, 1.0389386415481567, -0.5171557068824768, 0.4952211380004883...
func GetAllMappedBooks() map[string]Book { return MappedCatalog }
[ -0.5943441390991211, -1.3861476182937622, 0.5283936858177185, 1.419791579246521, -1.0204622745513916, 1.1610772609710693, -0.9234703779220581, 0.7313716411590576, 0.48348337411880493, -0.7966552972793579, -0.2843706011772156, 0.20016083121299744, 0.37993744015693665, 0.20377756655216217, ...
func (c Catalog) GetAllBooks() []Book { return []Book(c) }
[ -0.3214432895183563, -0.24426914751529694, 0.3603542149066925, 2.226752519607544, 0.25411754846572876, 0.8583731055259705, -1.2607827186584473, 0.1829054057598114, 0.0882953479886055, -0.5671413540840149, 0.0243975892663002, 1.3317142724990845, -0.8287469148635864, 0.8524606227874756, 0....
func (c Catalog) Len() int { return len(c.GetAllBooks()) }
[ -0.2049301266670227, -0.13094128668308258, 0.08507878333330154, 0.13398392498493195, 0.5676071643829346, -0.20979323983192444, 0.36292552947998047, 1.1052501201629639, -0.9637552499771118, -0.42867401242256165, -0.6023913025856018, 0.1310434639453888, 0.20572052896022797, -0.06195499747991...
func (c Catalog) GetAllTitles() []string { books := make([]string, 0) for _, v := range c.GetAllBooks() { books = append(books, v.Title) } return books }
[ 0.06439396739006042, -0.8114540576934814, 0.6580922603607178, 1.3922964334487915, -0.028979377821087837, 0.14424972236156464, -1.9893361330032349, -0.1269877552986145, -0.3723205327987671, 0.1159503161907196, 0.19431743025779724, 0.2924269437789917, -0.7751402258872986, 0.9884191751480103,...
func (c Catalog) GetUniqueAuthors() []string { authors := make([]string, 0) for _, v := range c.GetAllBooks() { for _, a := range v.Authors { if inSlice(a, authors) { continue } authors = append(authors, a) } } return authors }
[ -0.6888183951377869, -0.9224544763565063, 0.5254117846488953, 0.7944772839546204, 0.9610252380371094, 0.12227924168109894, -0.2834305465221405, 0.6038548946380615, -0.23439078032970428, 0.694789707660675, -0.16397182643413544, 0.849033772945404, -0.6164851188659668, 0.06823348999023438, ...
func AddBookToCatalog(b Book) { MappedCatalog[b.ID] = b for _, author := range b.Authors { Authors[author] = append(Authors[author], b.ID) } }
[ -1.0516518354415894, -0.17884309589862823, 0.41359519958496094, 0.5180137753486633, 0.07449766248464584, 1.4276865720748901, -1.1636443138122559, 1.1642944812774658, -0.5130481123924255, 0.11140203475952148, 0.34182584285736084, 0.6665683388710022, -0.10462222248315811, 0.3985517621040344,...
func GetBookDetails(ID string) string { if book, ok := MappedCatalog[ID]; ok { return fmt.Sprintf("@@@@@ Book ID #%s @@@@@\nTitle: %s\nAuthor(s): %s\nPrice: $%d\nDescription: %s\n", book.ID, book.Title, strings.Join(book.Authors, ", "), book.PriceCents, book.Description) } return "" }
[ -0.051403746008872986, -0.32458779215812683, 0.5740810036659241, -0.1207340732216835, 0.252592533826828, 0.9854846596717834, -1.1660505533218384, -0.7750934362411499, -0.4172835946083069, -0.03525516018271446, -0.016423029825091362, 0.2255835384130478, 0.17717860639095306, 0.43821689486503...
func GetAllByAuthor(findAuthor string) []Book { books := []Book{} if ids, ok := Authors[findAuthor]; ok { for _, id := range ids { books = append(books, MappedCatalog[id]) } } return books }
[ -0.40654218196868896, -0.6354917883872986, 0.6025989055633545, 1.7079728841781616, -0.064445361495018, 0.13203398883342743, -0.08226040750741959, -0.05734363570809364, 0.05612218752503395, 0.321394145488739, -0.06342307478189468, 0.7302176356315613, -0.256618857383728, 0.7754489779472351, ...
func GetCatalogDetails() string { var s string for _, book := range GetAllMappedBooks() { s += GetBookDetails(book.ID) } return s }
[ 0.31770771741867065, -0.3923005759716034, 0.32614555954933167, 0.5416622161865234, 0.16084866225719452, 1.0135540962219238, -1.1041419506072998, -0.12264658510684967, -0.593921422958374, 0.30897486209869385, 0.4343782663345337, -0.014836420305073261, 0.37221187353134155, 0.6856317520141602...
func NewID(size int) string { b := make([]byte, size) for i := range b { b[i] = ABC[rand.Intn(len(ABC))] } return string(b) }
[ 0.6868351101875305, -0.7881789207458496, 0.46912428736686707, -1.2659538984298706, -0.3927377462387085, 1.1664642095565796, -0.6066953539848328, -0.8300618529319763, 1.4427248239517212, 0.7039697766304016, -0.6814326047897339, 0.03256664797663689, -1.4846588373184204, -0.6096065044403076, ...
func (b Book) SalePriceCents() int { return b.PriceCents / 2 }
[ -0.39516520500183105, -0.4347143769264221, 0.3771611154079437, 0.7394086122512817, -0.6337425708770752, 0.2809816002845764, -0.28215932846069336, -0.40858668088912964, 0.021060850471258163, 0.4426153898239136, 0.3942561149597168, -1.0253866910934448, -0.4573339819908142, -0.613236069679260...
func (*Reply) Descriptor() ([]byte, []int) { return file_protobuf_message_proto_rawDescGZIP(), []int{0} }
[ -0.4609473645687103, 0.3706910312175751, 0.7008602023124695, 0.036893345415592194, -0.033170729875564575, 0.18623095750808716, -0.33080726861953735, 0.2066553682088852, 0.779678463935852, -0.399387925863266, -0.8765009641647339, 0.7706672549247742, -0.6116837859153748, 0.8747050166130066, ...
func (*Payload) Descriptor() ([]byte, []int) { return file_protobuf_message_proto_rawDescGZIP(), []int{1} }
[ -0.5551025867462158, 0.782381534576416, 0.685947597026825, -0.3879096210002899, -0.5979670286178589, 0.17892715334892273, 0.47293123602867126, -0.007759943604469299, -0.507815957069397, -0.27043458819389343, -0.17358529567718506, -0.25438010692596436, 0.05503416061401367, 0.614513576030731...
func (group *Groups) Add(mw Middleware) { group.middleware = append(group.middleware, mw) }
[ -0.8518577814102173, 0.22488829493522644, 0.13301274180412292, 0.24860310554504395, -0.3726516366004944, 0.38075461983680725, -0.6253816485404968, -0.533111035823822, 0.33692869544029236, -0.16301044821739197, 0.5108016729354858, 0.8126437664031982, -1.6079719066619873, 2.03623628616333, ...
func (group *Groups) Get(path string, handler http.HandlerFunc) { group.webserver.router.Get(path, group.handler(handler)) }
[ -0.8966786861419678, -0.4368681311607361, 0.23356500267982483, -0.2621437907218933, -0.037558309733867645, -0.17293815314769745, 0.7564346790313721, -0.07033566385507584, -1.4129244089126587, -0.16517792642116547, 0.3430919945240021, 1.4249436855316162, 0.1956723928451538, 0.30209353566169...
func (group *Groups) Post(path string, handler http.HandlerFunc) { group.webserver.router.Post(path, group.handler(handler)) }
[ -0.49944671988487244, -0.2019825130701065, 0.2761319577693939, 0.5021713972091675, -0.48285236954689026, 0.4886418282985687, 0.8833787441253662, -0.17532819509506226, -1.3086726665496826, -0.9617300629615784, -0.3826523721218109, 0.46292683482170105, -0.15628665685653687, 1.100033283233642...
func makeExtensionTypeName(base string) string { return fmt.Sprintf("%s%s%s", base, valSeparator, typeAppendix) }
[ -0.21608366072177887, -0.20402902364730835, 0.5059341788291931, 0.15416687726974487, -1.1549044847488403, 0.05760142579674721, -0.7170407772064209, 0.05289493501186371, 0.05855487287044525, 0.2606702148914337, -0.4274372458457947, -0.7582256197929382, -0.11914272606372833, -0.5187366008758...
func (d *downloader) Download(u *url.URL, out writeSyncer) error { client, err := d.Session.Client() if err != nil { return err } req, err := d.Session.Request(u) if err != nil { return err } res, err := client.Do(req) if err != nil { return err } defer res.Body.Close() if stopNow, err := d.Session.Ha...
[ -0.3632180690765381, 0.4345172941684723, 0.8626099824905396, 0.3112542927265167, -0.7797868251800537, -0.38122352957725525, 0.28254228830337524, 0.08741042762994766, -0.051062073558568954, -0.14385169744491577, -0.3746126890182495, 0.4631809592247009, 0.08790533244609833, -0.29288247227668...
func CreateURL(base string, args map[string][]string) string { u, _ := url.Parse(base) q := u.Query() for arg, vals := range args { for _, val := range vals { q.Add(arg, val) } } u.RawQuery = q.Encode() return u.String() }
[ 0.04830970615148544, -0.049125827848911285, 0.4350454807281494, -0.15092620253562927, 0.5731889009475708, 0.25252366065979004, -1.5297942161560059, 0.12978099286556244, -1.0176187753677368, 0.28584998846054077, 0.3177810609340668, -0.6579713225364685, -0.25284409523010254, 0.12120114266872...
func createMockContext(t *testing.T, mockArgs []string) *cli.Context { t.Log("Create mock context") mockApp := cli.NewApp() mockSet := flag.NewFlagSet("mock", 0) //mockArgs := []string{"TESTDIR"} mockSet.Parse(mockArgs) return cli.NewContext(mockApp, mockSet, nil) }
[ -0.5058584809303284, 0.02553420327603817, 0.634730875492096, 0.2960878014564514, 1.1484649181365967, 0.7912752628326416, 0.39511004090309143, -0.5617470145225525, 0.5251026749610901, 0.4759539067745209, 0.1999462991952896, -0.26902392506599426, -0.6526699662208557, 0.9594489932060242, -1...
func testCmdDeleteFilesystem(t *testing.T) { t.Log("TODO") }
[ 0.76252281665802, -0.3819172978401184, 0.41478827595710754, 0.6290766000747681, 1.5589015483856201, 0.5252698659896851, 1.094924807548523, 0.189153254032135, 0.46642646193504333, -2.13383150100708, -0.1851045936346054, -0.19024930894374847, 0.2144017219543457, 0.6050863862037659, -1.3144...
func testCmdMountFilesystem(t *testing.T) { t.Log("TODO") }
[ 1.1192195415496826, -0.372959166765213, 0.5483564138412476, 0.7473706007003784, 1.4176266193389893, 0.20612934231758118, 0.5164057016372681, -0.4669930040836334, 0.02773999609053135, -1.492725133895874, -0.5527680516242981, -0.22250013053417206, 0.16578315198421478, 0.28306496143341064, ...
func testCmdMountLZFS1(t *testing.T) { // INIT config.InitWizeConfig() // GIVEN // How to add supporting --fg and --notifypid to ForkChild? mockCtx := createMockContext(t, []string{"_test.zip"}) // WHEN err := CmdMountFilesystem(mockCtx) t.Logf("Error: %v", err) // SHOULD - just two examples of expectations...
[ 0.6504937410354614, 0.05218396708369255, 0.8018499612808228, -0.023663027212023735, 0.8098729848861694, 0.23114311695098877, -0.21458667516708374, 0.5199658870697021, -0.08018241077661514, -0.8392543792724609, -0.12402109056711197, 0.09323340654373169, -0.7416689991950989, 1.05490970611572...