text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *Context) export() map[string]interface{} {
m := map[string]interface{}{}
if c.outer != nil {
for k, v := range c.outer.export() {
m[k] = v
}
}
for k, v := range c.data {
m[k] = v
}
return m
} | [
-0.5403732657432556,
-0.46687665581703186,
0.5428388714790344,
-0.2656204402446747,
-1.4104083776474,
-0.05019073560833931,
-0.18663597106933594,
-0.24232344329357147,
0.13775812089443207,
0.11578734964132309,
-0.12997959554195404,
0.42496487498283386,
-0.4118109345436096,
0.95497745275497... |
func NewContext() *Context {
return NewContextWith(map[string]interface{}{})
} | [
0.3045230507850647,
-1.056869626045227,
0.25113868713378906,
0.7647005915641785,
-0.7155081033706665,
-0.32520583271980286,
-0.4384778141975403,
-0.6662882566452026,
0.9602881669998169,
-0.5771800875663757,
-0.2522403597831726,
0.21661537885665894,
0.22894418239593506,
-0.12718845903873444... |
func NewContextWith(data map[string]interface{}) *Context {
c := &Context{
Context: context.Background(),
data: data,
outer: nil,
moot: &sync.Mutex{},
}
for k, v := range Helpers.helpers {
if !c.Has(k) {
c.Set(k, v)
}
}
return c
} | [
0.3637829124927521,
-1.0088046789169312,
0.44231101870536804,
0.4676569402217865,
-0.8012482523918152,
-0.3480396270751953,
-0.34844353795051575,
-0.9452415108680725,
0.07110168784856796,
0.16691558063030243,
0.21064694225788116,
-0.09125325083732605,
-0.014312504790723324,
0.5689230561256... |
func NewContextWithOuter(data map[string]interface{}, out *Context) *Context {
c := &Context{
Context: context.Background(),
data: data,
outer: out,
moot: &sync.Mutex{},
}
for k, v := range Helpers.helpers {
if !c.Has(k) && !c.outer.Has(k) {
c.Set(k, v)
}
}
return c
} | [
0.219406396150589,
-0.8194179534912109,
0.3544727861881256,
0.1248655840754509,
-1.6570923328399658,
0.24666866660118103,
-0.04667649045586586,
-0.47812947630882263,
-0.09156230092048645,
0.01331894751638174,
0.47032955288887024,
-0.04648187384009361,
-0.15144039690494537,
0.67129677534103... |
func NewContextWithContext(ctx context.Context) *Context {
c := NewContext()
c.Context = ctx
return c
} | [
0.4122944474220276,
-0.7561581134796143,
-0.010880500078201294,
0.76189124584198,
-1.2041593790054321,
-0.19802050292491913,
-0.7810143232345581,
-1.2221242189407349,
1.6899380683898926,
-0.27427247166633606,
-0.820734977722168,
-0.6034404039382935,
-0.02049061469733715,
-0.206515640020370... |
func (s *OtsService) convertPrimaryKeyType(t tablestore.PrimaryKeyType) PrimaryKeyTypeString {
var typeString PrimaryKeyTypeString
switch t {
case tablestore.PrimaryKeyType_INTEGER:
typeString = IntegerType
case tablestore.PrimaryKeyType_BINARY:
typeString = BinaryType
case tablestore.PrimaryKeyType_STRING:
... | [
-0.6482669711112976,
-0.9784913659095764,
0.05976356565952301,
-0.08167577534914017,
-0.6405243873596191,
-0.14770497381687164,
-0.6731078028678894,
-0.8296670317649841,
0.97816002368927,
1.0173779726028442,
-0.33816996216773987,
-0.13811729848384857,
-0.8915320038795471,
0.935583949089050... |
func RegisterOcpTeamApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OcpTeamApiServer) error {
mux.Handle("POST", pattern_OcpTeamApi_CreateTeamV1_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
v... | [
-1.4039742946624756,
-0.42472392320632935,
0.8696084022521973,
-0.3743923306465149,
0.3758140504360199,
0.4032718539237976,
0.2983461320400238,
-0.8624388575553894,
-0.8922563195228577,
-0.15466178953647614,
-0.37077370285987854,
0.16135968267917633,
-0.2816700339317322,
0.2740712165832519... |
func RegisterOcpTeamApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed ... | [
-0.721491277217865,
-0.880122184753418,
0.8594141602516174,
0.12034285068511963,
-0.2212573140859604,
0.5018858313560486,
-0.10846834629774094,
-0.6430572271347046,
-0.019221285358071327,
0.42839303612709045,
0.3736312687397003,
-0.42315900325775146,
-0.6006277799606323,
-0.472593456506729... |
func RegisterOcpTeamApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOcpTeamApiHandlerClient(ctx, mux, NewOcpTeamApiClient(conn))
} | [
-0.8602344393730164,
-0.9546317458152771,
0.3061286509037018,
-0.6833569407463074,
-0.06577938795089722,
0.5298944115638733,
0.10457281768321991,
-0.0008075035875663161,
0.30378031730651855,
0.16061437129974365,
-0.012591657228767872,
-0.07458832859992981,
-0.35911819338798523,
-0.39530363... |
func RegisterOcpTeamApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OcpTeamApiClient) error {
mux.Handle("POST", pattern_OcpTeamApi_CreateTeamV1_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
i... | [
-0.9795482754707336,
-0.3888014554977417,
0.8081080317497253,
-0.4288918077945709,
-0.0833747535943985,
0.633729100227356,
0.371730238199234,
-0.9578752517700195,
-0.8245392441749573,
-0.05084339529275894,
-0.429644376039505,
-0.06627631187438965,
0.21770061552524567,
-0.20450738072395325,... |
func (s WeworkSender) Ready() bool {
if s.InfoKey != "" && s.WarnKey != "" && s.ErrorKey != "" {
return true
}
return false
} | [
-0.6666094064712524,
0.18814495205879211,
0.5882845520973206,
-0.2155599445104599,
-0.3845787048339844,
-0.13696640729904175,
-0.6949867606163025,
0.6910384297370911,
-0.7559277415275574,
0.9408557415008545,
-1.0858021974563599,
0.27323994040489197,
-0.2828487455844879,
1.1041053533554077,... |
func (s WeworkSender) SendRobotMsg(key, tp, content string) error {
var msg = &RobotMsg{
MsgType: tp,
}
switch tp {
case "text":
msg.Text = &MsgText{Content: content}
case "markdown":
msg.MarkDown = &MsgMarkdown{Content: content}
}
_, err := grequests.Post(s.BaseURL+key, &grequests.RequestOptions{
JSON: ... | [
-1.1160297393798828,
0.458759069442749,
0.4879341423511505,
-0.2383492887020111,
0.08373549580574036,
0.5299512147903442,
-0.539365828037262,
-0.7985590696334839,
-1.431627631187439,
0.7434638142585754,
-0.27682363986968994,
0.22421178221702576,
-1.1049730777740479,
1.3350064754486084,
-... |
func BenchmarkFormatCompareHTMLFmt(b *testing.B) {
for i := 0; i < b.N; i++ {
f := New()
r := strings.NewReader(benchmarkHTML)
var buf bytes.Buffer
err := f.Format(&buf, r)
if err != nil {
b.Fatal(err)
}
}
} | [
1.0943241119384766,
0.15989618003368378,
0.3463916778564453,
-0.027624359354376793,
1.0033855438232422,
-0.27970004081726074,
0.3758092224597931,
-1.0725196599960327,
-0.6503433585166931,
0.1810949593782425,
0.5650144815444946,
-0.0278102345764637,
-0.37250208854675293,
1.1143442392349243,... |
func AddRules(r lint.RuleRegistry) error {
return r.Register(
123,
duplicateResource,
resourceAnnotation,
resourceNameField,
resourcePattern,
resourceReferenceType,
resourceVariables,
)
} | [
0.07350167632102966,
0.35988152027130127,
0.3082753121852875,
-0.6288236379623413,
0.9231589436531067,
0.9962308406829834,
0.2341279685497284,
-0.1410277783870697,
0.5080532431602478,
-0.1710815727710724,
-0.34219032526016235,
0.2965089678764343,
-0.5142182111740112,
0.5294144749641418,
... |
func getDesiredPattern(pattern string) string {
want := []string{}
for _, token := range strings.Split(pattern, "/") {
if strings.HasPrefix(token, "{") && strings.HasSuffix(token, "}") {
varname := token[1 : len(token)-1]
want = append(want, fmt.Sprintf("{%s}", strings.TrimSuffix(strcase.SnakeCase(varname), "... | [
-0.9181249737739563,
-0.14443272352218628,
0.6862514615058899,
-0.8230733871459961,
-0.14932475984096527,
-0.27096399664878845,
-0.512287437915802,
-0.13360467553138733,
-0.0277569517493248,
-0.29427406191825867,
-0.24054354429244995,
0.5128687024116516,
0.06046880781650543,
-0.33314025402... |
func NewLoraNetworkTrigger(version int32, ) *LoraNetworkTrigger {
this := LoraNetworkTrigger{}
this.Version = version
return &this
} | [
-0.6652634739875793,
-0.3697061240673065,
0.13846658170223236,
-0.6827420592308044,
-0.3511316180229187,
0.1956551969051361,
-0.8453752994537354,
-0.09994173049926758,
-0.3913211226463318,
-1.3468157052993774,
-1.8611013889312744,
-0.9473488330841064,
-0.748717725276947,
-0.521226108074188... |
func NewLoraNetworkTriggerWithDefaults() *LoraNetworkTrigger {
this := LoraNetworkTrigger{}
return &this
} | [
-0.2622338831424713,
0.20692598819732666,
-0.028419194743037224,
-0.2733175754547119,
0.9635202288627625,
-0.4079676568508148,
-1.1901506185531616,
-0.6677706837654114,
-0.4000297486782074,
-1.7441208362579346,
-1.6044912338256836,
-1.586960792541504,
-0.777448832988739,
-0.398749530315399... |
func (o *LoraNetworkTrigger) GetFilter() LoraNetworkFilter {
if o == nil || o.Filter == nil {
var ret LoraNetworkFilter
return ret
}
return *o.Filter
} | [
-0.20082111656665802,
0.4723967909812927,
0.26671189069747925,
0.7101525664329529,
-0.40579670667648315,
-0.3708711862564087,
0.5673225522041321,
-0.8016393780708313,
0.5832045078277588,
-1.4225728511810303,
-0.6198540329933167,
-1.0979677438735962,
-0.913948655128479,
0.670055091381073,
... |
func (o *LoraNetworkTrigger) GetFilterOk() (*LoraNetworkFilter, bool) {
if o == nil || o.Filter == nil {
return nil, false
}
return o.Filter, true
} | [
0.19773873686790466,
-0.2604432702064514,
0.4076971411705017,
0.5165495276451111,
-0.43203943967819214,
-0.13574422895908356,
0.6449509263038635,
0.10414531826972961,
-0.08186058700084686,
0.4850608706474304,
-0.9163872003555298,
-0.03628476709127426,
0.0804508700966835,
0.5872129201889038... |
func (o *LoraNetworkTrigger) HasFilter() bool {
if o != nil && o.Filter != nil {
return true
}
return false
} | [
0.3283662796020508,
0.3340413570404053,
0.14355520904064178,
0.5615766644477844,
0.23858247697353363,
-0.4418286085128784,
0.08151081949472427,
0.6285634636878967,
-0.0399659238755703,
-1.4947282075881958,
-0.7819671630859375,
-0.4716590642929077,
-0.17902810871601105,
0.4267009198665619,
... |
func (o *LoraNetworkTrigger) SetFilter(v LoraNetworkFilter) {
o.Filter = &v
} | [
-0.098560631275177,
0.08435988426208496,
-0.3189499080181122,
0.02238655276596546,
-0.5466879606246948,
-0.06339940428733826,
-0.6916608810424805,
-1.3086397647857666,
-0.056507501751184464,
-0.6743075847625732,
-0.5972763299942017,
0.20838019251823425,
-0.11319003999233246,
-0.06933234632... |
func (o *LoraNetworkTrigger) GetVersion() int32 {
if o == nil {
var ret int32
return ret
}
return o.Version
} | [
0.42084500193595886,
0.16776984930038452,
0.07819423824548721,
0.7360991835594177,
0.4025850296020508,
0.8241230845451355,
1.4723641872406006,
-0.2492331564426422,
0.2683354318141937,
-0.6584863662719727,
-0.838931679725647,
-1.1303149461746216,
-0.5501993298530579,
-0.3188304901123047,
... |
func (o *LoraNetworkTrigger) GetVersionOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.Version, true
} | [
-0.020485101267695427,
-0.13098740577697754,
0.4038264751434326,
0.8639233708381653,
-0.1006689965724945,
0.6031553149223328,
0.9968274235725403,
0.49608805775642395,
-0.2837825119495392,
1.2098332643508911,
-1.4215545654296875,
-1.1970787048339844,
0.4127860963344574,
0.10724980384111404,... |
func (o *LoraNetworkTrigger) SetVersion(v int32) {
o.Version = v
} | [
0.10566803812980652,
0.24613866209983826,
0.06028800085186958,
0.0827127993106842,
0.14427505433559418,
0.8668714165687561,
0.6707921028137207,
-0.2505338191986084,
-0.10223748534917831,
0.14491070806980133,
-1.9747717380523682,
-0.9110360145568848,
-0.26050201058387756,
-0.230530276894569... |
func RequestClientIP(req *http.Request) (net.IP, error) {
realIp := req.Header.Get("X-Real-IP")
// ip, _, err := net.SplitHostPort(req.RemoteAddr)
// if err != nil {
// return nil, fmt.Errorf("userip: %q is not IP:port", req.RemoteAddr)
// }
//
// userIP := net.ParseIP(ip)
// if userIP == nil {
// return nil... | [
-0.25378504395484924,
-0.4303850829601288,
0.7013891339302063,
0.5212839245796204,
-0.7446073889732361,
-0.3136998116970062,
0.78411865234375,
-0.5355809926986694,
0.287137895822525,
-0.36370009183883667,
0.5737443566322327,
-0.046473100781440735,
-0.1344483643770218,
-0.6881377696990967,
... |
func (o *RevokeTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRevokeTokenOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 4... | [
0.6304548978805542,
-0.963904082775116,
0.7308149337768555,
0.07718753069639206,
0.16189421713352203,
-1.1338356733322144,
-0.3590414226055145,
-0.20487767457962036,
0.47339311242103577,
0.291959673166275,
0.40925681591033936,
-0.1684132069349289,
-0.8672135472297668,
-0.494304358959198,
... |
func NewRevokeTokenOK() *RevokeTokenOK {
return &RevokeTokenOK{}
} | [
0.8116737008094788,
-0.5477697849273682,
0.3135759234428406,
1.3428171873092651,
-0.5051601529121399,
-0.8988495469093323,
-0.4555095434188843,
1.4186228513717651,
-0.5402901768684387,
-0.025587650015950203,
-0.8968225121498108,
0.6882168054580688,
0.9458205699920654,
-0.000298832164844498... |
func NewRevokeTokenBadRequest() *RevokeTokenBadRequest {
return &RevokeTokenBadRequest{}
} | [
0.9891566038131714,
-0.815093994140625,
0.47172826528549194,
1.0744938850402832,
0.10661858320236206,
-0.7699187994003296,
-1.3663725852966309,
1.531804084777832,
-0.42911770939826965,
-0.37266966700553894,
-0.1771402657032013,
1.299647331237793,
-0.2157515585422516,
0.5571995377540588,
... |
func NewRevokeTokenUnauthorized() *RevokeTokenUnauthorized {
return &RevokeTokenUnauthorized{}
} | [
0.24196700751781464,
-0.9113633632659912,
0.31430697441101074,
0.34191760420799255,
0.1595507711172104,
-0.646956205368042,
-0.8137401342391968,
1.6065422296524048,
0.14789579808712006,
-0.9589316248893738,
-0.9147160649299622,
1.9339081048965454,
0.7444099187850952,
0.0306007768958807,
... |
func isNotInMainChainErr(err error) bool {
_, ok := err.(errNotInMainChain)
return ok
} | [
-0.9246296286582947,
-1.0257543325424194,
0.254893034696579,
0.23542338609695435,
-0.45505937933921814,
-0.0339830219745636,
-0.4063776135444641,
-0.6462410092353821,
0.11072338372468948,
0.21484486758708954,
0.13150717318058014,
0.0012881888542324305,
-1.399202585220337,
1.473734974861145... |
func dbFetchVersion(dbTx database.Tx, key []byte) uint32 {
serialized := dbTx.Metadata().Get(key)
if serialized == nil {
return 0
}
return byteOrder.Uint32(serialized[:])
} | [
0.15544667840003967,
0.9546359181404114,
0.5831430554389954,
-0.15029355883598328,
-0.5330814123153687,
0.05002649500966072,
-1.0312548875808716,
-0.7427477836608887,
-0.09144838154315948,
0.8746009469032288,
-0.618409276008606,
0.38042670488357544,
-0.22617514431476593,
0.5298112034797668... |
func dbPutVersion(dbTx database.Tx, key []byte, version uint32) error {
var serialized [4]byte
byteOrder.PutUint32(serialized[:], version)
return dbTx.Metadata().Put(key, serialized[:])
} | [
-0.7988119721412659,
0.7521264553070068,
0.46642518043518066,
-0.30805185437202454,
-0.12482285499572754,
0.34379851818084717,
-0.39996957778930664,
0.055548667907714844,
-0.25780627131462097,
1.5748655796051025,
-1.6100574731826782,
-0.5129055976867676,
-1.105393648147583,
-0.423823058605... |
func dbFetchOrCreateVersion(dbTx database.Tx, key []byte, defaultVersion uint32) (uint32, error) {
version := dbFetchVersion(dbTx, key)
if version == 0 {
version = defaultVersion
err := dbPutVersion(dbTx, key, version)
if err != nil {
return 0, err
}
}
return version, nil
} | [
-0.14349566400051117,
1.0623395442962646,
0.46685585379600525,
0.3359224796295166,
-0.05973401665687561,
0.5854870080947876,
-0.5182345509529114,
-0.3297368884086609,
0.11249908804893494,
0.8637125492095947,
-0.48724865913391113,
-0.8692432641983032,
-0.22178024053573608,
0.609352648258209... |
func (b *BlockChain) FetchSpendJournal(targetBlock *asiutil.Block, targetvblock *asiutil.VBlock) ([]txo.SpentTxOut, error) {
b.chainLock.RLock()
defer b.chainLock.RUnlock()
var spendEntries []txo.SpentTxOut
err := b.db.View(func(dbTx database.Tx) error {
var err error
spendEntries, err = dbFetchSpendJournalEnt... | [
0.37856653332710266,
-0.3652733564376831,
0.4697074294090271,
0.039626672863960266,
-0.3967713713645935,
-0.46984562277793884,
-0.3421693444252014,
0.1946146935224533,
-0.15353597700595856,
1.3052970170974731,
-0.023561613634228706,
0.6355328559875488,
-0.5098798274993896,
0.76085507869720... |
func SpentTxOutHeaderCode(stxo *txo.SpentTxOut) uint64 {
// As described in the serialization format comments, the header code
// encodes the height shifted over one bit and the coinbase flag in the
// lowest bit.
headerCode := uint64(stxo.Height) << 1
if stxo.IsCoinBase {
headerCode |= 0x01
}
return headerCo... | [
0.030515259131789207,
-0.9066357016563416,
0.45500025153160095,
-0.197052463889122,
-0.3707456886768341,
-0.07935261726379395,
0.7955478429794312,
-1.1384222507476807,
0.0814884677529335,
0.44670769572257996,
-0.4145781099796295,
0.3003671169281006,
-0.15553486347198486,
0.0485991202294826... |
func SpentTxOutSerializeSize(stxo *txo.SpentTxOut) int {
size := serializeSizeVLQ(SpentTxOutHeaderCode(stxo))
return size + compressedTxOutSize(uint64(stxo.Amount), stxo.PkScript, stxo.Asset)
} | [
0.2864404618740082,
-0.40663355588912964,
0.3283216655254364,
-1.2896325588226318,
-1.235762357711792,
-0.3712189197540283,
0.47417837381362915,
-0.18885576725006104,
0.5190845727920532,
0.2900010049343109,
-0.45416387915611267,
0.140370175242424,
-0.3722115457057953,
-0.3425382971763611,
... |
func putSpentTxOut(target []byte, stxo *txo.SpentTxOut) int {
headerCode := SpentTxOutHeaderCode(stxo)
offset := putVLQ(target, headerCode)
return offset + putCompressedTxOut(target[offset:], uint64(stxo.Amount),
stxo.PkScript, stxo.Asset)
} | [
0.12142274528741837,
-0.3637882173061371,
0.46234142780303955,
-1.1478222608566284,
-1.0460155010223389,
-0.47176966071128845,
0.32396602630615234,
-0.09623077511787415,
0.09560994803905487,
1.0080738067626953,
-1.0765069723129272,
0.5423697829246521,
-0.5027151107788086,
-0.84184139966964... |
func decodeSpentTxOut(serialized []byte, stxo *txo.SpentTxOut) (int, error) {
// Ensure there are bytes to decode.
if len(serialized) == 0 {
return 0, common.DeserializeError("no serialized bytes")
}
// Deserialize the header code.
code, offset := deserializeVLQ(serialized)
if offset >= len(serialized) {
ret... | [
0.5259726047515869,
-0.5298315286636353,
0.5818676352500916,
-0.6507939696311951,
-0.9710959196090698,
-1.1568535566329956,
0.36969950795173645,
0.1889873445034027,
-0.4573676884174347,
0.47561317682266235,
-0.788749635219574,
-0.041386090219020844,
-0.5597754716873169,
-0.6664826273918152... |
func deserializeSpendJournalEntry(serialized []byte, txns []*protos.MsgTx, vtxns []*protos.MsgTx) ([]txo.SpentTxOut, error) {
// Calculate the total number of stxos.
var numStxos int
for _, tx := range txns {
numStxos += len(tx.TxIn)
}
for _, tx := range vtxns {
for _, txin := range tx.TxIn {
if asiutil.IsM... | [
0.7106916904449463,
-0.5673109889030457,
0.49848929047584534,
-0.5579940676689148,
-0.31864482164382935,
-1.0811272859573364,
0.24291889369487762,
-0.2437627762556076,
0.050822701305150986,
0.5660131573677063,
-0.2161942720413208,
-0.014022713527083397,
-0.8007087707519531,
-0.066092558205... |
func serializeSpendJournalEntry(stxos []txo.SpentTxOut) []byte {
if len(stxos) == 0 {
return nil
}
// Calculate the size needed to serialize the entire journal entry.
var size int
for i := range stxos {
size += SpentTxOutSerializeSize(&stxos[i])
}
serialized := make([]byte, size)
// Serialize each individ... | [
0.036957040429115295,
-0.296376496553421,
0.4573543071746826,
-0.2607186436653137,
-0.4714809060096741,
-0.5945974588394165,
0.10355806350708008,
-0.8752660751342773,
0.017363479360938072,
0.9492011070251465,
-0.4568064212799072,
0.47097301483154297,
-0.5179410576820374,
0.3321225643157959... |
func dbFetchSpendJournalEntry(dbTx database.Tx, block *asiutil.Block, vblock *asiutil.VBlock) ([]txo.SpentTxOut, error) {
// Exclude the coinbase transaction since it can't spend anything.
spendBucket := dbTx.Metadata().Bucket(spendJournalBucketName)
serialized := spendBucket.Get(block.Hash()[:])
coinbaseIdx := len... | [
0.5513866543769836,
0.07240346819162369,
0.44638633728027344,
-0.4088400900363922,
-0.1521562784910202,
-1.1666364669799805,
-0.3012531101703644,
-0.4250491261482239,
-0.10110116004943848,
1.3531510829925537,
-0.14372964203357697,
0.21714812517166138,
-0.5337246656417847,
0.527423083782196... |
func dbPutSpendJournalEntry(dbTx database.Tx, blockHash *common.Hash, stxos []txo.SpentTxOut) error {
spendBucket := dbTx.Metadata().Bucket(spendJournalBucketName)
serialized := serializeSpendJournalEntry(stxos)
return spendBucket.Put(blockHash[:], serialized)
} | [
0.6312752962112427,
0.1770705282688141,
0.39513224363327026,
-0.6232583522796631,
-0.008133377879858017,
0.019135816022753716,
0.16834311187267303,
0.06641818583011627,
-0.09802836924791336,
0.7033491134643555,
-0.9581633806228638,
0.32427018880844116,
-0.40130409598350525,
0.2683683633804... |
func dbRemoveSpendJournalEntry(dbTx database.Tx, blockHash *common.Hash) error {
spendBucket := dbTx.Metadata().Bucket(spendJournalBucketName)
return spendBucket.Delete(blockHash[:])
} | [
1.144171118736267,
0.09659074246883392,
0.3113497495651245,
-0.2493208944797516,
0.006775077898055315,
-0.35763415694236755,
-0.12196602672338486,
0.6195262670516968,
-0.24319559335708618,
0.690509021282196,
-0.3008534908294678,
-0.36421945691108704,
-0.8424234986305237,
0.6473320126533508... |
func outpointKey(outpoint protos.OutPoint) *[]byte {
// A VLQ employs an MSB encoding, so they are useful not only to reduce
// the amount of storage space, but also so iteration of utxos when
// doing byte-wise comparisons will produce them in order.
key := outpointKeyPool.Get().(*[]byte)
idx := uint64(outpoint.I... | [
-0.04768451675772667,
0.2660050392150879,
0.6174221038818359,
-0.017244847491383553,
-0.2879347503185272,
-0.08864396065473557,
0.2545658349990845,
-0.9735847115516663,
0.19559310376644135,
1.1849623918533325,
0.04641148820519447,
0.016925588250160217,
-0.7779015898704529,
-0.5191596150398... |
func recycleOutpointKey(key *[]byte) {
outpointKeyPool.Put(key)
} | [
-0.854080080986023,
0.13392750918865204,
0.3105892837047577,
-0.1414272040128708,
-0.4665234684944153,
0.6665357947349548,
0.16038241982460022,
-0.19801869988441467,
0.09773575514554977,
1.80384361743927,
-0.18984103202819824,
0.31336846947669983,
-0.4965607821941376,
-0.2579255998134613,
... |
func utxoEntryHeaderCode(entry *txo.UtxoEntry) (uint64, error) {
if entry.IsSpent() {
return 0, common.AssertError("entry has already been spent")
}
// As described in the serialization format comments, the header code
// encodes the height shifted over one bit and the coinbase flag in the
// lowest bit.
heade... | [
-0.15318867564201355,
-0.42043787240982056,
0.5101810693740845,
0.21276098489761353,
0.04679650068283081,
-0.19998081028461456,
0.7063155174255371,
-0.6017570495605469,
0.011676167137920856,
0.9772926568984985,
0.25738537311553955,
-0.2393481433391571,
-0.3429427146911621,
-0.2871179580688... |
func serializeUtxoEntry(entry *txo.UtxoEntry) ([]byte, error) {
// Spent outputs have no serialization.
if entry.IsSpent() {
return nil, nil
}
// Encode the header code.
headerCode, err := utxoEntryHeaderCode(entry)
if err != nil {
return nil, err
}
// Calculate the size needed to serialize the entry.
si... | [
0.6443288326263428,
-0.3083282709121704,
0.46235549449920654,
-0.8331969380378723,
-0.27712827920913696,
-0.6704462766647339,
0.1399911344051361,
-0.5693262219429016,
0.3459998369216919,
0.8314274549484253,
-0.31840187311172485,
-0.0950518548488617,
-0.10197574645280838,
-0.005434953141957... |
func DeserializeUtxoEntry(serialized []byte) (*txo.UtxoEntry, error) {
// Deserialize the header code.
code, offset := deserializeVLQ(serialized)
if offset >= len(serialized) {
return nil, common.DeserializeError("unexpected end of data after header")
}
// Decode the header code.
//
// Bit 0 indicates whether... | [
0.9739411473274231,
-0.2624526917934418,
0.4490182399749756,
-0.8124512434005737,
-0.5506824254989624,
-0.9077272415161133,
-0.03470504283905029,
0.015585028566420078,
-0.1882794201374054,
0.26997143030166626,
-0.32161304354667664,
-0.5337077975273132,
-0.14817987382411957,
-0.839848697185... |
func dbFetchUtxoEntry(dbTx database.Tx, outpoint protos.OutPoint) (*txo.UtxoEntry, error) {
// Fetch the unspent transaction output information for the passed
// transaction output. Return now when there is no entry.
key := outpointKey(outpoint)
utxoBucket := dbTx.Metadata().Bucket(utxoSetBucketName)
serializedUt... | [
0.50432288646698,
0.12307725846767426,
0.4114329218864441,
-0.6033785343170166,
-0.4888187348842621,
-0.1794889122247696,
0.00652150297537446,
-0.6188791990280151,
0.1224256306886673,
0.31655430793762207,
0.2879073917865753,
0.02428251877427101,
-0.20678581297397614,
-0.7238615155220032,
... |
func dbPutUtxoView(dbTx database.Tx, view *txo.UtxoViewpoint) error {
utxoBucket := dbTx.Metadata().Bucket(utxoSetBucketName)
for outpoint, entry := range view.Entries() {
// No need to update the database if the entry was not modified.
if entry == nil || !entry.IsModified() {
continue
}
// Remove the utx... | [
-0.946518063545227,
0.7947626113891602,
0.5279049277305603,
-0.6612204909324646,
-0.735179603099823,
-0.35091277956962585,
0.3132953643798828,
0.026311641559004784,
0.19035598635673523,
0.5005901455879211,
-0.06169484928250313,
-0.32668203115463257,
0.11724070459604263,
-0.5281252264976501... |
func dbFetchLockItem(dbTx database.Tx, outpoint protos.OutPoint) (*txo.LockItem, error) {
key := outpointKey(outpoint)
lockItem, err := dbFetchLockItemWithKey(dbTx, *key)
recycleOutpointKey(key)
return lockItem, err
} | [
0.0912371575832367,
0.5695310831069946,
0.21316352486610413,
0.4947322905063629,
-0.8382022976875305,
0.7892952561378479,
-0.9536532759666443,
-0.344919890165329,
0.1701192557811737,
0.5213215351104736,
-0.041330594569444656,
0.2845240533351898,
-0.2744336426258087,
-0.6989097595214844,
... |
func dbFetchLockItemWithKey(dbTx database.Tx, key []byte) (*txo.LockItem, error) {
// Fetch the unspent transaction output information for the passed
// transaction output. Return now when there is no entry.
lockBucket := dbTx.Metadata().Bucket(lockSetBucketName)
serializedLockItem := lockBucket.Get(key)
if seria... | [
0.14018429815769196,
0.15218396484851837,
0.37526074051856995,
0.04364119842648506,
-0.6271748542785645,
-0.012478861957788467,
-1.0190080404281616,
-0.6359214186668396,
0.09036543220281601,
0.3475587069988251,
0.0518033541738987,
-0.2351233959197998,
-0.498443603515625,
-0.233578339219093... |
func dbPutLockItem(dbTx database.Tx, view *txo.UtxoViewpoint) error {
lockBucket := dbTx.Metadata().Bucket(lockSetBucketName)
for outpoint, utxoentry := range view.Entries() {
if !utxoentry.IsSpent() && utxoentry.LockItem() != nil {
key := outpointKey(outpoint)
err := lockBucket.Put(*key, utxoentry.LockItem(... | [
-0.7550506591796875,
0.6906845569610596,
0.4631368815898895,
-0.0036545926705002785,
-0.05601960048079491,
0.5088615417480469,
0.1850302666425705,
-0.2690322995185852,
0.09144864976406097,
1.0011147260665894,
-0.09466487914323807,
-0.3085165321826935,
-0.6358007788658142,
-0.80860424041748... |
func dbPutBalance(dbTx database.Tx, view *txo.UtxoViewpoint) error {
//log.Debug("dbPutBalance enter", len( view.entries ) )
balanceBucket := dbTx.Metadata().Bucket(balanceBucketName)
for outpoint, entry := range view.Entries() {
// No need to update the database if the entry was not modified.
if entry == nil ||... | [
-0.5106388926506042,
0.7243272066116333,
0.8866413831710815,
-0.419744610786438,
-0.062484655529260635,
-0.29454997181892395,
0.6963356733322144,
-0.1764960139989853,
0.5023268461227417,
1.423088550567627,
0.2985072731971741,
-0.44506537914276123,
-0.36591237783432007,
-0.05668634921312332... |
func dbHasSignature(dbTx database.Tx, sign *asiutil.BlockSign) bool {
signatureBucket := dbTx.Metadata().Bucket(signatureSetBucketName)
if signatureBucket == nil {
return false
}
buff := signatureBucket.Get(sign.Hash()[:])
if buff != nil {
return true
}
return false
} | [
0.026552284136414528,
0.3488897383213043,
0.4678204655647278,
0.6443886160850525,
-0.09279962629079819,
-0.5907087922096252,
-0.4759654700756073,
0.20729684829711914,
-0.55710768699646,
0.22929847240447998,
-1.5910664796829224,
-1.1634299755096436,
-0.35283172130584717,
0.9712820649147034,... |
func dbPutSignViewPoint(dbTx database.Tx, signs []*asiutil.BlockSign) error {
signatureBucket := dbTx.Metadata().Bucket(signatureSetBucketName)
if signatureBucket == nil {
bucket, err := dbTx.Metadata().CreateBucketIfNotExists(signatureSetBucketName)
if err != nil {
return err
}
signatureBucket = bucket
... | [
-0.0788373351097107,
0.4654698073863983,
0.6384638547897339,
-0.269601434469223,
-0.13059625029563904,
0.3295551836490631,
0.4325353503227234,
-0.7431716918945312,
-0.39704200625419617,
0.6387550234794617,
-0.42056894302368164,
-0.6644836664199829,
-0.5425449013710022,
0.4006692171096802,
... |
func dbRemoveSignature(dbTx database.Tx, hash *common.Hash) error {
signatureBucket := dbTx.Metadata().Bucket(signatureSetBucketName)
if signatureBucket == nil {
return database.Error{
ErrorCode: database.ErrBucketNotFound,
Description: fmt.Sprintf("bucket not found for %s", signatureSetBucketName),
}
}
... | [
-0.33185306191444397,
0.5515159964561462,
0.2951066493988037,
0.040998298674821854,
0.03781897947192192,
-0.5927812457084656,
-0.11047214269638062,
0.62758469581604,
-0.4168544113636017,
0.8069407939910889,
-1.2146742343902588,
-1.4274691343307495,
-0.8109482526779175,
0.12210574001073837,... |
func dbFetchBalance(dbTx database.Tx, address []byte) (*EntryPairList, error) {
var mp EntryPairList
balanceBucket := dbTx.Metadata().Bucket(balanceBucketName)
if balanceBucket == nil {
return &mp, nil
}
utxosBucket := balanceBucket.Bucket(address)
if utxosBucket == nil {
return &mp, nil
}
// deserialize ... | [
-0.08436582237482071,
0.5613366365432739,
0.7230439782142639,
-0.20245130360126495,
-0.46218833327293396,
-0.40285786986351013,
-0.4162277281284332,
-0.3596266806125641,
0.2618544101715088,
1.0475318431854248,
-0.04369865730404854,
-0.3414669930934906,
-0.10497379302978516,
0.2997214496135... |
func dbPutBlockIndex(dbTx database.Tx, hash *common.Hash, height int32) error {
// Serialize the height for use in the index entries.
var serializedHeight [4]byte
byteOrder.PutUint32(serializedHeight[:], uint32(height))
// Add the block hash to height mapping to the index.
meta := dbTx.Metadata()
hashIndex := me... | [
-0.16975724697113037,
0.6324477791786194,
0.7231675982475281,
-0.11132217198610306,
0.23061242699623108,
0.2005925476551056,
0.5716745257377625,
-0.3723902702331543,
-1.0400198698043823,
0.5036703944206238,
-1.3193848133087158,
0.06675159931182861,
-0.6978554725646973,
-0.6954154968261719,... |
func dbRemoveBlockIndex(dbTx database.Tx, hash *common.Hash, height int32) error {
// Remove the block hash to height mapping.
meta := dbTx.Metadata()
hashIndex := meta.Bucket(hashIndexBucketName)
if err := hashIndex.Delete(hash[:]); err != nil {
return err
}
return nil
} | [
0.09128907322883606,
0.5814865827560425,
0.4678383469581604,
0.1647355705499649,
-0.18404117226600647,
0.0640917718410492,
0.4357762932777405,
0.23834311962127686,
-1.1184558868408203,
0.3653281629085541,
-0.8151086568832397,
-0.5759970545768738,
-1.1053574085235596,
-0.3837261199951172,
... |
func dbFetchHeightByHash(dbTx database.Tx, hash *common.Hash) (int32, error) {
meta := dbTx.Metadata()
hashIndex := meta.Bucket(hashIndexBucketName)
serializedHeight := hashIndex.Get(hash[:])
if serializedHeight == nil {
str := fmt.Sprintf("block %s is not in the main chain", hash)
return 0, errNotInMainChain(s... | [
1.3522297143936157,
0.4823053181171417,
0.7449047565460205,
0.3770284950733185,
-0.7171380519866943,
0.31935131549835205,
-0.1254693865776062,
-1.1379364728927612,
-0.38465631008148193,
0.13087734580039978,
-0.6913211345672607,
0.04370077699422836,
-1.123878836631775,
0.34202152490615845,
... |
func serializeBestChainState(state bestChainState) []byte {
// Calculate the full size needed to serialize the chain state.
serializedLen := common.HashLength + 4 + 8
// Serialize the chain state.
serializedData := make([]byte, serializedLen)
copy(serializedData[0:common.HashLength], state.hash[:])
offset := uin... | [
0.5789934396743774,
-0.435231477022171,
0.5752988457679749,
-0.5379723906517029,
-0.2287621945142746,
-0.03850345313549042,
-0.410103440284729,
-0.8027570247650146,
0.2943950295448303,
-0.14172989130020142,
-1.2799603939056396,
0.445092111825943,
-0.051952023059129715,
-0.6665990352630615,... |
func deserializeBestChainState(serializedData []byte) (bestChainState, error) {
// Ensure the serialized data has enough bytes to properly deserialize
// the hash, height, total transactions, and work sum length.
if len(serializedData) < common.HashLength+12 {
return bestChainState{}, database.Error{
ErrorCode:... | [
0.6516303420066833,
-0.257051944732666,
0.4821820855140686,
-0.6147153973579407,
-0.5944017171859741,
-0.3276916742324829,
-0.0378037728369236,
-0.3018803596496582,
0.16170890629291534,
-0.7302045822143555,
-0.8694714307785034,
-0.3704586923122406,
-0.29106658697128296,
-1.1431397199630737... |
func dbPutBestState(dbTx database.Tx, snapshot *BestState) error {
// Serialize the current best chain state.
serializedData := serializeBestChainState(bestChainState{
hash: snapshot.Hash,
height: uint32(snapshot.Height),
totalTxns: snapshot.TotalTxns,
})
// Store the current best chain state into th... | [
-0.8684297800064087,
0.4332047700881958,
0.28087639808654785,
-0.40079575777053833,
-0.4383069574832916,
-0.3306053876876831,
-0.214726984500885,
-0.16898685693740845,
0.07664712518453598,
-0.15640540421009064,
-1.6215908527374268,
-0.3765227198600769,
0.08927279710769653,
-0.8043873310089... |
func (b *BlockChain) createChainState(chainStartTime int64) error {
// Create a new node from the genesis block and set it as the best node.
genesisBlock := asiutil.NewBlock(b.chainParams.GenesisBlock)
header := &genesisBlock.MsgBlock().Header
genesisRound := &ainterface.Round{
Round: 0,
Duration: ... | [
-0.01746026985347271,
0.23786254227161407,
0.8018193244934082,
0.05840548500418663,
0.30918166041374207,
-0.4459478259086609,
-0.455806702375412,
-0.007968158461153507,
-0.7677799463272095,
0.41086384654045105,
-0.5077620148658752,
0.46129298210144043,
-0.06962998956441879,
0.4997579455375... |
func (b *BlockChain) initChainState(chainStartTime int64) error {
// Determine the state of the chain database. We may need to initialize
// everything from scratch or upgrade certain buckets.
var initialized bool
err := b.db.View(func(dbTx database.Tx) error {
initialized = dbTx.Metadata().Get(chainStateKeyName)... | [
-0.24745091795921326,
0.010216370224952698,
0.8123050332069397,
-0.19617146253585815,
0.4836685061454773,
-0.9449214339256287,
0.1030740886926651,
-0.4998956620693207,
-0.7961315512657166,
-0.18365943431854248,
-0.663037121295929,
0.34729787707328796,
-0.058241866528987885,
-0.021323220804... |
func deserializeBlockRow(blockRow []byte) (*protos.BlockHeader, *ainterface.Round, blockStatus, error) {
buffer := bytes.NewReader(blockRow)
var header protos.BlockHeader
err := header.Deserialize(buffer)
if err != nil {
return nil, nil, statusNone, err
}
statusByte, err := buffer.ReadByte()
if err != nil {
... | [
0.37340739369392395,
-0.5230022668838501,
0.9372223615646362,
-0.058683667331933975,
-0.35007810592651367,
-0.5467094779014587,
0.32734131813049316,
-0.961956262588501,
-0.0317893922328949,
0.4363323152065277,
-0.27484065294265747,
-0.46437111496925354,
-0.6376814246177673,
0.8227064609527... |
func dbFetchHeaderByHash(dbTx database.Tx, hash *common.Hash) (*protos.BlockHeader, error) {
headerBytes, err := dbTx.FetchBlockHeader(database.NewNormalBlockKey(hash))
if err != nil {
return nil, err
}
var header protos.BlockHeader
err = header.Deserialize(bytes.NewReader(headerBytes))
if err != nil {
retur... | [
0.9512448906898499,
0.07723988592624664,
0.609341561794281,
0.4653627872467041,
-0.6681877374649048,
0.1694609671831131,
-1.1540660858154297,
-1.477647066116333,
-0.5018630623817444,
0.42332157492637634,
-0.5316671133041382,
0.24696308374404907,
-0.8177499771118164,
0.2343682050704956,
0... |
func dbFetchBlockByNode(dbTx database.Tx, node *blockNode) (*asiutil.Block, error) {
// Load the raw block bytes from the database.
blockBytes, err := dbTx.FetchBlock(database.NewNormalBlockKey(&node.hash))
if err != nil {
return nil, err
}
// Create the encapsulated block and set the height appropriately.
blo... | [
0.830258309841156,
1.0131890773773193,
0.605928897857666,
-0.3813377618789673,
-0.5384680032730103,
0.015346224419772625,
-0.31408512592315674,
-1.3873653411865234,
-0.35496559739112854,
0.313650518655777,
-0.3797852396965027,
0.4375069737434387,
0.5005525350570679,
0.39054572582244873,
... |
func dbStoreBlockNode(dbTx database.Tx, node *blockNode) error {
// Serialize block data to be stored.
size := blockHdrSize + 1
if node.status&statusFirstInRound == statusFirstInRound {
size += roundHdrDeltaSize
}
w := bytes.NewBuffer(make([]byte, 0, size))
header := node.Header()
err := header.Serialize(w)
i... | [
-0.27171680331230164,
0.49137115478515625,
0.8320185542106628,
-0.7016900181770325,
0.31882351636886597,
0.29681703448295593,
0.1722024828195572,
-0.8879028558731079,
-0.6264227032661438,
0.42014703154563904,
-0.8851590752601624,
0.40287482738494873,
-0.6388073563575745,
0.0947893112897872... |
func dbStoreBlock(dbTx database.Tx, block *asiutil.Block) error {
blockKey := database.NewNormalBlockKey(block.Hash())
hasBlock, err := dbTx.HasBlock(blockKey)
if err != nil {
return err
}
if hasBlock {
return nil
}
blockBytes, err := block.Bytes()
if err != nil {
str := fmt.Sprintf("failed to get serial... | [
0.10475801676511765,
0.885071873664856,
0.9082061052322388,
-0.24992169439792633,
0.10995087772607803,
0.008409662172198296,
0.13268406689167023,
-0.5882893204689026,
0.16670553386211395,
0.11890386790037155,
-0.9141790270805359,
-0.11285697668790817,
-0.8225536346435547,
0.319250583648681... |
func dbStoreVBlock(dbTx database.Tx, block *asiutil.VBlock) error {
blockKey := database.NewVirtualBlockKey(block.Hash())
hasBlock, err := dbTx.HasBlock(blockKey)
if err != nil {
return err
}
if hasBlock {
return nil
}
blockBytes, err := block.Bytes()
if err != nil {
str := fmt.Sprintf("failed to get ser... | [
0.08140233159065247,
0.8990402221679688,
0.7467557191848755,
-0.10665109753608704,
-0.18195025622844696,
-0.20434540510177612,
-0.443553626537323,
-0.6174556612968445,
0.7163469195365906,
0.6732655763626099,
-0.7243711948394775,
-0.2266170233488083,
-0.8197051286697388,
0.3399074077606201,... |
func blockIndexKey(blockHash *common.Hash, blockHeight uint32) []byte {
indexKey := make([]byte, common.HashLength+4)
binary.BigEndian.PutUint32(indexKey[0:4], blockHeight)
copy(indexKey[4:common.HashLength+4], blockHash[:])
return indexKey
} | [
0.2425835132598877,
0.025104884058237076,
0.5609861612319946,
0.46377167105674744,
-0.08913680166006088,
0.061812710016965866,
0.18544581532478333,
-0.8890113830566406,
-0.3778831660747528,
0.8744009733200073,
-0.9322907328605652,
0.2594950199127197,
-1.1709474325180054,
-0.431858003139495... |
func (b *BlockChain) BlockByHeight(blockHeight int32) (*asiutil.Block, error) {
// Lookup the block height in the best chain.
node := b.bestChain.NodeByHeight(blockHeight)
if node == nil {
str := fmt.Sprintf("no block node at height %d exists in the main chain", blockHeight)
return nil, errNotInMainChain(str)
}... | [
0.30609771609306335,
0.5636777281761169,
0.5286723971366882,
-0.04199676215648651,
0.06849473714828491,
-0.5473824739456177,
0.17976129055023193,
-0.8289999961853027,
-0.7271839380264282,
0.3402082026004791,
-0.35826393961906433,
0.47050940990448,
-0.7697820663452148,
-0.21103008091449738,... |
func (b *BlockChain) BlockByHash(hash *common.Hash) (*asiutil.Block, error) {
// Lookup the block hash in block index and ensure it is in the best
// chain.
node := b.index.LookupNode(hash)
if node == nil || !b.bestChain.Contains(node) {
str := fmt.Sprintf("block %s is not in the main chain", hash)
return nil, ... | [
0.4015413820743561,
0.6817744374275208,
0.5062750577926636,
0.07825422286987305,
0.04269459843635559,
-0.2837687134742737,
0.20390915870666504,
-0.650275707244873,
-0.1260974258184433,
-0.08794409781694412,
0.10911143571138382,
0.4546930491924286,
-0.7325685024261475,
-0.35338103771209717,... |
func (hdl *DefaultController) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
http.Redirect(resp, req, "/reviews", http.StatusPermanentRedirect)
log.Printf("defaultController: serving redirect")
} | [
0.39696601033210754,
-0.014716487377882004,
0.529851496219635,
0.4029916524887085,
0.6540746688842773,
1.302560806274414,
0.14008420705795288,
0.3439643383026123,
-0.3746650218963623,
0.047006841748952866,
0.4326399862766266,
-0.33745214343070984,
-0.5347504615783691,
-0.02096720039844513,... |
func NewRealClock() Clock {
return &realClock{}
} | [
0.7100204825401306,
-0.7594801783561707,
0.0860959142446518,
0.0765298455953598,
-1.2167936563491821,
-0.7754518985748291,
0.08260923624038696,
0.34323379397392273,
0.47491946816444397,
-0.7378649115562439,
-1.2289048433303833,
0.1767663210630417,
-0.39188066124916077,
0.23193280398845673,... |
func NewFakeClock() Clock {
return &FakeClock{
l: sync.RWMutex{},
}
} | [
0.2738768458366394,
-0.23492960631847382,
0.24740904569625854,
-0.044481270015239716,
-0.13748550415039062,
-0.39979591965675354,
0.5541565418243408,
-0.4652477502822876,
0.6469646692276001,
-0.21395452320575714,
-0.7697839140892029,
0.9030763506889343,
-1.1826902627944946,
1.2421013116836... |
func (fc *FakeClock) After(d time.Duration) <-chan time.Time {
fc.l.Lock()
defer fc.l.Unlock()
now := fc.time
done := make(chan time.Time, 1)
if d.Nanoseconds() == 0 {
// special case - trigger immediately
go func() {
done <- now
}()
} else {
// otherwise, add to the set of sleepers
s := &sleeper{
... | [
-0.7853236198425293,
1.59091317653656,
0.44534221291542053,
0.14989903569221497,
-0.8407591581344604,
-0.19372855126857758,
-0.260440856218338,
-0.7294816374778748,
-0.38176479935646057,
-0.4429546296596527,
-0.3958987295627594,
0.2956796884536743,
0.19227634370326996,
0.6667115688323975,
... |
func (fc *FakeClock) Sleep(d time.Duration) {
<-fc.After(d)
} | [
-0.13478189706802368,
1.8487921953201294,
0.259755939245224,
-0.06737672537565231,
-0.2882903218269348,
0.36107754707336426,
1.1027112007141113,
-0.7553479671478271,
-0.36515313386917114,
-0.4319542944431305,
-0.548740804195404,
0.3196272552013397,
-0.22453747689723969,
0.11286057531833649... |
func (fc *FakeClock) Tick(d time.Duration) {
fc.l.Lock()
end := fc.time.Add(d)
var newSleepers []*sleeper
for _, s := range fc.sleepers {
if end.Sub(s.until) >= 0 {
s.done <- end
} else {
newSleepers = append(newSleepers, s)
}
}
fc.sleepers = newSleepers
fc.time = end
fc.l.Unlock()
} | [
-1.2230119705200195,
1.5700643062591553,
0.42937421798706055,
0.32381463050842285,
-0.13582149147987366,
0.381763219833374,
0.5530508756637573,
-0.7689093947410583,
-0.7578610181808472,
0.6316578388214111,
-0.8134019374847412,
0.9007653594017029,
0.29453855752944946,
0.6983532309532166,
... |
func (fc *FakeClock) Sleepers() int {
fc.l.Lock()
defer fc.l.Unlock()
return len(fc.sleepers)
} | [
-0.5053189992904663,
1.4396599531173706,
0.433915913105011,
0.22546999156475067,
-0.6417126655578613,
-0.43945398926734924,
0.6115411520004272,
0.0885472446680069,
-0.9629168510437012,
-0.06933601945638657,
-1.4460786581039429,
0.15766654908657074,
-0.9493300318717957,
0.5669659972190857,
... |
func (c *Console) Run() (err error) {
for {
// Recompute the prompt for the current menu
// First check and pull from configuration.
c.current.Prompt.refreshPromptSettings()
// Set the shell history sources with menu ones
c.shell.SetHistoryCtrlR(c.current.historyCtrlRName, c.current.historyCtrlR)
c.shell... | [
0.031139101833105087,
-0.5148645043373108,
0.6908289790153503,
0.24526159465312958,
0.01914284937083721,
-0.41606220602989197,
0.8316183090209961,
0.0004792325780726969,
-0.2715635597705841,
-0.7962629199028015,
0.0008807332487776875,
0.16108869016170502,
-0.10414667427539825,
0.3161509037... |
func (c *Console) sanitizeInput(line string) (sanitized []string, empty bool) {
// Assume the input is not empty
empty = false
// Trim border spaces
trimmed := strings.TrimSpace(line)
if len(line) < 1 {
empty = true
return
}
// Parse arguments for quotes, and split according to these quotes first:
// the... | [
0.0395854152739048,
0.09642568230628967,
0.8222856521606445,
-0.39782601594924927,
0.486919105052948,
-0.12011398375034332,
0.26121145486831665,
-0.15501059591770172,
-0.3781910836696625,
0.5865183472633362,
-0.5196386575698853,
0.4973820447921753,
-0.9913433194160461,
0.9758615493774414,
... |
func CreateJob(name string) *batchv1.Job {
j := &batchv1.Job{}
j.APIVersion = "batch/v1"
j.Kind = "Job"
j.Name = name
j.Spec.Template.Name = name
j.Spec.Template.Spec.RestartPolicy = "Never"
return j
} | [
0.4457894265651703,
-0.1948995739221573,
0.3349929451942444,
0.08195525407791138,
-0.6897358894348145,
0.8831231594085693,
-1.0005905628204346,
0.7208014130592346,
-0.293316513299942,
-0.06417613476514816,
-0.015857841819524765,
-0.4491167366504669,
-0.606555163860321,
-0.7046915292739868,... |
func Encode(files []*source.ParsedGoFile, id source.PackageID, imports map[source.ImportPath]*source.Metadata) []byte {
return index(files, id, imports)
} | [
-0.454865038394928,
0.7949703931808472,
0.0059059010818600655,
-0.3148047626018524,
0.5750349164009094,
0.03185105323791504,
-0.35690292716026306,
0.28040748834609985,
-0.3920973539352417,
0.5099637508392334,
0.10447977483272552,
0.42647936940193176,
-0.5451670289039612,
-0.350470125675201... |
func Decode(pkgIndex *PackageIndex, id source.PackageID, data []byte) []Class {
return decode(pkgIndex, id, data)
} | [
-1.8966586589813232,
0.22639906406402588,
0.2761840224266052,
0.1810266375541687,
0.1925199329853058,
-0.6363848447799683,
-1.2378263473510742,
-0.05761994048953056,
0.9231355786323547,
-0.532200813293457,
-0.9702755808830261,
-0.035189636051654816,
0.07608078420162201,
0.00568691780790686... |
func (st *state) getClassIndex(set symbolSet) int {
key := classKey(set)
i, ok := st.classIndex[key]
if !ok {
i = len(st.class)
st.classIndex[key] = i
st.class = append(st.class, set)
}
return i
} | [
-1.7689822912216187,
0.7620753049850464,
0.6673370003700256,
-0.9729411005973816,
-0.4312371611595154,
-0.7859171628952026,
0.5787423253059387,
-0.6197939515113831,
0.342123419046402,
0.23035837709903717,
-0.8546664714813232,
0.655002772808075,
0.2692759037017822,
-0.2543274462223053,
0.... |
func (set symbolSet) appendSorted(syms []symbol) []symbol {
for sym := range set {
syms = append(syms, sym)
}
sort.Slice(syms, func(i, j int) bool {
x, y := syms[i], syms[j]
if x.pkg != y.pkg {
return x.pkg < y.pkg
}
return x.name < y.name
})
return syms
} | [
-0.189289391040802,
-0.11916792392730713,
0.4768015742301941,
-0.4659017026424408,
-0.7843286395072937,
0.10788242518901825,
-0.3964492678642273,
-1.4964070320129395,
0.6950135231018066,
-0.08227697014808655,
-0.26005566120147705,
0.5174023509025574,
-0.0686073824763298,
1.4319555759429932... |
func classKey(set symbolSet) string {
// Sort symbols into a stable order.
// TODO(adonovan): opt: a cheap crypto hash (e.g. BLAKE2b) might
// make a cheaper map key than a large string.
// Try using a hasher instead of a builder.
var s strings.Builder
for _, sym := range set.appendSorted(make([]symbol, 0, len(se... | [
-0.7495694756507874,
0.03839397430419922,
0.6527110934257507,
-0.23972636461257935,
-0.20969487726688385,
-0.1855277270078659,
0.30527129769325256,
-1.025093913078308,
0.010941436514258385,
0.9061991572380066,
0.11653250455856323,
0.4500207304954529,
0.8845278024673462,
0.19628821313381195... |
func index(pgfs []*source.ParsedGoFile, id source.PackageID, imports map[source.ImportPath]*source.Metadata) []byte {
// First pass: gather package-level names and create a declNode for each.
//
// In ill-typed code, there may be multiple declarations of the
// same name; a single declInfo node will represent them ... | [
-0.2596023380756378,
0.2426234632730484,
0.8215857148170471,
-0.8091081380844116,
0.22920191287994385,
-0.06750796735286713,
0.35395511984825134,
0.10602375864982605,
-0.9324377775192261,
0.6621273756027222,
-0.13344460725784302,
0.3247131407260895,
0.44599851965904236,
0.39772072434425354... |
func visitFile(file *ast.File, imports map[source.ImportPath]*source.Metadata, decls map[string]*declNode) {
// Import information for this file. Multiple packages
// may be referenced by a given name in the presence
// of type errors (or multiple dot imports, which are
// keyed by ".").
fileImports := make(map[st... | [
-0.8492158055305481,
0.06653197109699249,
0.8983466625213623,
-0.8271145224571228,
-0.29851385951042175,
-0.40279483795166016,
1.2999948263168335,
-0.23375076055526733,
-0.5070945620536804,
0.5227217674255371,
0.14997011423110962,
0.6491577625274658,
0.38158345222473145,
0.6316225528717041... |
func tparamsMap(tparams *ast.FieldList) map[string]bool {
if tparams == nil || len(tparams.List) == 0 {
return nil
}
m := make(map[string]bool)
for _, f := range tparams.List {
for _, name := range f.Names {
if name.Name != "_" {
m[name.Name] = true
}
}
}
return m
} | [
-1.4818302392959595,
-0.13436122238636017,
0.8627666234970093,
-1.2885713577270508,
-0.30142346024513245,
0.27629438042640686,
-0.5987717509269714,
0.3187207877635956,
-1.3585247993469238,
1.6506147384643555,
-1.2827247381210327,
-0.9021126627922058,
0.18955600261688232,
0.9918854236602783... |
func visitDeclOrSpec(node ast.Node, f refVisitor) {
// Declarations
switch n := node.(type) {
// ImportSpecs should not appear here, and will panic in the default case.
case *ast.ValueSpec:
// Skip Doc, Names, Comments, which do not affect the decl type.
// Initializers only affect the type of a value spec if ... | [
-0.5952492356300354,
0.32572320103645325,
0.701582670211792,
-0.2726942300796509,
-0.13279403746128082,
0.20771241188049316,
0.6986135840415955,
-0.8679254055023193,
-0.5876265168190002,
0.4724072813987732,
0.5540364384651184,
0.6579106450080872,
0.7319671511650085,
1.0261584520339966,
0... |
func visitExpr(expr ast.Expr, f refVisitor) {
switch n := expr.(type) {
// These four cases account for about two thirds of all nodes,
// so we place them first to shorten the common control paths.
// (See go.dev/cl/480915.)
case *ast.Ident:
f(n.Name, "")
case *ast.BasicLit:
// nothing to do
case *ast.Sele... | [
-1.084295630455017,
0.4478073716163635,
0.747052788734436,
0.10195954144001007,
-0.46926525235176086,
-0.11885666102170944,
0.5816730856895447,
-0.7729616165161133,
-0.0025251104962080717,
1.031701683998108,
0.3991805911064148,
0.3821377158164978,
0.11692932993173599,
0.7272502183914185,
... |
func (st *state) visit(x *declNode) {
checkCanonical(x)
x.index = st.index
x.lowlink = st.index
st.index++
st.stack = append(st.stack, x) // push
assert(x.scc == 0, "node revisited")
x.scc = -1
for y := range x.intRefs {
// Loop invariant: x is canonical.
y := y.find()
if x == y {
continue // nodes... | [
-0.4513043165206909,
0.6660323143005371,
0.8707840442657471,
-0.8003147840499878,
-0.2171659618616104,
-1.0012540817260742,
0.8728453516960144,
-0.0678645446896553,
0.4071619212627411,
0.03694001957774162,
0.06235396862030029,
1.1341530084609985,
0.42157602310180664,
0.005906898993998766,
... |
func coalesce(x, y *declNode) {
// x becomes y's canonical representative.
y.rep = x
// x accumulates y's internal references.
for z := range y.intRefs {
x.intRefs[z] = true
}
y.intRefs = nil
// x accumulates y's external references.
for z := range y.extRefs {
if x.extRefs == nil {
x.extRefs = make(sym... | [
0.2467627227306366,
0.3233272433280945,
0.6457496285438538,
-1.2552639245986938,
0.07997128367424011,
-0.6472223401069641,
-0.446261465549469,
-0.29707616567611694,
-0.3811524212360382,
-0.03440845012664795,
-0.07501763850450516,
1.8101806640625,
0.3172508776187897,
-0.06401669234037399,
... |
func (decl *declNode) find() *declNode {
rep := decl.rep
if rep != decl {
rep = rep.find()
decl.rep = rep // simple path compression (no union-by-rank)
}
return rep
} | [
0.3904619514942169,
0.4545877277851105,
0.5261002779006958,
-0.4608626663684845,
-0.46614861488342285,
0.12521429359912872,
0.8874869346618652,
-0.5035828351974487,
-0.4769921898841858,
0.5174667239189148,
0.5317872166633606,
0.10312232375144958,
-0.9864149689674377,
1.1846131086349487,
... |
func encode(classNames map[int][]string, classes []symbolSet) []byte {
payload := gobClasses{
Classes: make([]gobClass, 0, len(classNames)),
}
// index of unique strings
strings := make(map[string]int32)
stringIndex := func(s string) int32 {
i, ok := strings[s]
if !ok {
i = int32(len(payload.Strings))
... | [
-0.8364849090576172,
0.2643411159515381,
0.6299050450325012,
-0.9954314827919006,
0.3674764335155487,
-0.25935402512550354,
-0.035176340490579605,
-1.1167694330215454,
-0.19973014295101166,
0.7610005140304565,
0.4264989197254181,
0.34982529282569885,
0.010230997577309608,
0.362493932247161... |
func (c *VaultController) reconcileAWSRole(awsRClient aws.AWSRoleInterface, awsRole *api.AWSRole) error {
status := awsRole.Status
// create role
err := awsRClient.CreateRole()
if err != nil {
status.Conditions = []api.AWSRoleCondition{
{
Type: AWSRoleConditionFailed,
Status: core.ConditionTrue,
... | [
-0.06356927752494812,
-0.11554065346717834,
0.8705834746360779,
-1.176677942276001,
0.24332617223262787,
0.45801135897636414,
-0.3713279664516449,
-0.6787081360816956,
-0.278726190328598,
0.9392923712730408,
0.20098550617694855,
-0.5637354254722595,
-0.063075490295887,
0.4413500428199768,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.