text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (this *Poly) setType(t int) {
this.areaAndtype = (this.areaAndtype & 0x3f) | (t << 6)
} | [
0.23195545375347137,
-0.3523821234703064,
0.4142408072948456,
-0.11557605117559433,
-0.05794426426291466,
0.9868884086608887,
0.21356725692749023,
-0.994785726070404,
0.7917281985282898,
0.31394264101982117,
-0.9218644499778748,
0.43108806014060974,
0.08388199657201767,
0.3182452321052551,... |
func (this *Poly) getArea() int {
return this.areaAndtype & 0x3f
} | [
0.2654467821121216,
-0.44085636734962463,
0.5497052073478699,
0.30193662643432617,
-0.2826806604862213,
0.2625710964202881,
0.6699368357658386,
-0.5358357429504395,
0.9687240719795227,
-0.6052138209342957,
0.10496699064970016,
0.5732011198997498,
-0.6385089159011841,
0.6515616774559021,
... |
func (this *Poly) getType() int {
return this.areaAndtype >> 6
} | [
0.1489744633436203,
-0.3284571170806885,
0.6904345750808716,
0.3510524034500122,
0.28663313388824463,
0.36969342827796936,
0.8993032574653625,
-1.1662806272506714,
0.8573336601257324,
-0.24795934557914734,
-0.7142667770385742,
0.43341073393821716,
-0.5952871441841125,
0.23660562932491302,
... |
func NewQueryWatchBuilder() *QueryWatchBuilder {
r := QueryWatchBuilder{
&QueryWatch{},
}
return &r
} | [
1.1466044187545776,
-0.012402468360960484,
-0.05928123742341995,
0.7444381713867188,
-0.18967854976654053,
0.3637937307357788,
-0.27327173948287964,
-0.46795013546943665,
0.38426655530929565,
-1.4635646343231201,
-0.9826461672782898,
0.4673323929309845,
-0.24587693810462952,
0.084860667586... |
func (rb *QueryWatchBuilder) Build() QueryWatch {
return *rb.v
} | [
0.8958436846733093,
-0.7928705215454102,
0.0803595557808876,
0.5375115275382996,
0.39908596873283386,
0.2680976092815399,
0.4122997522354126,
-1.0544847249984741,
0.06079763174057007,
-1.1448273658752441,
-0.20881640911102295,
1.0532779693603516,
-0.7606177926063538,
0.45411932468414307,
... |
func (a *Azure) CreateNIC(ctx context.Context, location string, vnetName, subnetName, nsgName, ipName, nicName string, enableIPForwarding bool) (nic network.Interface, err error) {
subnet, err := a.GetVirtualNetworkSubnet(ctx, vnetName, subnetName)
if err != nil {
log.Fatalf("failed to get subnet: %v", err)
}
ip... | [
0.15525078773498535,
0.4688244163990021,
0.6913487315177917,
0.4212299585342407,
0.07987042516469955,
-0.29691097140312195,
-0.01171982754021883,
-0.4885387718677521,
-0.7118706703186035,
0.7978161573410034,
-0.3490925431251526,
-1.0681225061416626,
-0.5915945768356323,
-0.5609025955200195... |
func (a *Azure) DeleteNIC(ctx *lepton.Context, nic *network.Interface) error {
logger := ctx.Logger()
nicClient := a.getNicClient()
logger.Infof("Deleting %s...", *nic.ID)
nicName := getAzureResourceNameFromID(*nic.ID)
nicDeleteTask, err := nicClient.Delete(context.TODO(), a.groupName, nicName)
if err != nil {
... | [
0.49401092529296875,
0.17430076003074646,
0.4532257318496704,
-0.15055663883686066,
0.17131289839744568,
-0.5876374244689941,
0.5938994288444519,
-1.0366989374160767,
-0.2902442514896393,
0.20582228899002075,
-0.6199033260345459,
-0.8531319499015808,
-0.051911674439907074,
0.10964938253164... |
func (a *Azure) DeleteIP(ctx *lepton.Context, ipConfiguration *network.InterfaceIPConfiguration) error {
logger := ctx.Logger()
ipID := getAzureResourceNameFromID(*ipConfiguration.PublicIPAddress.ID)
ipClient := a.getIPClient()
logger.Infof("Deleting public IP %s...", ipID)
deleteIPTask, err := ipClient.Delete(... | [
-0.12887322902679443,
0.3740338087081909,
0.5367959141731262,
0.9760666489601135,
-0.2150540053844452,
0.5383302569389343,
0.2580055296421051,
0.17168407142162323,
-0.17353492975234985,
0.20329397916793823,
0.5598599910736084,
-0.7126922607421875,
0.10902142524719238,
-0.223408043384552,
... |
func (a *Azure) DeleteNetworkSecurityGroup(ctx *lepton.Context, securityGroupID string) error {
logger := ctx.Logger()
nsgClient, err := a.getNsgClient()
if err != nil {
return err
}
securityGroupName := getAzureResourceNameFromID(securityGroupID)
securityGroup, err := nsgClient.Get(context.TODO(), a.groupNam... | [
0.6366580724716187,
1.095840334892273,
0.20509587228298187,
0.21127082407474518,
0.10135539621114731,
-0.14265592396259308,
0.2054567039012909,
-1.1983197927474976,
0.22641688585281372,
-0.10759174823760986,
-0.18692408502101898,
-0.6123798489570618,
-0.5295664072036743,
1.3142695426940918... |
func (a *Azure) DeleteSubnetwork(ctx *lepton.Context, subnetID string) error {
logger := ctx.Logger()
subnetsClient, err := a.getSubnetsClient()
if err != nil {
return err
}
vnetClient, err := a.getVnetClient()
if err != nil {
return err
}
subnetName := getAzureResourceNameFromID(subnetID)
vnName := getA... | [
0.5632284879684448,
0.20377957820892334,
0.6953380703926086,
1.1512101888656616,
0.05432676896452904,
0.15838663280010223,
0.3470388352870941,
-0.1502765566110611,
0.7520289421081543,
0.6210412383079529,
-0.46418172121047974,
0.19947384297847748,
0.13827642798423767,
0.5551363229751587,
... |
func (a *Azure) CreatePublicIP(ctx context.Context, location string, ipName string) (ip network.PublicIPAddress, err error) {
ipClient := a.getIPClient()
future, err := ipClient.CreateOrUpdate(
ctx,
a.groupName,
ipName,
network.PublicIPAddress{
Name: to.StringPtr(ipName),
Location: to.StringPtr(loc... | [
-0.1059417650103569,
-0.31081587076187134,
0.47956907749176025,
-0.24192282557487488,
-0.30938974022865295,
-0.05888622626662254,
-0.2956697344779968,
-0.04840926080942154,
-0.1107526421546936,
0.8284063935279846,
0.09205842018127441,
-0.4447225034236908,
-0.7558860182762146,
-0.5275908112... |
func (a *Azure) GetPublicIP(ctx context.Context, ipName string) (ip network.PublicIPAddress, err error) {
ipClient := a.getIPClient()
ip, err = ipClient.Get(ctx, a.groupName, ipName, "")
return
} | [
0.2689042389392853,
0.049419552087783813,
0.5223916172981262,
0.6452487111091614,
-0.33921006321907043,
-0.37716275453567505,
0.5013639330863953,
-0.6563522219657898,
0.04401199147105217,
0.33918729424476624,
0.6988720297813416,
0.34185531735420227,
-0.6965756416320801,
-0.8444615006446838... |
func (a *Azure) GetVPC(vnetName string) (vnet *network.VirtualNetwork, err error) {
vnetClient, err := a.getVnetClient()
if err != nil {
return
}
result, err := vnetClient.Get(context.TODO(), a.groupName, vnetName, "")
vnet = &result
return
} | [
0.16113896667957306,
0.4315911829471588,
0.570216715335846,
-0.17779988050460815,
0.3996545374393463,
-0.20627515017986298,
-0.15755823254585266,
-1.4175081253051758,
0.698814868927002,
0.8478193879127502,
0.8703640103340149,
0.4425397515296936,
-0.870392918586731,
-0.578261137008667,
-0... |
func (a *Azure) CreateVirtualNetwork(ctx context.Context, location string, vnetName string) (vnet *network.VirtualNetwork, err error) {
vnetClient, err := a.getVnetClient()
if err != nil {
return nil, err
}
future, err := vnetClient.CreateOrUpdate(
ctx,
a.groupName,
vnetName,
network.VirtualNetwork{
Lo... | [
-0.39016708731651306,
-0.13349711894989014,
0.1695404201745987,
-0.2351071685552597,
0.05605217069387436,
-0.11506667733192444,
-0.7725403308868408,
-0.2880239486694336,
0.5159967541694641,
0.7299302220344543,
-0.49586230516433716,
-0.03793296590447426,
-0.6955251097679138,
0.0899291485548... |
func (a *Azure) CreateVirtualNetworkAndSubnets(ctx context.Context, location string, vnetName, subnet1Name, subnet2Name string) (vnet *network.VirtualNetwork, err error) {
vnetClient, err := a.getVnetClient()
if err != nil {
return nil, err
}
future, err := vnetClient.CreateOrUpdate(
ctx,
a.groupName,
vnet... | [
-0.14160285890102386,
-0.18202251195907593,
0.4332031011581421,
-0.2040630429983139,
0.3881336450576782,
0.3875286281108856,
-0.4982013702392578,
-0.3062586784362793,
0.47569018602371216,
0.4727722704410553,
-0.4138215482234955,
0.11992587894201279,
0.04115850850939751,
0.2595249116420746,... |
func (a *Azure) CreateVirtualNetworkSubnet(ctx context.Context, vnetName, subnetName string) (subnet *network.Subnet, err error) {
subnetsClient, err := a.getSubnetsClient()
if err != nil {
return nil, err
}
future, err := subnetsClient.CreateOrUpdate(
ctx,
a.groupName,
vnetName,
subnetName,
network.Su... | [
0.02556755207479,
0.16042010486125946,
0.5011785626411438,
0.03713018447160721,
0.2582815885543823,
0.1700228452682495,
-0.7708147168159485,
-0.2343047559261322,
0.14551898837089539,
0.039440277963876724,
-0.29292812943458557,
0.17526596784591675,
-0.6231541633605957,
-0.35420241951942444,... |
func (a *Azure) CreateSubnetWithNetworkSecurityGroup(ctx context.Context, vnetName, subnetName, addressPrefix, nsgName string) (subnet *network.Subnet, err error) {
nsg, err := a.GetNetworkSecurityGroup(ctx, nsgName)
if err != nil {
return subnet, fmt.Errorf("cannot get nsg: %v", err)
}
subnetsClient, err := a.g... | [
0.49621209502220154,
0.5384986996650696,
0.2869800925254822,
0.48500344157218933,
-0.19359052181243896,
-0.1256273239850998,
-0.5975194573402405,
-1.2841215133666992,
0.5870895981788635,
-0.4785478711128235,
-0.3225153386592865,
0.049682505428791046,
-0.4365212619304657,
0.616486668586731,... |
func (a *Azure) GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (subnet *network.Subnet, err error) {
subnetsClient, err := a.getSubnetsClient()
if err != nil {
return
}
result, err := subnetsClient.Get(ctx, a.groupName, vnetName, subnetName, "")
subnet = &result
return
} | [
0.18193283677101135,
0.3256683945655823,
0.3649805188179016,
0.6687498688697815,
-0.15022340416908264,
-0.22805434465408325,
-0.9103639721870422,
-0.25427141785621643,
-0.03401264548301697,
-0.017075344920158386,
-0.11074480414390564,
0.8273537755012512,
-0.8921912908554077,
-0.83728539943... |
func (a *Azure) CreateNetworkSecurityGroup(ctx context.Context, location string, nsgName string, c *types.Config) (nsg *network.SecurityGroup, err error) {
nsgClient, err := a.getNsgClient()
if err != nil {
return
}
var securityRules []network.SecurityRule
for _, ports := range c.RunConfig.Ports {
var rule =... | [
-0.04415854439139366,
0.9922673106193542,
0.3049826920032501,
-0.4048420190811157,
-0.15799586474895477,
-0.23079216480255127,
-0.19241099059581757,
-0.7788442969322205,
-0.11197991669178009,
-0.05111948028206825,
-0.4680952727794647,
-0.6021835207939148,
-0.6652775406837463,
0.84700703620... |
func (a *Azure) CreateSimpleNetworkSecurityGroup(ctx context.Context, location string, nsgName string) (nsg network.SecurityGroup, err error) {
nsgClient, err := a.getNsgClient()
if err != nil {
return
}
future, err := nsgClient.CreateOrUpdate(
ctx,
a.groupName,
nsgName,
network.SecurityGroup{
Locatio... | [
0.08354801684617996,
0.9332181811332703,
0.31207945942878723,
-0.770494818687439,
-0.40222954750061035,
-0.07351294904947281,
-0.5309603810310364,
-0.8147849440574646,
0.29337096214294434,
-0.6012226343154907,
-1.1022788286209106,
-0.6760464310646057,
-0.5456759929656982,
0.616068243980407... |
func (a *Azure) GetNetworkSecurityGroup(ctx context.Context, nsgName string) (sg *network.SecurityGroup, err error) {
nsgClient, err := a.getNsgClient()
if err != nil {
return
}
result, err := nsgClient.Get(ctx, a.groupName, nsgName, "")
sg = &result
return
} | [
0.26446279883384705,
1.7992148399353027,
0.013653616420924664,
-0.2849292755126953,
-0.29942867159843445,
-0.9715028405189514,
-0.13310305774211884,
-1.7672898769378662,
0.07588677108287811,
-0.9005944132804871,
-0.4141276478767395,
-0.0039929794147610664,
-0.7002297639846802,
0.7604604363... |
func UcFirst(input string) string {
if len(input) == 0 {
return ""
}
return strings.ToUpper(input[0:1]) + input[1:]
} | [
0.11464346945285797,
0.43793216347694397,
0.6592004895210266,
0.10855049639940262,
-0.28724437952041626,
0.4886547923088074,
0.5852587819099426,
0.27601364254951477,
-0.0619528666138649,
0.7823830842971802,
-0.017170658335089684,
0.7211287021636963,
0.25059542059898376,
-0.0727635696530342... |
func LcFirst(input string) string {
if len(input) == 0 {
return ""
}
return strings.ToUpper(input[0:1]) + input[1:]
} | [
1.0546280145645142,
0.03458688035607338,
0.6720461845397949,
-0.8978585600852966,
-0.0634223073720932,
0.40391796827316284,
-0.8077527284622192,
-0.1444942057132721,
0.281537264585495,
0.17997458577156067,
-0.16829314827919006,
0.8824349641799927,
-0.2101874053478241,
0.3972836136817932,
... |
func CamelToSpinal(input string) string {
// Ensure the input is in UpperCamelCase
input = UcFirst(input)
var words []string
lastCap := 0
for i, runeVal := range input {
if i > 0 && unicode.IsUpper(runeVal) {
words = append(words, strings.ToLower(input[lastCap:i]))
lastCap = i
}
}
if len(input) > l... | [
-0.3453824818134308,
-0.8827372193336487,
0.679169237613678,
-0.6465991735458374,
-0.3093005120754242,
0.08929964900016785,
-0.20265549421310425,
-0.23318196833133698,
0.6628294587135315,
1.0407394170761108,
0.052723318338394165,
0.1038166806101799,
-0.3765256702899933,
-0.2593677341938019... |
func SpinalToCamel(input string) string {
// Ensure the input is all lowercase
input = strings.ToLower(input)
words := strings.Split(input, "-")
for i, word := range words {
words[i] = UcFirst(word)
}
return strings.Join(words, "")
} | [
0.2711659073829651,
-0.9412255883216858,
0.5560774803161621,
0.2948148548603058,
0.19466429948806763,
-0.17719410359859467,
0.49308356642723083,
-0.2746800184249878,
0.7590516209602356,
0.9809238910675049,
0.34630805253982544,
0.8641039133071899,
0.4609154760837555,
0.2813856601715088,
0... |
func NewTagTemplate(ctx *pulumi.Context,
name string, args *TagTemplateArgs, opts ...pulumi.ResourceOption) (*TagTemplate, error) {
if args == nil || args.Fields == nil {
return nil, errors.New("missing required argument 'Fields'")
}
if args == nil || args.TagTemplateId == nil {
return nil, errors.New("missing ... | [
-0.0416155681014061,
0.7880124449729919,
0.14315228164196014,
-0.31897079944610596,
0.24078702926635742,
0.1616995483636856,
-1.003071665763855,
0.21753033995628357,
-0.7286260724067688,
0.5972424745559692,
-1.0540574789047241,
-0.3160082995891571,
-0.19247403740882874,
0.02482650987803936... |
func GetTagTemplate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TagTemplateState, opts ...pulumi.ResourceOption) (*TagTemplate, error) {
var resource TagTemplate
err := ctx.ReadResource("gcp:datacatalog/tagTemplate:TagTemplate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
... | [
0.46405306458473206,
0.6638126373291016,
0.06094888970255852,
-0.32881784439086914,
0.328224778175354,
-0.3020208179950714,
-1.275052547454834,
-0.2948174774646759,
0.1000734195113182,
0.4231451153755188,
-0.4435977041721344,
0.232329323887825,
0.012557493522763252,
-0.9625043272972107,
... |
func NewComputingProviderController(service *goa.Service) *ComputingProviderController {
os.Setenv("IPFS_API", "http://47.52.231.230:8899")
// set transaction argments
err := setTransactionArgments()
if err != nil {
fmt.Println("setTransactionArgments err:", err)
}
return &ComputingProviderController{Controller... | [
-0.14471718668937683,
0.6858917474746704,
0.1885414719581604,
-0.3603338897228241,
-0.003165094880387187,
-0.011034151539206505,
0.42463117837905884,
0.3829111158847809,
-0.9434161186218262,
0.8718044757843018,
0.4846481680870056,
-0.1527615189552307,
-0.5310558080673218,
0.219530254602432... |
func (c *ComputingProviderController) Add(ctx *app.AddComputingProviderContext) error {
// check arguments
if checkArguments(ctx.Hash, ctx.ETHKey) == false {
fmt.Println("ctx.Hash===========>", ctx.Hash)
return ctx.BadRequest(
goa.ErrBadRequest("Invalid arguments!"))
}
// read config
config := readConfig(... | [
-0.6864277720451355,
0.5473788380622864,
1.1461901664733887,
0.22715121507644653,
0.312578946352005,
0.8702946901321411,
0.15986478328704834,
0.49852538108825684,
0.1641109734773636,
1.4886488914489746,
-0.24737179279327393,
-0.13330571353435516,
-0.733587920665741,
0.542870819568634,
0.... |
func (c *ComputingProviderController) Agree(ctx *app.AgreeComputingProviderContext) error {
// 获取判断swaggerUI上的参数参数;TODO同意并发送到以太坊 => 离线签名?
if checkAgreeArgments(ctx.ETHKey, ctx.ComputingHash, ctx.ContractHash, ctx.PublicKey) == false {
fmt.Println("ctx.Hash===========>", ctx)
return ctx.BadRequest(
goa.ErrBadRe... | [
-1.0239083766937256,
0.04298418387770653,
1.4392480850219727,
0.013495738618075848,
-0.14780430495738983,
1.2464678287506104,
0.38303741812705994,
0.4708930552005768,
-0.7681586742401123,
1.7532137632369995,
-0.046241454780101776,
0.20959192514419556,
-0.44179725646972656,
0.62118339538574... |
func (c *ComputingProviderController) Del(ctx *app.DelComputingProviderContext) error {
// check arguments
if checkArguments(ctx.Hash, ctx.ETHKey) == false {
fmt.Println("ctx.Hash===========>", ctx.Hash)
return ctx.BadRequest(
goa.ErrBadRequest("Invalid arguments!"))
}
// read config
config := readConfig()... | [
0.04487583041191101,
0.41193893551826477,
1.283433437347412,
-0.04195011407136917,
-0.5002499222755432,
0.7508131265640259,
0.27255192399024963,
0.6411458849906921,
0.22625836730003357,
1.4217554330825806,
0.19130860269069672,
0.08698426187038422,
-0.45009005069732666,
-0.23050735890865326... |
func (c *ComputingProviderController) UploadRes(ctx *app.UploadResComputingProviderContext) error {
// check arguments
if checkArguments(ctx.AesHash, ctx.ETHKey) == false {
fmt.Println("ctx.Hash===========>", ctx.AesHash)
return ctx.BadRequest(
goa.ErrBadRequest("Invalid arguments!"))
}
// read config
confi... | [
-0.63729327917099,
0.6821505427360535,
1.3097257614135742,
-0.49293169379234314,
0.25924381613731384,
0.3679380416870117,
0.01941368542611599,
-0.08163601905107498,
0.2812604308128357,
1.3795019388198853,
-0.04782601073384285,
0.03435436636209488,
-0.23211732506752014,
0.30666401982307434,... |
func (c *ComputingProviderController) Train(ctx *app.TrainComputingProviderContext) error {
// TODO 检查参数,本地训练[完成代码链接,执行训练]
if checkTrainArgments(ctx.ETHKey, ctx.ComputingHash, ctx.ContractHash, ctx.PublicKey) == false {
fmt.Println("ctx.Hash===========>", ctx)
return ctx.BadRequest(
goa.ErrBadRequest("Train ac... | [
-1.0040627717971802,
0.6364004611968994,
0.7701811194419861,
0.41216540336608887,
0.6538158059120178,
0.6614298820495605,
0.9223850965499878,
0.3282851278781891,
-0.31724944710731506,
0.9082491397857666,
-0.6604258418083191,
0.4966624081134796,
-0.2484627217054367,
-0.12760530412197113,
... |
func checkArguments(hash string, privateKey string) bool {
// easy check
// if len(hash) != 46 || len(privateKey) != 64 {
// return false
// }
return true
} | [
-1.0195204019546509,
0.00009183929796563461,
0.6293621063232422,
0.6508203744888306,
0.7933646440505981,
0.6705289483070374,
-0.9990919232368469,
0.5093007683753967,
-0.09451541304588318,
1.0563427209854126,
0.03306693211197853,
0.47452443838119507,
-1.5440906286239624,
0.8212196826934814,... |
func send2Ethereum(op transaction.OpType, computingAddressHash string) (string, error) {
//send hash to ethereum
return "TODO", nil
} | [
-0.7622582316398621,
-0.33882373571395874,
0.690659761428833,
0.3300597071647644,
0.11609691381454468,
0.3752354085445404,
0.50395268201828,
0.20022642612457275,
0.18340103328227997,
0.8732650279998779,
-0.49118155241012573,
0.8824765682220459,
0.3832593560218811,
0.01760191097855568,
-0... |
func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {
c := config.DefaultConfig
if err := cfg.Unpack(&c); err != nil {
return nil, fmt.Errorf("Error reading config file: %v", err)
}
bt := &Polutbeat{
done: make(chan struct{}),
config: c,
}
return bt, nil
} | [
0.21904975175857544,
-0.14406436681747437,
0.4276072382926941,
0.06612031161785126,
-0.31766167283058167,
1.0615156888961792,
0.1361049860715866,
0.5168007612228394,
-1.110558032989502,
0.048913393169641495,
-0.5262160301208496,
0.10571407526731491,
-0.5490226745605469,
0.2518584728240967,... |
func monotonicOrTransportBytes(useMonotonicCounts bool, monotonic uint64, transport uint64) uint64 {
if useMonotonicCounts {
return monotonic
}
return transport
} | [
-0.3696313202381134,
0.008519967086613178,
0.5255352258682251,
-0.46472588181495667,
0.18035942316055298,
0.35269951820373535,
-0.3827338218688965,
-0.684083878993988,
0.11805859953165054,
0.01878019981086254,
-0.24284985661506653,
0.011417143978178501,
-1.0268548727035522,
-0.738717496395... |
func FlowToConnStat(cs *ConnectionStats, flow *driver.PerFlowData, enableMonotonicCounts bool) {
var (
family ConnectionFamily
srcAddr util.Address
dstAddr util.Address
connectionType ConnectionType
)
family = connFamily(flow.AddressFamily)
connectionType = connType(flow.Protocol)
//... | [
0.23266786336898804,
-0.3189507722854614,
0.6394600868225098,
-0.8902809619903564,
-0.036859117448329926,
-0.21231544017791748,
0.041149500757455826,
-0.3430931568145752,
0.11308202892541885,
-0.17700375616550446,
0.11792507767677307,
0.02078813873231411,
-0.15497149527072906,
0.0749179422... |
func Setup() error {
kubeconfig := flag.String("kubeconfig", "", "kube config path, e.g. $HOME/.kube/config")
vopImage := flag.String("operator-image", "", "operator image, e.g. quay.io/coreos/vault-operator-dev:latest")
eopImage := flag.String("etcd-operator-image", "quay.io/coreos/etcd-operator:v0.8.3", "etcd oper... | [
0.17421017587184906,
0.06545458734035492,
0.791028618812561,
-0.11795516312122345,
0.3162762224674225,
-0.1641554981470108,
0.6413101553916931,
-0.5870779156684875,
-0.39929452538490295,
0.247975692152977,
0.31946060061454773,
0.21622274816036224,
-0.5674068331718445,
0.6253649592399597,
... |
func Teardown() error {
err := Global.KubeClient.CoreV1().Pods(Global.Namespace).Delete(vaultOperatorName, k8sutil.CascadeDeleteBackground())
if err != nil {
return fmt.Errorf("failed to delete pod: %v", err)
}
err = Global.KubeClient.CoreV1().Pods(Global.Namespace).Delete(etcdOperatorName, k8sutil.CascadeDeleteB... | [
-0.4033138155937195,
0.2306520640850067,
0.684108555316925,
-0.4852738678455353,
0.2727484405040741,
0.7680407166481018,
0.504607081413269,
0.19946956634521484,
-0.014624658040702343,
0.43347883224487305,
0.5912246108055115,
0.19907845556735992,
-0.04698312282562256,
-0.040097419172525406,... |
func (e ProjectCreated) isEvent() {} | [
0.889424204826355,
0.10930497199296951,
0.2173565924167633,
0.9713160991668701,
1.4274026155471802,
1.0348762273788452,
0.13205794990062714,
0.6881922483444214,
0.6238502860069275,
-0.6907132863998413,
-0.5131514668464661,
-0.003895418019965291,
0.008990352042019367,
0.5718123316764832,
... |
func New() helper.Moduler {
return &Moduler{}
} | [
0.38195139169692993,
-1.227893590927124,
-0.339442640542984,
-0.01897321455180645,
-0.22908666729927063,
0.08498688042163849,
0.396366149187088,
-0.41449180245399475,
-0.8215018510818481,
-0.49933063983917236,
0.5137951970100403,
0.41395944356918335,
0.23443572223186493,
1.7360531091690063... |
func closeEnough(a, b time.Duration) bool {
return delta(a, b) <= 5*time.Millisecond || ratio(a, b) >= 0.80
} | [
-0.10877904295921326,
0.15328916907310486,
0.7197130918502808,
0.050839945673942566,
-1.9004707336425781,
1.2971880435943604,
-0.3877183198928833,
-1.190908670425415,
-0.9385451078414917,
0.3778149485588074,
0.6931835412979126,
0.06423456221818924,
0.3405509293079376,
0.6534094214439392,
... |
func WithSubjectCommonNameVerification() NamePolicyOption {
return func(e *NamePolicyEngine) error {
e.verifySubjectCommonName = true
return nil
}
} | [
1.323403239250183,
0.37776967883110046,
0.5617433190345764,
0.3622726500034332,
0.10386468470096588,
1.0531948804855347,
0.8581970930099487,
-0.2583378255367279,
-0.06579423695802689,
0.13288161158561707,
-1.1046795845031738,
-0.30703043937683105,
0.004007806535810232,
0.36162832379341125,... |
func generateNoOpBlocks() {
for {
if isGenerateNoOps && !isWorkingOnCommit {
isWorkingOnNoOp = true
generateNoOpBlock()
isWorkingOnNoOp = false
time.Sleep(time.Millisecond * 100)
} else {
time.Sleep(time.Second)
}
}
} | [
-0.8491004109382629,
0.9990884065628052,
0.5028181672096252,
0.6117121577262878,
-0.22494837641716003,
0.8936052322387695,
0.27416518330574036,
-0.5923503041267395,
-0.5194724202156067,
-0.07956143468618393,
-0.5776858925819397,
-0.08436758816242218,
-1.2234013080596924,
1.0207105875015259... |
func generateNoOpBlock() {
fmt.Println("Generating a NoOp Block...")
fmt.Println("Block chain size:", len(blockChain), "number transactions:", len(transactions))
// TODO this printstate() actually seemed to help performance... Maybe could use a tiny sleep here?
printState()
if len(leafBlocks) > 1 {
fmt.Println("... | [
-0.5438412427902222,
0.6606298089027405,
0.9015704393386841,
0.2985370457172394,
0.31457871198654175,
0.27549147605895996,
0.5987727642059326,
-0.08268313854932785,
-0.5010018944740295,
-0.8350523710250854,
0.10604117065668106,
0.1889936625957489,
-0.9721957445144653,
1.2595806121826172,
... |
func getCommitLeafBlocks() map[string]Block {
commitBlocks := make(map[string]Block)
mutex.Lock()
leafBlocksCopy := leafBlocks
mutex.Unlock()
for leafBlockHash := range leafBlocksCopy {
if leafBlocksCopy[leafBlockHash].HashBlock.TxID != 0 {
commitLeafBlock := leafBlocksCopy[leafBlockHash]
commitBlocks[leaf... | [
0.20043157041072845,
-1.0739026069641113,
0.6688001751899719,
0.7731271982192993,
-0.4759185314178467,
0.3260837495326996,
-0.589165210723877,
-0.14015012979507446,
-0.6350323557853699,
0.9306795597076416,
0.11784607172012329,
-0.02213294990360737,
-0.878740131855011,
0.6821224689483643,
... |
func generateBlock(block *Block) (bool, string) {
b := *block
data := []byte(fmt.Sprintf("%v", b.HashBlock))
sum := sha256.Sum256(data)
hash := sum[:] // Converts from [32]byte to []byte
// TODO: make sure to turn in with call to isLeadingNumZeroCharacters,
// not with call to isLeadingNumZeroes (which is used fo... | [
-0.23433977365493774,
0.8295477032661438,
1.1554968357086182,
0.5158780217170715,
0.27310439944267273,
0.35054153203964233,
0.09129210561513901,
0.4269857406616211,
0.6748790144920349,
-0.35735732316970825,
-0.9428389668464661,
-0.4623294770717621,
-0.8776839375495911,
0.9952989816665649,
... |
func printState() {
fmt.Println("\nKVNODE STATE:")
fmt.Println("-keyValueStore:")
for k := range keyValueStore {
mutex.Lock()
val := keyValueStore[k]
mutex.Unlock()
fmt.Println(" Key:", k, "Value:", val)
}
fmt.Println("-transactions:")
for txId := range transactions {
mutex.Lock()
tx := transaction... | [
0.2033907026052475,
-0.005539999809116125,
0.8432688117027283,
-0.7786968350410461,
-0.05540239438414574,
0.05801727995276451,
-0.14222951233386993,
-0.6434762477874756,
-0.39913973212242126,
0.3079092800617218,
0.25902703404426575,
0.6348735094070435,
-0.23809649050235748,
0.5637411475181... |
func printBlockChain() {
mutex.Lock()
genesisBlock := blockChain[genesisHash]
mutex.Unlock()
fmt.Printf("GenesisBlockHash: %x\n", genesisBlock.Hash)
fmt.Printf("GenesisBlockChildren: %x\n\n", genesisBlock.ChildrenHashes)
for _, childHash := range genesisBlock.ChildrenHashes {
printBlock(childHash)
}
} | [
0.4775454103946686,
-0.35294151306152344,
0.8152485489845276,
0.2785772979259491,
0.4848327040672302,
0.2567971348762512,
-0.2882976830005646,
-0.2764607071876526,
-1.381364107131958,
0.028905309736728668,
-0.3287925720214844,
1.349194884300232,
-0.8519434332847595,
1.0739744901657104,
0... |
func printBlock(blockHash string) {
mutex.Lock()
block := blockChain[blockHash]
mutex.Unlock()
indent := ""
for i := 0; i < block.Depth; i++ {
indent += " "
}
fmt.Printf("%sBlockTransactionID: %v\n", indent, block.HashBlock.TxID)
fmt.Printf("%sBlock.Hash :%x\n", indent, block.Hash)
fmt.Printf("%sBlock.Depth ... | [
0.6211393475532532,
0.0007831193506717682,
1.320388913154602,
-0.0903494730591774,
0.041590455919504166,
0.5084779262542725,
0.2112034559249878,
-0.6810483336448669,
-0.7884209752082825,
-0.025676235556602478,
-0.14742650091648102,
0.7215542197227478,
-0.4827730357646942,
0.819339513778686... |
func (p *KVServer) GetChildren(req GetChildrenRequest, resp *GetChildrenResponse) error {
hash := req.ParentHash
if hash == "" {
hash = genesisHash
}
mutex.Lock()
parentBlock := blockChain[hash]
mutex.Unlock()
resp.Children = parentBlock.ChildrenHashes
return nil
} | [
0.4320606589317322,
0.917069673538208,
0.5750741362571716,
0.8983088731765747,
0.3962068259716034,
-0.2552699148654938,
0.15386183559894562,
-0.9656435251235962,
-0.295784592628479,
-0.7133885622024536,
-0.8177763819694519,
0.2579101622104645,
-1.340341567993164,
0.16492189466953278,
0.3... |
func (p *KVServer) NewTransaction(req bool, resp *NewTransactionResp) error {
txID := nextTransactionID
nextTransactionID = nextTransactionID + 10
mutex.Lock()
kvStore := keyValueStore
mutex.Unlock()
*resp = NewTransactionResp{txID, kvStore}
return nil
} | [
-0.28836947679519653,
0.5401518940925598,
0.42718952894210815,
-0.2945651113986969,
0.07774189859628677,
-0.4517194330692291,
-0.13644137978553772,
-0.17455826699733734,
0.6087860465049744,
0.3903069496154785,
-0.7090874314308167,
-0.8549119830131531,
-0.9865699410438538,
-0.03650695085525... |
func (p *KVServer) Commit(req CommitRequest, resp *CommitResponse) error {
fmt.Println("Received a call to Commit(", req, ")")
tx := req.Transaction
mutex.Lock()
transactions[tx.ID] = tx
mutex.Unlock()
isGenerateNoOps = false
for isWorkingOnNoOp {
// This stopped it from hanging... !
time.Sleep(time.Millisec... | [
-0.28202489018440247,
-0.27039894461631775,
1.018171787261963,
0.37245500087738037,
0.3999093472957611,
0.14515984058380127,
-0.10708613693714142,
-0.3237340450286865,
-0.3191335201263428,
0.7936537861824036,
0.8776086568832397,
-0.4389169216156006,
-0.9065889716148376,
0.2638070285320282,... |
func isCommitPossible(requiredKeyValues map[Key]Value) bool {
for k := range requiredKeyValues {
mutex.Lock()
val, ok := keyValueStore[k]
mutex.Unlock()
if ok && val != requiredKeyValues[k] {
return false
} else if !ok && val != "" {
return false
}
}
return true
} | [
-0.6396710872650146,
-0.3425111770629883,
0.5853223204612732,
0.029319660738110542,
-0.504314661026001,
0.4800938367843628,
-1.1066292524337769,
0.34326672554016113,
-1.1890641450881958,
1.4243954420089722,
0.4014982283115387,
-0.2965625524520874,
-1.0308345556259155,
1.0247793197631836,
... |
func validateCommit(req CommitRequest) {
fmt.Println("In validateCommit()")
for {
// always refresh the hashes list in case other block for same tx has been added
mutex.Lock()
tx := transactions[req.Transaction.ID]
mutex.Unlock()
hashes := tx.AllHashes
for _, hash := range hashes {
mutex.Lock()
bloc... | [
0.2839387357234955,
-0.486262708902359,
0.7942532896995544,
0.5219053626060486,
0.4123073220252991,
0.028524916619062424,
0.12186241149902344,
-0.7123034000396729,
-1.2433712482452393,
0.4208827018737793,
0.37984853982925415,
-0.23579780757427216,
-1.0534061193466187,
0.663733959197998,
... |
func isBlockValidated(block Block, validateNum int) bool {
if validateNum == 0 {
return true
} else {
for _, child := range block.ChildrenHashes {
mutex.Lock()
childBlock := blockChain[child]
mutex.Unlock()
fmt.Println("The child block has depth:", childBlock.Depth)
if isBlockValidated(childBlock, ... | [
0.2950004041194916,
-0.029015159234404564,
1.1308764219284058,
1.4065669775009155,
-0.1490112841129303,
0.17141464352607727,
0.4376966953277588,
0.005955887958407402,
-0.18757270276546478,
-0.8426632285118103,
-0.7721074223518372,
0.34724849462509155,
-1.2695579528808594,
0.993143200874328... |
func generateCommitBlock(txid int, requiredKeyValues map[Key]Value) string {
fmt.Println("Generating a Commit Block...")
mutex.Lock()
putSet := transactions[txid].PutSet
mutex.Unlock()
block := Block{PutSet: putSet, HashBlock: HashBlock{TxID: txid, NodeID: myNodeID, Nonce: 0}}
for {
if isGenerateCommits {
is... | [
-0.46311885118484497,
0.2788870930671692,
0.882862389087677,
0.1068672314286232,
-0.659180223941803,
0.8391027450561523,
-0.5383121371269226,
-0.3579738438129425,
-1.1422843933105469,
0.497665137052536,
0.18946056067943573,
-0.12618590891361237,
-1.5130170583724976,
0.7604333758354187,
-... |
func isBlockInChain(txid int) (bool, string) {
mutex.Lock()
tx := transactions[txid]
mutex.Unlock()
if tx.IsCommitted {
return true, tx.CommitHash
} else {
return false, ""
}
} | [
-0.001676603453233838,
-0.2478867769241333,
0.8620395064353943,
0.07465675473213196,
-0.17144666612148285,
-0.41827282309532166,
-0.6626584529876709,
-0.15754902362823486,
-0.5313994288444519,
0.6960678696632385,
-1.306036114692688,
0.08353010565042496,
-1.3998042345046997,
0.2738342881202... |
func isLeadingNumZeroCharacters(hash []byte) bool {
if numLeadingZeroes == 0 {
return true
} else {
for i := 0; i < numLeadingZeroes; i++ {
if rune(hash[i]) == '0' {
continue
} else {
return false
}
}
return true
}
} | [
0.45282813906669617,
-0.7098192572593689,
0.7188119292259216,
0.3046249747276306,
0.005635009612888098,
0.15726760029792786,
-0.15394394099712372,
1.0402312278747559,
0.24612443149089813,
-0.2402758151292801,
0.39749905467033386,
-0.33145809173583984,
-1.021889567375183,
1.351547122001648,... |
func isLeadingNumZeroes(hash []byte) bool {
if numLeadingZeroes == 0 {
return true
} else {
i := 0
numZeroes := numLeadingZeroes
for {
// numZeroes <= 8, byte at hash[i] will determine validity
if numZeroes-8 <= 0 {
break
} else {
// numZeroes is greater than 8, byte at hash[i] must be zero
... | [
0.5192433595657349,
-0.997104823589325,
0.6564197540283203,
0.18268920481204987,
-0.11051733791828156,
0.43033626675605774,
0.003503149840980768,
0.48094210028648376,
0.6690628528594971,
-0.416279673576355,
-0.0917142927646637,
-0.14493915438652039,
-1.0723426342010498,
1.2998332977294922,... |
func addToBlockChain(block Block) {
mutex.Lock()
blockChain[block.Hash] = block
mutex.Unlock()
setParentsNewChild(block)
updateLeafBlocks(block)
hBlock := block.HashBlock
txid := hBlock.TxID
// a Commit transaction
if txid > 0 {
mutex.Lock()
tx := transactions[txid]
mutex.Unlock()
putSet := tx.PutSet
... | [
0.07532219588756561,
0.09945164620876312,
0.9644345045089722,
0.16422581672668457,
0.5402018427848816,
0.40572482347488403,
0.13939166069030762,
-0.4144025444984436,
0.024639703333377838,
0.2251882702112198,
-0.6955787539482117,
-0.40518125891685486,
-0.6955503821372986,
0.6096771359443665... |
func updateLeafBlocks(block Block) {
mutex.Lock()
leafBlocks[block.Hash] = block
mutex.Unlock()
for leafBlockHash := range leafBlocks {
mutex.Lock()
leafBlock := leafBlocks[leafBlockHash]
mutex.Unlock()
// Remove blocks with lesser depth
if leafBlock.Depth < block.Depth {
mutex.Lock()
delete(leafBlo... | [
0.11208900809288025,
-1.1185722351074219,
0.8778942823410034,
0.23710016906261444,
-0.6009238362312317,
0.4343528151512146,
-0.11854566633701324,
-0.9158157706260681,
-0.16704948246479034,
0.37575116753578186,
-0.18732167780399323,
0.3728957176208496,
-1.0471694469451904,
0.704277098178863... |
func setParentsNewChild(block Block) {
mutex.Lock()
parentBlock, ok := blockChain[block.HashBlock.ParentHash]
mutex.Unlock()
if !ok {
}
children := parentBlock.ChildrenHashes
children = append(children, block.Hash)
parentBlock.ChildrenHashes = children
mutex.Lock()
blockChain[parentBlock.Hash] = parentBlock
... | [
0.6942971348762512,
0.036213625222444534,
0.7330678105354309,
0.07112890481948853,
-0.19335168600082397,
0.5004217624664307,
0.19817432761192322,
-0.7992337346076965,
-0.8878787159919739,
0.08778807520866394,
-1.072575569152832,
-0.38752543926239014,
-0.9514620900154114,
0.8338006138801575... |
func listenNodeRPCs() {
kvNode := rpc.NewServer()
kv := new(KVNode)
kvNode.Register(kv)
l, err := net.Listen("tcp", listenKVNodeIpPort)
checkError("Error in listenNodeRPCs(), net.Listen()", err, true)
fmt.Println("Listening for node RPC calls on:", listenKVNodeIpPort)
for {
conn, err := l.Accept()
checkError... | [
0.12274982035160065,
0.012688175775110722,
0.6030139923095703,
-0.9021680951118469,
0.23878782987594604,
0.12256012856960297,
-1.1835497617721558,
-0.559349000453949,
-0.8990457057952881,
0.4156360328197479,
0.30390599370002747,
0.1600675880908966,
-0.6760789752006531,
0.8764228820800781,
... |
func listenClientRPCs() {
kvServer := rpc.NewServer()
kv := new(KVServer)
kvServer.Register(kv)
l, err := net.Listen("tcp", listenClientIpPort)
checkError("Error in listenClientRPCs(), net.Listen()", err, true)
fmt.Println("Listening for client RPC calls on:", listenClientIpPort)
for {
conn, err := l.Accept()
... | [
0.750666081905365,
-0.4881162643432617,
0.6366639733314514,
-1.1658457517623901,
0.38224735856056213,
0.6945926547050476,
-0.6360900402069092,
-0.4929739236831665,
-0.7822187542915344,
0.09342982620000839,
0.10063804686069489,
-0.397476464509964,
-0.7066802382469177,
0.6992843151092529,
... |
func ParseArguments() (err error) {
arguments := os.Args[1:]
if len(arguments) == 6 {
genesisHash = arguments[0]
numLeadingZeroes, err = strconv.Atoi(arguments[1])
checkError("Error in ParseArguments(), strconv.Atoi(arguments[1]):", err, true)
nodeIpAndStatuses = parseNodeFile(arguments[2])
myNodeID, err = ... | [
0.017327403649687767,
0.37025347352027893,
0.8577451705932617,
-0.05463588237762451,
0.5641815662384033,
0.16862666606903076,
-0.5887672901153564,
0.025786710903048515,
-1.4613003730773926,
0.49545443058013916,
0.7040679454803467,
-0.022767487913370132,
-0.9695379734039307,
0.2596465051174... |
func checkError(msg string, err error, exit bool) {
if err != nil {
log.Println(msg, err)
if exit {
os.Exit(-1)
}
}
} | [
0.6460488438606262,
-0.3420791029930115,
0.46212342381477356,
1.3148092031478882,
0.03762970492243767,
0.5370286107063293,
-0.24808481335639954,
1.327307105064392,
-0.186361163854599,
0.9505887627601624,
0.8097814321517944,
0.7168470025062561,
-0.5949339866638184,
1.0883572101593018,
0.9... |
func (mif *MetricInterFlow) ExportClusters(protocolKey common.ProtocolKeyType) *common.ExportUnivariateClusterFormat {
return mif.interFlowTimes.ExportClusters(protocolKey)
} | [
-0.4434839189052582,
0.8167544007301331,
0.16268306970596313,
0.11120463907718658,
0.256202757358551,
-0.26092231273651123,
0.9709464907646179,
-1.236549973487854,
0.693832516670227,
0.5386152863502502,
0.33949118852615356,
-0.03806906193494797,
-2.1245388984680176,
-0.21097387373447418,
... |
func (mif *MetricInterFlow) GetProtocols() []common.Protocol {
return mif.interFlowTimes.GetProtocols()
} | [
0.4114115536212921,
0.605256199836731,
0.48874709010124207,
0.8113304376602173,
0.7588943839073181,
0.005090423859655857,
0.3702903985977173,
-1.0323996543884277,
0.1877916306257248,
0.13402362167835236,
0.017210423946380615,
-0.21989504992961884,
-1.9439148902893066,
-0.10274767875671387,... |
func (mif *MetricInterFlow) Name() string {
return "InterFlowTimes"
} | [
0.5638482570648193,
-0.6390206217765808,
0.5481683611869812,
-0.1505877822637558,
-0.5741138458251953,
0.12501436471939087,
0.7715227603912354,
0.24943256378173828,
-0.36698970198631287,
1.0904303789138794,
-0.05423244833946228,
-0.7059135437011719,
-0.951882541179657,
-0.39012283086776733... |
func (mif *MetricInterFlow) PrintStatistic(verbose bool) {
fmt.Println("Metric InterFlowTimes:")
fmt.Print(mif.interFlowTimes.GetStatistics(verbose))
} | [
1.202047348022461,
0.6314667463302612,
0.5847960114479065,
0.8013579845428467,
0.9089030623435974,
-0.2901468575000763,
0.07503306865692139,
-0.022042052820324898,
-1.1476854085922241,
1.0538179874420166,
0.22785407304763794,
0.6822950839996338,
-0.8838893175125122,
-0.5353155732154846,
... |
func (t *MedChain) Init(stub shim.ChaincodeStubInterface) peer.Response {
return shim.Success([]byte("successful initialization"))
} | [
-0.5272106528282166,
-0.013263036496937275,
0.4376451373100281,
-0.44877317547798157,
0.36017197370529175,
-0.043128181248903275,
-0.09182906150817871,
-0.3123777210712433,
0.0464291013777256,
-0.86793053150177,
-0.24185174703598022,
1.1743874549865723,
-0.9685536623001099,
0.7171501517295... |
func (t *MedChain) Invoke(stub shim.ChaincodeStubInterface) peer.Response {
function, args := stub.GetFunctionAndParameters()
fmt.Println("\n\n------------------\n")
fmt.Println("invoke is running -> "+ function)
// Handle different functions
if function == "queryAsset" {
return t.queryAsset(stub, arg... | [
-0.574131190776825,
-0.47896307706832886,
1.0087590217590332,
-0.3917274475097656,
0.543860137462616,
-0.3319103717803955,
-0.18945743143558502,
-0.1429242342710495,
-0.3854322135448456,
-0.6271148324012756,
0.5392270088195801,
0.3729114532470703,
-0.6804589629173279,
0.08351418375968933,
... |
func (t *MedChain) addHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start addHospital")
// check if all the args are send
if len(args) != 3 {
fmt.Println("Incorrect number of arguments, Required 3 arguments")
return shim.Error("Inco... | [
-0.2254224270582199,
-0.27280715107917786,
1.1761093139648438,
-0.35637742280960083,
0.9574951529502869,
1.0301463603973389,
0.055107876658439636,
-0.04963679239153862,
-0.45573732256889343,
0.5699779391288757,
-0.1623201072216034,
0.3719634413719177,
-0.8151626586914062,
-0.21540513634681... |
func (t *MedChain) updateHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start updateHospital")
// check if all the args are send
if len(args) != 4 {
return shim.Error("Incorrect number of arguments, Required 4 arguments")
}
// chec... | [
-0.7698304057121277,
-0.9720273017883301,
1.054435133934021,
-0.24364973604679108,
0.004938821773976088,
0.7842496037483215,
0.28139880299568176,
-0.4825606644153595,
-0.3703041076660156,
0.43368324637413025,
-0.19543631374835968,
0.8287215828895569,
-0.41718894243240356,
-0.46775311231613... |
func (t *MedChain) getAllHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start getAllHospital")
AssetType := "Hospital"
queryString := fmt.Sprintf("SELECT valueJson FROM <STATE> WHERE json_extract(valueJson, '$.AssetType') = '%s'", AssetTy... | [
-0.573564350605011,
-0.027088940143585205,
0.8626717925071716,
0.2961695194244385,
-0.0787985771894455,
0.17038965225219727,
-0.19136452674865723,
-0.8323540687561035,
0.39637815952301025,
-0.46831467747688293,
0.3086938261985779,
0.9952080845832825,
-0.14499957859516144,
0.377869546413421... |
func (t *MedChain) addHospitalToPatient(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start addHospitalToPatient")
// check if all the args are send
if len(args) != 4 {
fmt.Println("Incorrect number of arguments, Required 4 arguments")
retur... | [
-0.4643087685108185,
-0.3971109390258789,
1.082918405532837,
-0.9156763553619385,
0.7685407400131226,
0.7580310702323914,
-0.21279004216194153,
0.03997405618429184,
-0.5204222798347473,
0.9638970494270325,
-0.4427582025527954,
-0.4768912196159363,
-0.503198504447937,
-0.5808370113372803,
... |
func (t *MedChain) updateHospitalToPatient(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start updateHospitalToPatient")
// check if all the args are send
if len(args) != 5 {
return shim.Error("Incorrect number of arguments, Required 5 argument... | [
-0.6752614378929138,
-1.2249770164489746,
0.9352877736091614,
-0.8307521939277649,
-0.19794662296772003,
0.6587756276130676,
-0.016473276540637016,
-0.19789884984493256,
-0.6081308722496033,
0.9018067121505737,
-0.40682655572891235,
-0.0842268168926239,
-0.24384306371212006,
-0.93334847688... |
func (t *MedChain) getAllHospitalToPatient(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start getAllHospitalToPatient")
AssetType := "HospitalToPatient"
queryString := fmt.Sprintf("SELECT valueJson FROM <STATE> WHERE json_extract(valueJson, '$.A... | [
-0.6932365298271179,
-0.42633256316185,
0.8406198024749756,
-0.5622661709785461,
0.04008890688419342,
0.0468345545232296,
-0.5024316310882568,
-0.3984566926956177,
0.03312373533844948,
0.22813349962234497,
0.12436972558498383,
-0.11513898521661758,
-0.06606832146644592,
-0.3249886929988861... |
func (t *MedChain) queryAsset(APIstub shim.ChaincodeStubInterface, args []string) peer.Response {
if len(args) != 1 {
return shim.Error("Incorrect number of arguments, Required 1")
}
fmt.Println(fmt.Sprintf("- start queryAsset: %s\n", args))
AssetAsBytes, _ := APIstub.GetState(args[0])
if AssetAsBytes =... | [
-0.6126750111579895,
-0.044325657188892365,
0.5433844327926636,
-1.0918453931808472,
0.1240478903055191,
-0.12086206674575806,
-0.32421010732650757,
-1.1919467449188232,
-0.14523783326148987,
-0.5552457571029663,
0.9647486209869385,
0.6464143395423889,
-0.6743163466453552,
-0.3173519968986... |
func (t *MedChain) getAll(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println("- start getAll")
// query
queryString := "SELECT blockNo, key, valueJson FROM <STATE> WHERE 1"
queryResults, err := getQueryResultForQueryString(stub, queryString)
if... | [
0.007745940238237381,
-0.0838640108704567,
0.8942863941192627,
0.605832576751709,
-0.2519241273403168,
-0.33331534266471863,
-0.24084219336509705,
-0.46932700276374817,
-0.11938797682523727,
-0.4347354471683502,
0.20197910070419312,
0.8394856452941895,
-0.3235704004764557,
0.61344939470291... |
func (t *MedChain) getHistoryForRecord(stub shim.ChaincodeStubInterface, args []string) peer.Response {
// ==== Input sanitation ====
fmt.Println(fmt.Sprintf("- start getHistoryForRecord: %s\n", args))
var parentHistObj []HistoryObject
transactionBytes := t.getHistory(stub, args[0])
var data []HistoryObjec... | [
0.09831969439983368,
0.7501584887504578,
0.8054451942443848,
-0.4383995532989502,
0.07999232411384583,
-0.4455178380012512,
0.6666369438171387,
-0.6013085246086121,
-0.2362867295742035,
-0.0919230505824089,
-0.34009233117103577,
0.5468524098396301,
-0.2233833223581314,
0.5672388076782227,
... |
func (t *MedChain) getHistory(stub shim.ChaincodeStubInterface, recordKey string) []byte {
fmt.Printf("- start getHistory: %s\n", recordKey)
resultsIterator, err := stub.GetHistoryForKey(recordKey)
if err != nil {
errors.New(err.Error())
// return shim.Error(err.Error())
}
defer resultsIterator.Close()... | [
-0.04692227393388748,
0.031697601079940796,
0.9352617263793945,
-0.5417064428329468,
0.45176875591278076,
-1.174588918685913,
-0.2635537087917328,
-0.6676203012466431,
0.10151141881942749,
0.3982916474342346,
0.3937739133834839,
0.4847516417503357,
-0.2940419018268585,
0.6152368783950806,
... |
func getQueryResultForQueryString(stub shim.ChaincodeStubInterface, queryString string) ([]byte, error) {
fmt.Printf("- getQueryResultForQueryString queryString:\n%s\n", queryString)
resultsIterator, err := stub.GetQueryResult(queryString)
if err != nil {
return nil, err
}
defer resultsIterator.Close()
... | [
-0.30943259596824646,
-0.8330760598182678,
0.6443607807159424,
-1.211343765258789,
-0.14528411626815796,
-0.7103391289710999,
-0.16630525887012482,
-1.3118327856063843,
0.21855616569519043,
-0.24281015992164612,
-0.35868093371391296,
-0.02906372956931591,
-0.5546169281005859,
-0.0789098218... |
func ComputeHashKey(propertyName string) string {
h := sha256.New()
h.Write([]byte(propertyName))
nameInBytes := h.Sum([]byte(""))
nameInString := hex.EncodeToString(nameInBytes)
return nameInString[:62]
} | [
-0.17712512612342834,
-0.504700779914856,
0.8025906085968018,
-0.13211297988891602,
-0.1948067992925644,
0.30483224987983704,
-0.3738628029823303,
0.65950608253479,
-0.012105177156627178,
0.9112764596939087,
0.09775562584400177,
-0.2745392918586731,
-0.3858705759048462,
-0.3860780000686645... |
func (t *MedChain) GetTxTimestampChannel(APIstub shim.ChaincodeStubInterface) (time.Time, error) {
txTimeAsPtr, err := APIstub.GetTxTimestamp()
if err != nil {
fmt.Printf("Returning error in TimeStamp \n")
}
fmt.Printf("\t returned value from APIstub: %v\n", txTimeAsPtr)
timeInt := time.Unix(txTimeAsPtr.Se... | [
-0.30439287424087524,
0.22948099672794342,
0.5867432951927185,
-1.7044141292572021,
0.21669873595237732,
-0.6242755651473999,
-0.45932668447494507,
-0.249780535697937,
-0.4419594407081604,
0.4475121796131134,
-0.2314358800649643,
0.14459717273712158,
-0.7129756212234497,
0.4373195469379425... |
func New(host string) *PubSub {
ps := PubSub{
host: host,
}
// PRETEND THERE IS A SPECIFIC IMPLEMENTATION.
return &ps
} | [
0.41363051533699036,
-0.019575776532292366,
0.24053595960140228,
0.20364978909492493,
-0.9495589137077332,
0.07000818103551865,
-0.9042017459869385,
0.5423868298530579,
-1.0434633493423462,
-0.7739599943161011,
-0.2882501482963562,
0.29668405652046204,
0.08865446597337723,
0.57822263240814... |
func (ps *PubSub) Publish(key string, v interface{}) error {
fmt.Println()
fmt.Printf(
`Pubsub on the host: %s
is going to publish the value: %s
to the topic: %s`,
ps.host, v, key)
fmt.Println()
// PRETEND THERE IS A SPECIFIC IMPLEMENTATION.
return nil
} | [
0.34420692920684814,
0.3851183354854584,
0.2873842120170593,
0.3212112784385681,
0.024495448917150497,
0.47673583030700684,
-0.5277919173240662,
0.7790080308914185,
-1.1953634023666382,
-0.20540285110473633,
0.5421684980392456,
1.2369495630264282,
-0.6436076760292053,
0.8676626086235046,
... |
func (ps *PubSub) Subscribe(key string) error {
// PRETEND THERE IS A SPECIFIC IMPLEMENTATION.
return nil
} | [
-0.4366653263568878,
0.6567217111587524,
0.2605282962322235,
0.4668903946876526,
-0.11267901957035065,
0.16582952439785004,
-0.9186187386512756,
0.08948954939842224,
-0.3636840581893921,
-0.417777955532074,
-0.41518065333366394,
0.12028096616268158,
-0.4049990475177765,
0.6389661431312561,... |
func largestTriangleArea(points [][]int) float64 {
} | [
0.8806778788566589,
-0.46132227778434753,
0.3788623809814453,
-0.2671526372432709,
0.1633627563714981,
-0.16908854246139526,
0.9135316610336304,
0.0758482813835144,
0.915352463722229,
1.1476718187332153,
1.0016810894012451,
-0.4782111644744873,
1.1509644985198975,
0.6479395031929016,
-0.... |
func (s *TaskDetails) MarshalJSONObject(enc *gojay.Encoder) {
s.TaskMeta.MarshalJSONObject(enc)
enc.AddStringKey(JsKeyDescription, s.Description)
enc.AddObjectKey(JsKeyCreator, &s.Creator)
enc.AddArrayKeyOmitEmpty(JsKeyAssignees, s.Assignees)
enc.AddArrayKeyOmitEmpty(JsKeySteps, s.Steps)
enc.AddTimeKey(JsKeyCrea... | [
0.6929851770401001,
0.35711589455604553,
0.6883513927459717,
-0.31127193570137024,
-0.8509871363639832,
0.10296079516410828,
0.010125236585736275,
-0.3415209650993347,
-0.7231346368789673,
0.04194452241063118,
-1.3747260570526123,
0.7809686064720154,
1.0263622999191284,
0.4072675108909607,... |
func (s *TaskDetails) UnmarshalJSONObject(d *gojay.Decoder, k string) error {
switch k {
case JsKeyDescription:
return d.String(&s.Description)
case JsKeyCreator:
return d.Object(&s.Creator)
case JsKeyAssignees:
return d.Array(&s.Assignees)
case JsKeySteps:
return d.Array(&s.Steps)
case JsKeyCreated:
re... | [
0.5062429308891296,
0.5772137641906738,
0.8385068774223328,
-0.7515523433685303,
-1.3883872032165527,
-0.2690327763557434,
0.12072024494409561,
-0.3209974765777588,
-0.5738688707351685,
0.24294717609882355,
-1.2990084886550903,
0.11497876793146133,
0.82065749168396,
0.4128292500972748,
-... |
func (s *TaskDetails) NKeys() int {
return 7 + s.TaskMeta.NKeys()
} | [
-0.11215673387050629,
1.4408822059631348,
0.33976075053215027,
-0.3309788405895233,
-0.5457158088684082,
-0.44267335534095764,
0.21198724210262299,
-0.6134925484657288,
-0.5256896615028381,
0.7600377798080444,
-0.1687505692243576,
-0.019859569147229195,
0.3445517420768738,
0.65946590900421... |
func (s TaskDetails) IsNil() bool {
return false
} | [
0.6502249240875244,
-0.023299211636185646,
0.3566330373287201,
0.5727935433387756,
-0.7696770429611206,
1.0969029664993286,
0.19929076731204987,
-0.11368758231401443,
-0.42704445123672485,
-0.12490818649530411,
-1.1574448347091675,
0.038083966821432114,
0.06802622228860855,
0.4335376322269... |
func AddTraceID(s opentracing.Span, id string) {
if id != "" {
s.SetTag("traceID", id)
}
} | [
1.0707809925079346,
0.250629723072052,
0.6015239357948303,
-0.03394198790192604,
0.6016426086425781,
0.7155827283859253,
-0.4365231394767761,
0.03459189459681511,
1.9309685230255127,
0.6837670803070068,
-0.13839533925056458,
0.35616162419319153,
-0.18190371990203857,
0.8294486403465271,
... |
func (c ColDate) Rows() int {
return len(c)
} | [
-0.33287832140922546,
1.3864384889602661,
0.25078508257865906,
-0.3244312107563019,
-0.051018767058849335,
0.37998566031455994,
0.3574543595314026,
0.9222191572189331,
0.05067063868045807,
-1.214515209197998,
-0.7742829918861389,
-0.9669843316078186,
0.026530899107456207,
1.185770869255066... |
func (c *ColDate) Reset() {
*c = (*c)[:0]
} | [
0.013217429630458355,
0.2745121717453003,
0.16016939282417297,
0.4767305254936218,
0.5027568340301514,
0.3052930235862732,
0.6425934433937073,
-0.28439098596572876,
-1.3086295127868652,
-0.35687169432640076,
-0.6663882732391357,
0.5082755088806152,
-0.565398097038269,
-0.07020585983991623,... |
func (ColDate) Type() ColumnType {
return ColumnTypeDate
} | [
-0.2988220155239105,
0.5528516173362732,
0.3954429626464844,
1.0825928449630737,
-0.12692975997924805,
0.7809213399887085,
0.9553238153457642,
-0.838217556476593,
-0.13157394528388977,
-0.6705621480941772,
-0.8580337166786194,
0.1166059821844101,
-0.5089349746704102,
0.9695842862129211,
... |
func Run(ctx context.Context, opts ...Option) error {
return New(opts...).Run(ctx)
} | [
0.09527302533388138,
-0.3337187170982361,
0.36403942108154297,
0.39403828978538513,
-0.13670851290225983,
0.16459622979164124,
-0.3374415934085846,
-0.4428432881832123,
0.6876025795936584,
-0.8586283922195435,
-0.5722312927246094,
0.6809600591659546,
-0.25587892532348633,
-0.87488430738449... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.