text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (c Client) getBase(command string) string { return Host + "/api/" + command + ".json?" }
[ -0.849023699760437, -0.4942328929901123, 0.4865708649158478, 0.45788079500198364, 0.6437786817550659, 0.2839345335960388, -0.22408536076545715, -0.4939100444316864, -0.7899041175842285, 0.24517227709293365, -0.21610906720161438, 0.7964051961898804, -0.17086389660835266, 0.8530393242835999,...
func (c Client) MailSend(args MailArgs) error { // Create the address. base := c.getBase("mail.send") v := url.Values{} c.setCredentials(&v) addArray(&v, "to", args.To) addArray(&v, "toname", args.ToName) addArray(&v, "bcc", args.BCC) v.Add("from", args.From) v.Add("fromname", args.FromName) v.Add("subject", ...
[ -0.47047796845436096, 0.892500638961792, 0.9584804177284241, -0.055445607751607895, 0.3306775689125061, -0.09089450538158417, -0.6871504783630371, -0.6013335585594177, -0.86867755651474, 0.4104861915111542, -0.5096956491470337, 1.4139147996902466, -0.548231303691864, 0.5638845562934875, ...
func App() *buffalo.App { if app == nil { app = buffalo.New(buffalo.Options{ Env: ENV, SessionStore: sessions.Null{}, SessionName: "_userdata_session", }) app.Use(forcessl.Middleware(secure.Options{ SSLRedirect: ENV == "production", SSLProxyHeaders: map[string]string{"X-Forwarded-Pro...
[ 0.6488803029060364, 0.2627065181732178, 0.7237022519111633, 0.6761739253997803, -0.5590540170669556, 0.9149211049079895, 0.3244444727897644, 0.017761217430233955, 0.642246663570404, -0.23327329754829407, -0.40584662556648254, 0.4685806632041931, 0.07938487082719803, 0.8906190395355225, 0...
func (b bit128) toByteSlice() []byte { dst := make([]byte, 16) _ = dst[15] binary.BigEndian.PutUint64(dst[0:8], b[0]) binary.BigEndian.PutUint64(dst[8:16], b[1]) return dst }
[ -0.1988789290189743, 0.3078855574131012, 0.7431703209877014, -0.6143857836723328, 1.0476006269454956, -0.4612794816493988, -1.0841093063354492, -0.9297707676887512, -0.125813290476799, 0.8679957389831543, -0.608443558216095, 0.6799602508544922, -0.44182467460632324, 0.23790305852890015, ...
func byte16FromByteSlice(src []byte) (blk bit128) { _ = src[15] return bit128{binary.BigEndian.Uint64(src[0:8]), binary.BigEndian.Uint64(src[8:16])} }
[ 0.5327526330947876, 0.17459358274936676, 0.2822972536087036, 0.07239758223295212, -0.11922303587198257, -0.14887438714504242, -0.5607094168663025, -0.06423082947731018, 0.13883091509342194, 0.11526280641555786, -0.8285790085792542, 0.5437296032905579, -0.02026808075606823, 0.88015747070312...
func WrapListener(listener net.Listener) (*StoppableListener, error) { tcpListener, ok := listener.(*net.TCPListener) if !ok { return nil, errors.New("cannot wrap listener") } wrappedListener := StoppableListener{ TCPListener: tcpListener, stop: make(chan int)} return &wrappedListener, nil }
[ -0.51335608959198, -0.676668107509613, 0.3213866055011749, -0.9411863684654236, -1.1573017835617065, 1.4105676412582397, -0.01031013485044241, -0.6533289551734924, 0.5196356773376465, 0.19737306237220764, 0.13937771320343018, -1.3552311658859253, 0.49452605843544006, 0.4766417443752289, ...
func (sl *StoppableListener) Accept() (net.Conn, error) { for { sl.SetDeadline(time.Now().Add(time.Second)) netConn, err := sl.TCPListener.Accept() select { case <-sl.stop: return nil, ErrStopped default: } if err != nil { netErr, ok := err.(net.Error) if ok && netErr.Timeout() && netErr.Tempo...
[ -0.8896756768226624, -0.8612200021743774, 0.6271920800209045, -0.2713528275489807, -0.8441829085350037, 0.24456195533275604, -0.05800197273492813, 0.16227786242961884, -0.8635967373847961, 0.42942872643470764, 0.48268216848373413, -1.0417110919952393, 0.4155550003051758, 0.7694107294082642...
func (sl *StoppableListener) Close() error { select { case <-sl.stop: default: close(sl.stop) } return nil }
[ -0.24159258604049683, -0.2071075737476349, 0.172098770737648, 0.2591898739337921, -0.896520733833313, 0.8539788126945496, 0.11917253583669662, -0.834572434425354, -0.7739512920379639, -0.6202675700187683, 0.3632242977619171, -1.2117767333984375, -0.5653808116912842, 0.48608648777008057, ...
func (post *Post) create() (err error){ statement := "INSERT into posts (content,author) values ($1, $2) returning id" stmt, err := Db.Prepare(statement) if err != nil{ fmt.Println("cannot INSERT into the database") return } defer stmt.Close() err = stmt.QueryRow(post.Content, post.Author).Scan(&post.Id) r...
[ 0.43628260493278503, 0.4602126181125641, 0.32872650027275085, 0.7848002314567566, 0.3077656030654907, 0.49206048250198364, -0.5696679353713989, -0.10067836940288544, -1.261269211769104, -0.464431494474411, 0.06384884566068649, -1.0702499151229858, -1.3988078832626343, 0.3489639461040497, ...
func retrieve(id int) (post Post, err error){ post = Post{} err = Db.QueryRow("select id, content, author from posts where id = $1", id).Scan(&post.Id, &post.Content, &post.Author) return }
[ 0.8148066997528076, 0.2770298421382904, 0.31386178731918335, 0.36879974603652954, 0.01951715722680092, -0.9178153276443481, -0.4795413613319397, -0.04846837744116783, 0.32538047432899475, -1.3671185970306396, -0.30716511607170105, -0.6112328171730042, -0.9439712166786194, -0.72521936893463...
func (post *Post) update() (err error) { _, err = Db.Exec("update posts set content = $2 author = $3 where id = $1",post.Id, post.Content, post.Author) return }
[ 0.20446312427520752, -0.3891170024871826, 0.14765380322933197, 0.6326227784156799, 0.029732678085565567, 0.41972213983535767, -0.8944025635719299, 0.17984792590141296, -1.1832239627838135, -0.013858974911272526, -0.1343611478805542, -0.5647175312042236, -1.1147149801254272, -0.404285550117...
func (post *Post) delete() (err error) { _, err = Db.Exec("delete from posts where id = $1", post.Id) return }
[ 0.9566829204559326, 0.9866984486579895, 0.13418908417224884, 1.3579250574111938, 1.5342248678207397, 0.016059264540672302, -0.592124342918396, 0.39207538962364197, -0.3533729612827301, -0.033337730914354324, 0.00523404311388731, -0.39617446064949036, -1.1154989004135132, 0.0518598891794681...
func GetTides(fc *geojson.FeatureCollection, context *Context) (*geojson.FeatureCollection, error) { var ( err error tout Output result *geojson.FeatureCollection ) tidesURL := context.TidesURL tin, dtgFeatureMap := toTidesIn(fc.Features, context) util.LogAudit(context, util.LogAuditInput{Actor: "anon ...
[ -0.692534863948822, -0.652154266834259, 0.5598986148834229, -0.7965588569641113, -0.19697090983390808, -0.43207666277885437, -0.04043003171682358, -0.6840982437133789, -0.6491101384162903, 0.14317208528518677, -0.16796287894248962, 0.3279692828655243, -0.24300746619701385, 0.20886604487895...
func PostInfoAttachment(ctx context.Context, app *app.App, channelID string, userID string, title string, message string) { app.Client.PostEphemeralContext(ctx, channelID, userID, slack.MsgOptionAttachments(slack.Attachment{ Pretext: "", Fallback: "", Text: "", Color: "#4DA6FE", Fields: []slack.Attac...
[ 0.24026939272880554, -0.2157246470451355, 0.7219279408454895, -0.8433434963226318, -0.038263119757175446, 0.830513060092926, -0.15850326418876648, -0.5981767177581787, -0.13270556926727295, 0.10073526948690414, -0.017582641914486885, 1.248262882232666, -0.8304092884063721, 0.59066909551620...
func FloatToString(input float64) string { return strconv.FormatFloat(input, 'f', 16, 32) }
[ 0.04609498754143715, 0.8122539520263672, 0.4467906057834625, -0.1977197676897049, 0.7700880169868469, 0.31417950987815857, 0.027561362832784653, -0.6457916498184204, -1.0157943964004517, -0.7457660436630249, 0.062285590916872025, -0.6647141575813293, 0.5016411542892456, 0.6266644597053528,...
func SetupRoutes(app *fiber.App) { app.Use(logger.New()) app.Get("/", homeHandler) v2 := app.Group("/v2") v2.Post("/paystk", paymentRequestHandler) v2.Post("/stkpushcall", stkcallbacksHandler) v2.Post("/successcall", successfulPaymentHandler) walletsGroup := v2.Group("/wallet") walletsGroup.Post("/balance"...
[ -0.011637859977781773, 0.36687159538269043, 0.6601355671882629, 0.47031593322753906, 0.6609772443771362, -0.11712228506803513, 0.2704305946826935, -0.5518544316291809, -0.004125936888158321, -0.05692119523882866, 0.18568648397922516, -0.8699519634246826, 0.003271763678640127, 1.24497675895...
func Lsh(param *LshOptionalParam) (*mat.Dense, *mat.Dense, lshSearch) { params := getParams("lsh") timers := getTimers() disableBacktrace() disableVerbose() // Detect if the parameter was passed; set if so. if param.BucketSize != 500 { setParamInt(params, "bucket_size", param.BucketSize) setPassed(...
[ 0.3505847156047821, -0.2391544133424759, 0.9711886048316956, 0.0825892761349678, -0.022114314138889313, 0.10539443790912628, -0.5973073840141296, -0.5471224188804626, 0.2898789942264557, -0.15593628585338593, 0.10292022675275803, 0.6202136874198914, -0.004637138918042183, 0.952642500400543...
func ParseUser(jsonBuffer []byte) (models.User, error) { var user models.User // Unmarshal the json into it. this will use the struct tag err := json.Unmarshal(jsonBuffer, &user) // the array is now filled with users return user, err }
[ -0.3821237087249756, -0.14757786691188812, 0.5344990491867065, -0.05549051612615585, -0.5316594243049622, -0.14957934617996216, 0.39861252903938293, -0.6996399164199829, 0.2465449869632721, -0.7264761328697205, -1.1519631147384644, -0.7716416716575623, -0.6738713383674622, -0.2310990691184...
func (stor *arrayGroupStorage) SetGroupList(Groups ...Group) { stor.lock.Lock() defer stor.lock.Unlock() stor.db = Groups }
[ -1.1682835817337036, 0.02830355614423752, 0.4470286965370178, 0.8314604759216309, 0.12645812332630157, 0.06742463260889053, 0.0946076512336731, -0.5979324579238892, -0.2214878499507904, 0.672998309135437, -0.8636549115180969, -0.3617529571056366, -0.7594901323318481, 0.26201871037483215, ...
func (stor *arrayGroupStorage) Query(query map[string]interface{}) (out []Group) { stor.lock.RLock() defer stor.lock.RUnlock() // nil means get all - we copy the slice so modifications don't disturb the DB if query == nil { out = make([]Group, len(stor.db)) copy(out, stor.db) return } for _, Group := range ...
[ -0.6514587998390198, 0.17483429610729218, 0.49340876936912537, 0.8350786566734314, -0.8928631544113159, -0.8808727264404297, -0.6946536898612976, -0.3094572424888611, 0.4684838652610779, 0.4856833815574646, 0.7814871072769165, 0.060018159449100494, -0.7858656644821167, 0.5442354679107666, ...
func (stor *arrayUserStorage) SetUserList(users ...User) { stor.lock.Lock() defer stor.lock.Unlock() stor.db = users }
[ -1.116187334060669, -0.20881134271621704, 0.36029618978500366, 1.2423118352890015, 0.06704328954219818, 0.37243926525115967, 0.23687009513378143, 0.2310725599527359, 0.03999330848455429, 0.7132376432418823, -1.432810664176941, -0.18200963735580444, -0.4828794598579407, 0.5782334804534912, ...
func (stor *arrayUserStorage) Query(query map[string]interface{}) (out []User) { stor.lock.RLock() defer stor.lock.RUnlock() if query == nil { out = make([]User, len(stor.db)) copy(out, stor.db) return } for _, user := range stor.db { if matchesQuery(query, user) { out = append(out, user) } } return...
[ -0.42516329884529114, -0.10014097392559052, 0.3762717545032501, 1.427319049835205, -0.6141534447669983, -0.45127931237220764, -0.5356485247612, 0.044579919427633286, 0.6822671890258789, 0.4813328981399536, 0.4956415295600891, 0.18753111362457275, -0.6817547082901001, 0.33322247862815857, ...
func matchesQuery(query map[string]interface{}, candidate interface{}) bool { vals := reflect.ValueOf(candidate) for i := 0; i < vals.NumField(); i++ { field := vals.Field(i) fieldName := vals.Type().Field(i).Tag.Get("json") if queryVal, ok := query[fieldName]; ok { // If we run into a slice, we make sure th...
[ -0.2941829562187195, -0.829574465751648, 0.570143461227417, 0.15460409224033356, -0.9951858520507812, -0.22805576026439667, -0.6818958520889282, -0.04636488854885101, -0.41940543055534363, -0.07186747342348099, 0.4019837975502014, 0.04875512048602104, -0.18831850588321686, 0.41500076651573...
func matchesTerm(term string, candidate interface{}) (relevance int) { vals := reflect.ValueOf(candidate) for i := 0; i < vals.NumField(); i++ { stringVal := strings.ToLower(fmt.Sprint(vals.Field(i).Interface())) // A basic method of ranking search relevance if stringVal == term { relevance += 5 } else if ...
[ -0.3404316008090973, -0.7706714868545532, 0.5189022421836853, -0.2362198382616043, -0.442340224981308, -0.3532503545284271, -0.032217059284448624, 0.847666323184967, -0.6277152299880981, 0.23814615607261658, -0.031122153624892235, -0.13033854961395264, -0.7316235899925232, -0.0063559510745...
func getRepoDOI(c *Context) string { repo := c.Repo.Repository var doiFork *db.Repository if repo.Owner.Name == "doi" { doiFork = repo } else { if forks, err := repo.GetForks(); err == nil { for _, fork := range forks { if fork.MustOwner().Name == "doi" { doiFork = fork break } } } els...
[ -0.14676669239997864, 0.21864764392375946, 0.6980107426643372, -0.453585147857666, 0.4726446568965912, -1.4606224298477173, 0.09019030630588531, -0.024741392582654953, -0.4953259527683258, 0.5418741106987, -0.48631420731544495, 0.17655739188194275, -0.1792660653591156, 1.0331014394760132, ...
func hasDataCite(c *Context) bool { commit, err := c.Repo.GitRepo.BranchCommit(c.Repo.Repository.DefaultBranch) if err != nil { log.Trace("Couldn't get commit: %v", err) return false } _, err = commit.Blob("/datacite.yml") log.Trace("Found datacite? %t", err == nil) return err == nil }
[ 1.1178410053253174, 0.1335809826850891, 0.6975829005241394, -0.7146770358085632, 0.7648760080337524, -0.44068071246147156, -0.26650261878967285, 0.8799231052398682, -0.3404048979282379, -0.2038407027721405, -0.25504618883132935, 0.26994699239730835, -0.2862277626991272, 0.6377226114273071,...
func isDOIReady(c *Context) bool { if hasDC, ok := c.Data["HasDataCite"]; !ok || !hasDC.(bool) { return false } dbrepo := c.Repo.Repository gitrepo := c.Repo.GitRepo headIsRegistered := func() bool { currentDOI, ok := c.Data["DOI"] if !ok { return false } headBranch, err := gitrepo.SymbolicRef(git.S...
[ -0.49878430366516113, 0.29721444845199585, 0.7007428407669067, -0.8053531646728516, 0.5363796353340149, -0.3148975372314453, 0.08808914572000504, -0.49226656556129456, 0.2391642928123474, 0.05269605293869972, -0.4091698229312897, 0.46271708607673645, -0.4923490881919861, 1.27423894405365, ...
func NewAppSyncEchoServer() *httptest.Server { return httptest.NewServer(newAppSyncEchoHandlerFunc(initialMessage)) }
[ -0.01396371703594923, -0.8929409980773926, 0.2317444235086441, 0.3100994825363159, 0.28946587443351746, -0.06871213018894196, 0.5457475185394287, 0.06437241286039352, -0.46769922971725464, -0.29319465160369873, -0.04296302795410156, 0.3953742980957031, -0.4449094235897064, 0.33831861615180...
func Shuffle(a []int) { rand.Seed(time.Now().UnixNano()) for i := range a { j := rand.Intn(i + 1) a[i], a[j] = a[j], a[i] } }
[ -0.9859256744384766, 0.2170398235321045, 0.5046071410179138, -1.0701535940170288, -0.3885296881198883, 0.5342920422554016, 0.9107831120491028, -0.06473860144615173, 1.2796088457107544, -0.20402882993221283, 0.7330256700515747, 0.6518936157226562, 0.1702846884727478, 0.4410099983215332, -...
func (r *TenantReconciler) pruningResources(ns string, keys []string, obj runtime.Object) error { capsuleLabel, err := capsulev1alpha1.GetTypeLabel(obj) if err != nil { return err } exists, err := labels.NewRequirement(capsuleLabel, selection.Exists, []string{}) if err != nil { return err } notIn, err := lab...
[ -0.6498806476593018, -0.5328222513198853, 0.501659631729126, -0.16886001825332642, -0.131452277302742, 0.0858352929353714, -0.442800909280777, -0.37119752168655396, 0.5890694856643677, 1.0371298789978027, 0.4069889485836029, -0.24276085197925568, -0.6359380483627319, 0.30088141560554504, ...
func (r *TenantReconciler) resourceQuotasUpdate(resourceName corev1.ResourceName, qt resource.Quantity, list ...corev1.ResourceQuota) (err error) { ch := make(chan error, len(list)) wg := &sync.WaitGroup{} wg.Add(len(list)) f := func(rq corev1.ResourceQuota, wg *sync.WaitGroup, ch chan error) { defer wg.Done() ...
[ -0.7213970422744751, -1.109224796295166, 0.6624982357025146, -0.3045201599597931, -0.5298926830291748, -0.10169197618961334, -0.41923755407333374, -0.3391192555427551, -0.9589133262634277, 0.7522391080856323, 0.2610577344894409, -0.20363853871822357, -0.4700572192668915, 0.3861053586006164...
func (r *TenantReconciler) syncResourceQuotas(tenant *capsulev1alpha1.Tenant) error { // getting requested ResourceQuota keys keys := make([]string, 0, len(tenant.Spec.ResourceQuota)) for i := range tenant.Spec.ResourceQuota { keys = append(keys, strconv.Itoa(i)) } // getting ResourceQuota labels for the mutate...
[ -0.9242803454399109, -0.820013701915741, 0.5370504260063171, -0.21802827715873718, 0.4613785445690155, -0.17571178078651428, 0.012896742671728134, -0.306817889213562, 0.07619630545377731, 0.9150204658508301, 0.0826270654797554, 0.697512686252594, 0.24138645827770233, 0.12851008772850037, ...
func (r *TenantReconciler) syncLimitRanges(tenant *capsulev1alpha1.Tenant) error { // getting requested LimitRange keys keys := make([]string, 0, len(tenant.Spec.LimitRanges)) for i := range tenant.Spec.LimitRanges { keys = append(keys, strconv.Itoa(i)) } // getting LimitRange labels for the mutateFn tl, err :...
[ -0.15024350583553314, -0.3424164950847626, 0.5612804889678955, -0.10613403469324112, 0.290888249874115, 0.2431125044822693, -0.1641358733177185, -0.4613356292247772, 0.5208948850631714, 0.9966243505477905, -0.11935780942440033, 0.14280816912651062, -0.4173126518726349, 0.3565497398376465, ...
func (r *TenantReconciler) syncNamespaces(tenant *capsulev1alpha1.Tenant) (err error) { ch := make(chan error, tenant.Status.Namespaces.Len()) wg := &sync.WaitGroup{} wg.Add(tenant.Status.Namespaces.Len()) for _, ns := range tenant.Status.Namespaces { go r.syncNamespace(ns, tenant.Spec.IngressClasses, tenant.Sp...
[ -0.2964048683643341, 0.18332599103450775, 0.40094467997550964, 0.44291579723358154, -0.47334378957748413, 0.6239855885505676, 0.09645809233188629, -0.9660730361938477, 0.4156533479690552, 0.4955883324146271, 0.09905371069908142, 0.02196909673511982, -0.14554280042648315, 1.0936661958694458...
func (r *TenantReconciler) syncNetworkPolicies(tenant *capsulev1alpha1.Tenant) error { // getting requested NetworkPolicy keys keys := make([]string, 0, len(tenant.Spec.NetworkPolicies)) for i := range tenant.Spec.NetworkPolicies { keys = append(keys, strconv.Itoa(i)) } // getting NetworkPolicy labels for the m...
[ -0.42374831438064575, -0.4120197594165802, 0.5045980215072632, -0.5589277148246765, 0.5535168051719666, 0.5580236911773682, -0.31410565972328186, -0.7959685921669006, 0.4752177596092224, 1.0183686017990112, -0.47233545780181885, -0.4962618052959442, -0.2846236824989319, 0.3903966546058655,...
func (r *TenantReconciler) ownerRoleBinding(tenant *capsulev1alpha1.Tenant) error { // getting RoleBinding label for the mutateFn tl, err := capsulev1alpha1.GetTypeLabel(&capsulev1alpha1.Tenant{}) if err != nil { return err } l := map[string]string{tl: tenant.Name} s := []rbacv1.Subject{ { Kind: "User", ...
[ -0.6444748044013977, -0.18401119112968445, 0.8128610849380493, -0.3066002428531647, 0.7116297483444214, -0.0185379795730114, 0.04872359707951546, -0.6250422596931458, 0.6953567862510681, 0.8379396200180054, -0.025071313604712486, 0.9580424427986145, 0.28848811984062195, 0.4802949130535126,...
func asInt(param string) (int64, error) { i, err := strconv.ParseInt(param, 0, 32) if err != nil { return 0, validator.ErrBadParameter } return i, nil }
[ -0.2380291223526001, -0.31409400701522827, 0.6615855693817139, -0.7262698411941528, -0.5894326567649841, -0.2463371753692627, 0.11722612380981445, -0.6161812543869019, -0.5797345638275146, 0.5705695152282715, -0.23503108322620392, 0.16107185184955597, -0.759033739566803, -0.110687017440795...
func NewAnonymousFile() *AnonymousFile { return &AnonymousFile{contents: make([]byte, 0)} }
[ 1.2205356359481812, -1.2578125, 0.05587177351117134, -0.06050128862261772, -1.0196235179901123, 0.41409048438072205, -1.1203899383544922, 0.2304292619228363, -1.4354445934295654, -0.49188026785850525, -0.6261665225028992, -0.08576477319002151, -0.17578484117984772, -0.22321756184101105, ...
func (f *AnonymousFile) Read(ctx context.Context, data []byte) (int, error) { var rdata []byte var newEnd int var length int if f.position >= len(f.contents) { return 0, io.EOF } if f.position+len(data) >= len(f.contents) { newEnd = len(f.contents) } else { newEnd = f.position + len(data) } length = n...
[ -0.2496192455291748, -0.15077301859855652, 0.7788737416267395, -0.8570945858955383, -0.7990541458129883, 0.4618859589099884, -0.016614802181720734, -0.19316218793392181, -0.5260533094406128, -0.18239358067512512, 0.20090560615062714, -0.03721483051776886, -0.3717634081840515, -0.1140032932...
func (f *AnonymousFile) Write(ctx context.Context, data []byte) (int, error) { f.contents = append(f.contents, data...) return len(data), nil }
[ -1.4041329622268677, 0.27979379892349243, 0.4898913502693176, -0.6115694046020508, 0.32777148485183716, 0.01093154028058052, -0.4087890684604645, 0.3269069194793701, -0.813978374004364, -0.3269311189651489, -0.6594896912574768, -0.9589323997497559, -0.6855999231338501, 0.139032244682312, ...
func (f *AnonymousFile) Len() int { return len(f.contents) }
[ 0.2710176110267639, -0.6714743375778198, 0.00912373699247837, -0.6969600319862366, 0.30414190888404846, 0.03389301151037216, 0.6885175108909607, 0.9442662596702576, -1.5081669092178345, -0.8337652087211609, -0.5424612164497375, -0.4953754246234894, 0.9418243169784546, -0.11866330355405807,...
func (f *AnonymousFile) Tell(ctx context.Context) (int64, error) { return int64(f.position), nil }
[ -0.14395713806152344, -0.1380673497915268, 0.39061158895492554, -0.447138249874115, 0.6206527352333069, 0.3470090925693512, 0.28070715069770813, -0.17086005210876465, -1.2253172397613525, -0.08377086371183395, 0.35511869192123413, -0.17540794610977173, -0.29539817571640015, 0.0586604028940...
func (f *AnonymousFile) Seek(ctx context.Context, offset int64) error { if offset < 0 || offset > int64(len(f.contents)) { return io.EOF } f.position = int(offset) return nil }
[ -0.28836753964424133, 0.18259049952030182, 0.3517199456691742, -0.9609039425849915, -0.3350558876991272, 0.9576019048690796, 0.0919777899980545, -0.467461496591568, -0.8011345267295837, -1.0716692209243774, 0.4749944508075714, -0.028686385601758957, 0.5083380937576294, -0.34771865606307983...
func (f *AnonymousFile) Skip(ctx context.Context, diff int64) error { if diff < 0 || int64(f.position)+diff > int64(len(f.contents)) { return io.EOF } f.position += int(diff) return nil }
[ -0.6419330835342407, 0.42384830117225647, 0.6384955644607544, -0.46048882603645325, -0.597766101360321, 0.8930536508560181, 0.8172144293785095, -0.9177358746528625, -0.7362222671508789, -0.5518515706062317, 0.38667619228363037, -0.5929850935935974, 0.8726733922958374, -0.6728869080543518, ...
func (f *AnonymousFile) Close(ctx context.Context) error { f.position = 0 return nil }
[ 0.10633710026741028, -0.3623902201652527, 0.3260633945465088, -0.2774232029914856, 0.32788795232772827, 1.51157546043396, 0.5149338245391846, 0.07217812538146973, -1.328491449356079, -0.5824803113937378, 0.5422405004501343, -0.5132838487625122, -0.3824004828929901, 0.38413581252098083, -...
func (c *Conn) unsafeRead() (*Frame, error) { if c.rhb > 0 { c.conn.SetReadDeadline(time.Now().Add(2 * c.rhb)) } else { c.conn.SetReadDeadline(time.Time{}) } // get stomp command command, err := c.readLine() if err != nil { return nil, err } if len(command) == 0 { // received heartbeat, return empty f...
[ 0.36272355914115906, -0.20469717681407928, 0.8370808959007263, -0.08827055245637894, -0.33564257621765137, 0.05361686274409294, -0.6626698970794678, -0.7297382950782776, -0.3538602888584137, -0.1922961175441742, 0.485687255859375, 0.38900047540664673, -0.9656817317008972, -0.61836659908294...
func GetKubeConfig() (*rest.Config, error) { k8sconfig, err := ctrl.GetConfig() if err != nil { return nil, err } return k8sconfig, nil }
[ 0.4299981892108917, 0.43147534132003784, 0.7728375792503357, 1.0643802881240845, 0.397911012172699, -0.28435248136520386, -0.4433998167514801, -0.022930005565285683, -0.2344103902578354, 0.5512096881866455, -0.43607664108276367, 0.18760159611701965, -0.6683403849601746, 0.9907163977622986,...
func NewCrdRequestController(restService *restserver.HTTPRestService, kubeconfig *rest.Config) (*crdRequestController, error) { //Check that logger package has been intialized if logger.Log == nil { return nil, errors.New("Must initialize logger before calling") } // Check that NODENAME environment variable is ...
[ 0.29191944003105164, -0.17762930691242218, 0.7764358520507812, 0.1352304220199585, 0.38410863280296326, 0.4996607005596161, -0.1264493763446808, -1.0612252950668335, -0.6443405151367188, -0.6250943541526794, 0.8697590231895447, 0.6544089913368225, -0.6465026140213013, 0.7804354429244995, ...
func (crdRC *crdRequestController) StartRequestController(exitChan <-chan struct{}) error { var ( err error ) logger.Printf("Initializing CNS state") if err = crdRC.initCNS(); err != nil { logger.Errorf("[cns-rc] Error initializing cns state: %v", err) return err } logger.Printf("Starting reconcile loop")...
[ 0.23275814950466156, -0.02126714214682579, 0.8280746340751648, 0.6598527431488037, 0.47493740916252136, 0.33736923336982727, 0.47703176736831665, -0.021808810532093048, 0.03575366362929344, -0.452460378408432, 0.5401512980461121, 0.7366885542869568, -0.2702479064464569, 0.589773952960968, ...
func (crdRC *crdRequestController) initCNS() error { var ( pods *corev1.PodList pod corev1.Pod podInfo cns.KubernetesPodInfo nodeNetConfig *nnc.NodeNetworkConfig podInfoByIP map[string]cns.KubernetesPodInfo cntxt context.Context ncRequest cns.CreateNetworkContainerR...
[ -0.11494195461273193, -0.052232179790735245, 0.6888492703437805, -0.37663379311561584, 0.6307218670845032, -0.06659889221191406, -0.14056651294231415, -1.1501421928405762, 0.07772979885339737, -0.08088100701570511, 0.0007989734294824302, 0.1420382708311081, 0.15867139399051666, 0.928017497...
func (crdRC *crdRequestController) UpdateCRDSpec(cntxt context.Context, crdSpec nnc.NodeNetworkConfigSpec) error { nodeNetworkConfig, err := crdRC.getNodeNetConfig(cntxt, crdRC.nodeName, k8sNamespace) if err != nil { logger.Errorf("[cns-rc] Error getting CRD when updating spec %v", err) return err } logger.Pri...
[ -0.18071836233139038, -0.28405627608299255, 0.5422847867012024, -1.103165864944458, 0.006016767118126154, 0.20245186984539032, -0.29586997628211975, 0.06532851606607437, -0.6629812717437744, 0.6117138266563416, 0.05787495896220207, 0.3725065290927887, -0.07885584980249405, -0.3160585165023...
func (crdRC *crdRequestController) getNodeNetConfig(cntxt context.Context, name, namespace string) (*nnc.NodeNetworkConfig, error) { nodeNetworkConfig := &nnc.NodeNetworkConfig{} err := crdRC.KubeClient.Get(cntxt, client.ObjectKey{ Namespace: namespace, Name: name, }, nodeNetworkConfig) if err != nil { ...
[ -0.4343927502632141, 0.0744880810379982, 0.3394147753715515, -0.9541638493537903, -0.3170279860496521, -0.47024646401405334, -1.2356847524642944, -1.076085090637207, -0.8340683579444885, 0.4316435754299164, -0.3855220377445221, 0.466762512922287, -0.6496272087097168, 0.5406538844108582, ...
func (crdRC *crdRequestController) getNodeNetConfigDirect(cntxt context.Context, name, namespace string) (*nnc.NodeNetworkConfig, error) { var ( nodeNetworkConfig *nnc.NodeNetworkConfig err error ) if nodeNetworkConfig, err = crdRC.directCRDClient.Get(cntxt, name, namespace, crdTypeName); err != n...
[ -0.2671358287334442, 0.11883427947759628, 0.4550210237503052, -0.5854771137237549, -0.26018914580345154, 0.6809826493263245, -0.4848252534866333, -1.2983818054199219, -1.0976365804672241, -0.5705052614212036, 0.15378625690937042, 0.48862215876579285, -0.14310604333877563, 0.291025459766387...
func (crdRC *crdRequestController) updateNodeNetConfig(cntxt context.Context, nodeNetworkConfig *nnc.NodeNetworkConfig) error { if err := crdRC.KubeClient.Update(cntxt, nodeNetworkConfig); err != nil { return err } return nil }
[ -1.0343525409698486, -0.5839844942092896, 0.028570998460054398, -1.136600375175476, -0.31350991129875183, 0.1939881294965744, -0.9482017159461975, -0.8315815329551697, -0.9149736762046814, 0.7376019954681396, -0.2885400056838989, -0.00889880582690239, -0.7887261509895325, 0.641313731670379...
func (crdRC *crdRequestController) getAllPods(cntxt context.Context, node string) (*corev1.PodList, error) { var ( pods *corev1.PodList err error ) if pods, err = crdRC.directAPIClient.ListPods(cntxt, allNamespaces, node); err != nil { return nil, err } return pods, nil }
[ -0.23513706028461456, 0.4997212290763855, 0.7442319393157959, 0.3178878128528595, 0.22360996901988983, 0.2974879741668701, -0.800398588180542, -0.6697396039962769, 0.4898405075073242, -0.49794676899909973, 0.17376026511192322, 1.0256723165512085, -0.5582638382911682, 0.5674470067024231, ...
func (crdRC *crdRequestController) isNotDefined(err error) bool { var ( statusError *apierrors.StatusError ok bool notDefined bool cause metav1.StatusCause ) if err == nil { return false } if statusError, ok = err.(*apierrors.StatusError); !ok { return false } if len(statusError.Er...
[ -0.5882847309112549, -0.681270182132721, 0.630418062210083, 0.23980002105236053, 0.2602398693561554, -0.28928568959236145, 0.06764674931764603, 0.00894935429096222, 0.7156561613082886, -0.4894125461578369, -0.5176401734352112, 1.0523786544799805, -0.5537753701210022, 1.9148259162902832, ...
func handleMount(source, location, fstype string, flags uintptr, data string) error { if err := os.MkdirAll(location, os.FileMode(0755)); err != nil { return err } return syscall.Mount(source, location, fstype, flags, data) }
[ 0.5486045479774475, 0.6013622283935547, 0.4627334177494049, 0.19450828433036804, 0.1278156042098999, -0.12620659172534943, 0.20348955690860748, -0.30464690923690796, 0.5561320781707764, -0.5173627138137817, -0.10903108865022659, -0.8071213960647583, 0.08447346091270447, 0.3676755130290985,...
func bindMount(source, dest string) error { return syscall.Mount(source, dest, "", syscall.MS_BIND, "") }
[ 0.6952136158943176, -0.6555318236351013, 0.524399995803833, 0.645219087600708, -0.6746827363967896, 0.08173920959234238, -0.6298364996910095, 0.17035654187202454, 0.28800731897354126, -0.3114096522331238, -0.3959636390209198, 1.043086051940918, -0.22351793944835663, 0.6136550903320312, 0...
func configureInterface(link netlink.Link, netconf *kurmaNetworkInterface) error { linkName := link.Attrs().Name addressConfigured := true // configure using DHCP if netconf.DHCP { cmd := exec.Command("udhcpc", "-i", linkName, "-t", "20", "-n") cmd.Stdin = nil cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr ...
[ -0.7680439352989197, 0.08335631340742111, 0.85025954246521, -0.5250405669212341, 0.5594639778137207, -0.6732659339904785, 0.37764087319374084, 0.333200603723526, 0.1431276500225067, -0.18511123955249786, -0.4600161612033844, -0.43727630376815796, -0.5068716406822205, 0.8063348531723022, ...
func (r *runner) handleSIGCHLD(ch chan os.Signal) { for _ = range ch { for { // This will loop until we're done reaping children. It'll call wait4, but // not block. If no processes are there to clean up, then it'll break the // loop and wait for a new signal. pid, err := syscall.Wait4(-1, nil, syscall.W...
[ 0.4183172583580017, -0.24502037465572357, 0.7863274216651917, 0.5816230177879333, 0.08407238125801086, 0.32869166135787964, 0.16716238856315613, -0.5603575706481934, -0.9765286445617676, -0.19596675038337708, -0.8110423684120178, -1.1160143613815308, -0.12420720607042313, 1.01566743850708,...
func formatDisk(device, fstype string) error { cmd := exec.Command(fmt.Sprintf("mkfs.%s", fstype), device) if b, err := cmd.CombinedOutput(); err != nil { return fmt.Errorf("failed to format %s: %s", device, string(b)) } return nil }
[ -0.4415055811405182, 0.47800344228744507, 0.659898579120636, 0.5746613144874573, 0.26026928424835205, -0.2648528218269348, 0.6521738767623901, -0.48858559131622314, -0.343695729970932, -1.1978389024734497, 1.2362555265426636, 0.5470198392868042, -0.012157106772065163, 0.9901823401451111, ...
func shouldFormatDisk(diskConfig *kurmaDiskConfiguration, currentfstype string) bool { // if no configured fstype is given, then no if diskConfig.FsType == "" { return false } // if format is set to false if diskConfig.Format != nil && *diskConfig.Format == false { return false } // if the current fstype m...
[ -0.5811370015144348, -0.879759669303894, 0.5785009264945984, 0.6517887711524963, -0.5617626905441284, 0.1584375947713852, -0.2928401827812195, 0.06682781130075455, -0.6105776429176331, -0.06346392631530762, 0.8538413047790527, 0.3629341721534729, -0.7331532835960388, 1.761521577835083, -...
func getConfigurationFromFile(file string) (*kurmaConfig, error) { var unmarshalFunc func([]byte, interface{}) error switch filepath.Ext(file) { case ".json": unmarshalFunc = json.Unmarshal case ".yml", ".yaml": unmarshalFunc = yaml.Unmarshal default: return nil, fmt.Errorf("Unrecognized configation file for...
[ 0.08222012966871262, -0.6956226229667664, 0.7712510824203491, -0.024934718385338783, -0.9867388606071472, -0.4076443314552307, 0.21256490051746368, 0.3701336085796356, -0.9818186163902283, 1.0573049783706665, 0.2505430579185486, -0.08298493176698685, -0.2207447588443756, 0.7315935492515564...
func removeIfFile(uri string) { u, err := url.Parse(uri) if err != nil { return } if u.Scheme != "file" { return } os.Remove(u.Path) }
[ 0.156485915184021, 0.8981823921203613, 0.6600026488304138, 0.4145040810108185, 0.44730064272880554, 0.035047952085733414, 0.5972039699554443, 0.33693864941596985, -0.3874492049217224, -0.04562802240252495, 0.0023483477998524904, -0.823123574256897, -1.0925538539886475, 0.5764243006706238, ...
func (s *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { // Validate arguments readOnly := req.GetReadonly() targetPath := req.GetTargetPath() stagingTargetPath := req.GetStagingTargetPath() if len(targetPath) == 0 { return nil, stat...
[ -0.7371801137924194, -1.0531551837921143, 0.679779589176178, 0.19190539419651031, 0.08865918219089508, -0.3484654724597931, 0.5593605637550354, 0.36860641837120056, -0.17526261508464813, 0.7258356213569641, 1.3042325973510742, 0.37727606296539307, -0.8425806760787964, 0.6940778493881226, ...
func (s *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { // Validate arguments targetPath := req.GetTargetPath() if len(targetPath) == 0 { return nil, status.Error(codes.InvalidArgument, "NodeUnpublishVolume target path must be p...
[ -0.8312453031539917, -0.6481755971908569, 0.386653333902359, -0.6788421273231506, -0.039617374539375305, -0.27129870653152466, 0.5515139102935791, 0.8681527972221375, -0.6337704658508301, 0.0824931412935257, 1.412058711051941, 0.7219192981719971, -0.5474518537521362, 0.2566358745098114, ...
func validateVolumeAttributes(attr map[string]string) error { instanceip, ok := attr[attrIP] if !ok { return fmt.Errorf("volume attribute key %v not set", attrIP) } // Check for valid IPV4 address. if net.ParseIP(instanceip) == nil { return fmt.Errorf("invalid IP address %v in volume attributes", instanceip) ...
[ -0.6680131554603577, -0.7800143361091614, 0.6320210695266724, -0.6724929809570312, -0.6068238615989685, 0.006611783057451248, -0.3179936707019806, -0.009383611381053925, -0.4133796691894531, 0.7153775095939636, 0.8891499638557434, -0.4752371311187744, 0.054220546036958694, -0.4063014686107...
func (s *nodeServer) isDirMounted(targetPath string) (bool, error) { // Check if mount already exists // TODO(msau): check why in-tree uses IsNotMountPoint // something related to squash and not having permissions to lstat notMnt, err := s.mounter.IsLikelyNotMountPoint(targetPath) if err != nil { return false, e...
[ -0.7897995114326477, 0.29881712794303894, 0.7429170608520508, -0.28051578998565674, 0.0957944244146347, -0.20146365463733673, 0.017361892387270927, -0.6817203760147095, 1.087816596031189, -0.08418279141187668, -0.1286018341779709, 1.0931932926177979, -0.5546827912330627, 1.2942570447921753...
func (db *DB) SetTxRetiries(n int) { db.txretiries = n }
[ -0.3538142442703247, 0.833221435546875, 0.12904778122901917, -1.7619516849517822, -0.08850875496864319, -0.22291652858257294, -0.5604408383369446, 0.6485674977302551, -0.4606550633907318, 1.4840290546417236, -0.5401217341423035, -1.2057313919067383, -0.9200770854949951, -0.5762037634849548...
func NewDB(conf configuration.Ledger, opts *badger.Options) (*DB, error) { opts = setOptions(opts) dir, err := filepath.Abs(conf.Storage.DataDirectory) if err != nil { return nil, err } opts.Dir = dir opts.ValueDir = dir bdb, err := badger.Open(*opts) if err != nil { return nil, errors.Wrap(err, "local da...
[ 0.11644893139600754, 0.01361947599798441, 0.5305440425872803, 0.4907478392124176, -0.006913354154676199, 0.37824758887290955, 0.7217432260513306, 0.4505918622016907, 0.5415168404579163, -0.19565613567829132, 0.40536031126976013, 0.09974189847707748, -0.2006993442773819, -0.2366147190332412...
func (db *DB) Init(ctx context.Context) error { inslog := inslogger.FromContext(ctx) inslog.Debug("start storage bootstrap") getGenesisRef := func() (*core.RecordRef, error) { buff, err := db.get(ctx, prefixkey(scopeIDSystem, []byte{sysGenesis})) if err != nil { return nil, err } var genesisRef core.Recor...
[ -0.5448174476623535, -0.13329985737800598, 0.9573140144348145, -0.36863040924072266, 0.8002482652664185, 0.28593185544013977, 0.2489301711320877, -0.2809337079524994, -0.23126862943172455, 0.23465000092983246, -0.2981216311454773, 0.5562614798545837, 0.03802110627293587, 0.9996805191040039...
func (db *DB) GenesisRef() *core.RecordRef { return db.genesisRef }
[ 0.4358972907066345, -0.007546150125563145, 0.22233515977859497, 0.11228934675455093, -0.005335056222975254, 0.8252671360969543, 0.2160329967737198, 0.4355200529098511, -0.9323099255561829, 0.05893327295780182, 0.5061435699462891, 0.8071863651275635, -0.6947952508926392, 0.4650511145591736,...
func (db *DB) Stop(ctx context.Context) error { return db.Close() }
[ -1.3985662460327148, 0.4107058048248291, -0.033928971737623215, -0.15154039859771729, -0.07839328050613403, 1.1149184703826904, -0.24369971454143524, -0.2573559880256653, -0.40268760919570923, 0.3526023030281067, -0.12554693222045898, -0.11869653314352036, -0.844700038433075, -0.0163117758...
func (db *DB) GetBlob(ctx context.Context, id *core.RecordID) ([]byte, error) { var ( blob []byte err error ) err = db.View(ctx, func(tx *TransactionManager) error { blob, err = tx.GetBlob(ctx, id) return err }) if err != nil { return nil, err } return blob, nil }
[ 0.23055008053779602, 0.7919768691062927, 0.7751359939575195, 0.31643423438072205, 0.3124935030937195, -0.3108740448951721, -0.004112656228244305, -0.5028594136238098, 0.3433373272418976, 0.28574079275131226, -0.026311812922358513, 0.5385609269142151, -0.8374168276786804, -0.084967486560344...
func (db *DB) SetBlob(ctx context.Context, pulseNumber core.PulseNumber, blob []byte) (*core.RecordID, error) { var ( id *core.RecordID err error ) err = db.Update(ctx, func(tx *TransactionManager) error { id, err = tx.SetBlob(ctx, pulseNumber, blob) return err }) if err != nil { return nil, err } ret...
[ -0.17174729704856873, 0.3790103495121002, 0.7529932856559753, 0.42623353004455566, -0.15861038863658905, 0.5689837336540222, 0.5481910705566406, 0.32730400562286377, 0.19538266956806183, 0.7333651781082153, -0.8827423453330994, -0.21983936429023743, -1.38694429397583, -0.3883179724216461, ...
func (db *DB) GetRecord(ctx context.Context, id *core.RecordID) (record.Record, error) { var ( fetchedRecord record.Record err error ) err = db.View(ctx, func(tx *TransactionManager) error { fetchedRecord, err = tx.GetRecord(ctx, id) return err }) if err != nil { return nil, err } return fet...
[ 0.5749160051345825, 0.8937518000602722, 0.43778684735298157, -0.27427345514297485, -0.21723216772079468, -0.3233686685562134, -0.0532413050532341, -0.6255383491516113, 0.7273540496826172, -0.31889650225639343, 0.44544389843940735, 0.656104326248169, -0.2606700658798218, 0.2858216166496277,...
func (db *DB) SetRecord(ctx context.Context, pulseNumber core.PulseNumber, rec record.Record) (*core.RecordID, error) { var ( id *core.RecordID err error ) err = db.Update(ctx, func(tx *TransactionManager) error { id, err = tx.SetRecord(ctx, pulseNumber, rec) return err }) if err != nil { return nil, er...
[ -0.0367121584713459, 0.5445578694343567, 0.5501242280006409, 0.07448161393404007, -0.3203994035720825, 0.5925790071487427, 0.46089428663253784, 0.36522766947746277, 0.35741865634918213, 0.48026132583618164, -0.476572185754776, 0.1484972983598709, -1.226567268371582, 0.17829415202140808, ...
func (db *DB) GetObjectIndex( ctx context.Context, id *core.RecordID, forupdate bool, ) (*index.ObjectLifeline, error) { tx := db.BeginTransaction(false) defer tx.Discard() idx, err := tx.GetObjectIndex(ctx, id, forupdate) if err != nil { return nil, err } return idx, nil }
[ -0.5465839505195618, -0.3177691102027893, 0.6020079255104065, -0.6131612658500671, -0.29445308446884155, 0.19686874747276306, -0.09120514988899231, -0.13626115024089813, 0.0069769686087965965, 0.43064936995506287, -0.8568310737609863, -0.11860647052526474, -0.39232635498046875, -0.69267547...
func (db *DB) SetObjectIndex( ctx context.Context, id *core.RecordID, idx *index.ObjectLifeline, ) error { return db.Update(ctx, func(tx *TransactionManager) error { return tx.SetObjectIndex(ctx, id, idx) }) }
[ -0.9587211012840271, -0.6126092672348022, 0.3530016243457794, -0.6188483238220215, -0.4393469989299774, 0.5844174027442932, -0.6150991916656494, -0.4363389313220978, 0.13161979615688324, 0.7848983407020569, -1.633986473083496, -0.2678971588611603, -0.3448023200035095, -0.72142094373703, ...
func (db *DB) GetDrop(ctx context.Context, pulse core.PulseNumber) (*jetdrop.JetDrop, error) { k := prefixkey(scopeIDJetDrop, pulse.Bytes()) buf, err := db.get(ctx, k) if err != nil { return nil, err } drop, err := jetdrop.Decode(buf) if err != nil { return nil, err } return drop, nil }
[ -1.0698535442352295, 0.7990952730178833, 0.7734379172325134, -0.16846296191215515, -0.24084033071994781, 0.11566788703203201, -0.7564895153045654, -0.5963810682296753, 0.0671243667602539, 0.5004341006278992, -0.22368347644805908, 0.25605151057243347, -0.4736838638782501, 0.2830798625946045...
func (db *DB) CreateDrop(ctx context.Context, pulse core.PulseNumber, prevHash []byte) ( *jetdrop.JetDrop, [][]byte, error, ) { var err error db.waitinflight() hw := db.PlatformCryptographyScheme.ReferenceHasher() _, err = hw.Write(prevHash) if err != nil { return nil, nil, err } prefix := make([]byte, co...
[ -0.20745451748371124, 0.16717836260795593, 0.920783519744873, -0.33655795454978943, -0.10554742813110352, 0.18669357895851135, -0.1906680315732956, -0.4501504898071289, -0.11933242529630661, 0.5001472234725952, -0.3203883469104767, -0.7366631031036377, -0.4813337028026581, 0.60580658912658...
func (db *DB) SetDrop(ctx context.Context, drop *jetdrop.JetDrop) error { k := prefixkey(scopeIDJetDrop, drop.Pulse.Bytes()) _, err := db.get(ctx, k) if err == nil { return ErrOverride } encoded, err := jetdrop.Encode(drop) if err != nil { return err } return db.set(ctx, k, encoded) }
[ -1.321171522140503, 0.518268346786499, 0.5107712745666504, 0.09240725636482239, -0.5996382832527161, 0.39043423533439636, -1.1093720197677612, -0.7058223485946655, 0.02548624575138092, 0.9065772891044617, -0.33136823773384094, 0.31175604462623596, -0.2659878730773926, 0.7276532053947449, ...
func (db *DB) AddPulse(ctx context.Context, pulse core.Pulse) error { return db.Update(ctx, func(tx *TransactionManager) error { var latest core.PulseNumber latest, err := tx.GetLatestPulseNumber(ctx) if err != nil && err != ErrNotFound { return err } pulseRec := record.PulseRecord{ PrevPulse: ...
[ -0.6035690903663635, 0.057558950036764145, 0.6006259918212891, -0.3548436760902405, 0.25945910811424255, -0.28788870573043823, -0.406546950340271, 0.5425610542297363, 0.5493886470794678, 0.293813019990921, -0.6136727929115295, -0.2240849733352661, -1.233495831489563, 0.29091307520866394, ...
func (db *DB) GetPulse(ctx context.Context, num core.PulseNumber) (*record.PulseRecord, error) { buf, err := db.get(ctx, prefixkey(scopeIDPulse, num.Bytes())) if err != nil { return nil, err } dec := codec.NewDecoder(bytes.NewReader(buf), &codec.CborHandle{}) var rec record.PulseRecord err = dec.Decode(&rec) ...
[ 0.2526925802230835, 0.9060764312744141, 0.5902193784713745, -0.07772968709468842, 0.39765873551368713, -1.1056052446365356, -0.3584703207015991, -0.20676203072071075, 0.21391673386096954, 0.10652056336402893, -0.37918180227279663, 0.3858124017715454, -1.3087313175201416, -0.268252313137054...
func (db *DB) GetLatestPulseNumber(ctx context.Context) (core.PulseNumber, error) { tx := db.BeginTransaction(false) defer tx.Discard() return tx.GetLatestPulseNumber(ctx) }
[ -0.6200997233390808, 0.07595012336969376, 0.5564126968383789, 0.4971100986003876, -0.047503337264060974, 0.5446385741233826, 0.034934625029563904, 0.48519858717918396, 0.4982817471027374, -0.28132370114326477, -1.1146925687789917, -0.026517340913414955, -0.440702885389328, 0.14930774271488...
func (db *DB) BeginTransaction(update bool) *TransactionManager { if update { db.dropWG.Add(1) } return &TransactionManager{ db: db, update: update, txupdates: make(map[string]keyval), } }
[ -0.050779618322849274, 0.12034062296152115, 0.5039036870002747, -0.4732958972454071, -1.413715124130249, -0.18805812299251556, -0.2469421923160553, 0.3122430741786957, 0.584754228591919, -0.2022038996219635, -0.41771385073661804, -0.9351722598075867, -0.7001696228981018, 0.8088987469673157...
func (db *DB) View(ctx context.Context, fn func(*TransactionManager) error) error { tx := db.BeginTransaction(false) defer tx.Discard() return fn(tx) }
[ 0.36457985639572144, 0.6760326623916626, 0.26439401507377625, -1.189072608947754, -0.8763541579246521, -0.9049966335296631, 0.10129326581954956, 0.3301418423652649, -0.20327582955360413, -0.880338728427887, 0.4407268762588501, 0.22907349467277527, 0.2778019607067108, -0.5476386547088623, ...
func (db *DB) Update(ctx context.Context, fn func(*TransactionManager) error) error { tries := db.txretiries var tx *TransactionManager var err error for { tx = db.BeginTransaction(true) err = fn(tx) if err != nil { break } err = tx.Commit() if err == nil { break } if err != badger.ErrConflict...
[ -0.4967733323574066, 0.4160608947277069, 0.6602308750152588, -0.05462025851011276, -0.3997132182121277, -0.6947551965713501, -0.35418716073036194, 0.26045888662338257, -0.21501335501670837, 0.5030444264411926, 0.31444835662841797, -0.7841917872428894, -0.6485336422920227, -0.12657688558101...
func (db *DB) GetBadgerDB() *badger.DB { return db.db }
[ -0.10155317932367325, -0.6129457354545593, 0.3205569088459015, 0.29042747616767883, 0.2129397988319397, 0.29359352588653564, 0.1679553985595703, 0.03972037509083748, 0.10545292496681213, -0.9869537353515625, -0.896764874458313, 0.6601095199584961, -1.4631550312042236, 1.2442936897277832, ...
func (db *DB) SetMessage(ctx context.Context, pulseNumber core.PulseNumber, genericMessage core.Message) error { messageBytes := message.ToBytes(genericMessage) hw := db.PlatformCryptographyScheme.ReferenceHasher() _, err := hw.Write(messageBytes) if err != nil { return err } hw.Sum(nil) return db.set( ctx,...
[ -0.8520200848579407, 0.8451582193374634, 0.618085503578186, -0.30200624465942383, 0.8126264810562134, 0.4201110005378723, 0.3244500756263733, -0.13086238503456116, 0.36827588081359863, 0.8176978826522827, -0.8124990463256836, 0.2678786814212799, -1.2233035564422607, 1.009238600730896, 0....
func (db *DB) SetLocalData(ctx context.Context, pulse core.PulseNumber, key []byte, data []byte) error { return db.set( ctx, bytes.Join([][]byte{{scopeIDLocal}, pulse.Bytes(), key}, nil), data, ) }
[ -0.21265628933906555, 0.10670091956853867, 0.26164886355400085, -0.8430228233337402, -0.7375341653823853, 0.603717029094696, -1.0889207124710083, 0.6214926242828369, 0.6463704109191895, 0.8539718985557556, -1.4994926452636719, 0.7616559863090515, -0.8609699606895447, 0.23576779663562775, ...
func (db *DB) GetLocalData(ctx context.Context, pulse core.PulseNumber, key []byte) ([]byte, error) { return db.get( ctx, bytes.Join([][]byte{{scopeIDLocal}, pulse.Bytes(), key}, nil), ) }
[ 0.08290936797857285, 0.5245382189750671, 0.41852593421936035, -0.41099458932876587, -0.8042178750038147, 0.2933715283870697, -1.045232892036438, 0.38397514820098877, 0.8293918967247009, 0.9886701107025146, -0.9527458548545837, 1.1490861177444458, -1.0361295938491821, 0.07283692806959152, ...
func (db *DB) IterateLocalData(ctx context.Context, pulse core.PulseNumber, prefix []byte, handler func(k, v []byte) error) error { fullPrefix := bytes.Join([][]byte{{scopeIDLocal}, pulse.Bytes(), prefix}, nil) return db.db.View(func(txn *badger.Txn) error { it := txn.NewIterator(badger.DefaultIteratorOptions) d...
[ -0.3503545820713043, -0.36459630727767944, 0.28986436128616333, -0.6597515940666199, -0.8689243793487549, -0.08817090094089508, -0.4738317131996155, 0.5073647499084473, -0.014845686964690685, 0.5263450741767883, -0.3370511829853058, 0.7424792051315308, 0.09648260474205017, 0.17867471277713...
func (db *DB) SetActiveNodes(pulse core.PulseNumber, nodes []core.Node) error { db.nodeHistoryLock.Lock() defer db.nodeHistoryLock.Unlock() if _, ok := db.nodeHistory[pulse]; ok { return errors.New("node history override is forbidden") } db.nodeHistory[pulse] = nodes return nil }
[ -0.6447336077690125, 0.2812327742576599, 0.37079089879989624, -0.5212299823760986, 0.26860183477401733, -0.2372918725013733, 0.6207361221313477, 0.34316086769104004, 0.0990176722407341, 0.17588922381401062, -1.1907203197479248, 0.808391273021698, -0.9646148681640625, -0.3190930485725403, ...
func (db *DB) GetActiveNodes(pulse core.PulseNumber) ([]core.Node, error) { nodes, ok := db.nodeHistory[pulse] if !ok { return nil, errors.New("no nodes for this pulse") } return nodes, nil }
[ -0.7550975680351257, -0.014222011901438236, 0.32793331146240234, -0.097099170088768, 0.626473605632782, -0.6266074776649475, 0.1895788162946701, 0.4925265312194824, 0.5243751406669617, 0.043235428631305695, -0.8324360251426697, 1.1347370147705078, -0.9377354383468628, -0.1973210871219635, ...
func (db *DB) get(ctx context.Context, key []byte) ([]byte, error) { tx := db.BeginTransaction(false) defer tx.Discard() return tx.get(ctx, key) }
[ -0.29512888193130493, 0.864872395992279, 0.4947999119758606, -0.39899060130119324, -0.21671153604984283, -0.7036556005477905, -1.260933518409729, -0.4619913399219513, -0.34089311957359314, 0.7076130509376526, -0.4150274395942688, 0.44668957591056824, -0.9364095330238342, -0.506985127925872...
func (db *DB) set(ctx context.Context, key, value []byte) error { return db.Update(ctx, func(tx *TransactionManager) error { return tx.set(ctx, key, value) }) }
[ -0.2518974542617798, 0.654100239276886, 0.3861432373523712, -0.24831965565681458, -0.819403886795044, -0.3394952416419983, -0.8905190825462341, -0.412771999835968, -0.3193439841270447, 0.9780079126358032, -0.6134364604949951, -0.38444092869758606, -0.6320767998695374, 0.22693634033203125, ...
func NewLogrConfig() Config { return Config{ Level: "info", Location: "stdout", Type: "text", } }
[ 0.16891835629940033, -0.5940101146697998, 0.4583418071269989, -0.7238436341285706, -1.3312852382659912, -0.5945877432823181, -1.0433391332626343, 0.4855060875415802, -0.7139405012130737, 0.12314733117818832, -0.5371007919311523, 0.23059146106243134, 0.30172938108444214, 0.8376855254173279,...
func WithField(k string, v interface{}) *logrus.Entry { return Logr.WithField(k, v) }
[ 0.6241461634635925, 0.0007963934913277626, 0.3610000014305115, -1.0293275117874146, -0.7532588243484497, 0.24558602273464203, -0.6335945129394531, -0.4351692795753479, -0.10420380532741547, 0.016667157411575317, 0.17709530889987946, 0.44009700417518616, 0.2189817875623703, -0.1783606559038...
func NewLogr(conf Config) error { // Set up the logger var makeErr error makelogr := func() { Logr, makeErr = initLogr(conf) if makeErr != nil { fmt.Println(makeErr) } } once.Do(makelogr) if Logr == nil || makeErr != nil { return fmt.Errorf("Could not instantiate the logr") } return nil }
[ 0.20839355885982513, -0.47993776202201843, 0.18427234888076782, 0.1529015749692917, -0.28365418314933777, -0.3425807058811188, -0.32167330384254456, 0.2660306394100189, -0.3971059322357178, -0.3025967478752136, -0.4780682623386383, -0.03517341613769531, -0.5774277448654175, 1.2770427465438...