text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func SetDatabase(database *db.Resource) {
Resource = database
classCollection{}.Start()
userCollection{}.Start()
quizCollection{}.Start()
} | [
-0.5894508957862854,
0.25400158762931824,
0.07208851724863052,
0.6179474592208862,
0.9198998808860779,
0.8899446725845337,
0.6792521476745605,
-0.49552685022354126,
0.87233567237854,
-0.45957836508750916,
-1.0700466632843018,
-0.08427495509386063,
-0.44523078203201294,
1.4161158800125122,
... |
func GetDefaultEventOptions() *EventOptions {
options := EventOptions{
DefaultMaxSourceIDLength,
DefaultMaxEventTypeLength,
DefaultMaxEventTypeVersionLength,
}
return &options
} | [
0.2963389754295349,
0.27377110719680786,
0.31076279282569885,
0.3908926546573639,
1.5598126649856567,
-0.12255333364009857,
-0.4325997233390808,
-0.3856697678565979,
0.7759971022605896,
-0.6445065140724182,
-1.4924533367156982,
0.08027947694063187,
-0.821855366230011,
0.3351331055164337,
... |
func SendState(c *cli.Context, messageType message.MessageType) {
destination, hostname, err := parseHosts(c)
if err != nil {
fmt.Fprintf(os.Stderr, "Error parsing options: %v", err)
os.Exit(1)
}
if len(c.Args()) < 2 {
fmt.Fprintf(os.Stderr, "Must provide an event name: %v", c.Args())
os.Exit(1)
}
cont... | [
-0.5778429508209229,
0.4997328221797943,
0.9912400841712952,
0.10007250308990479,
-0.07519248127937317,
0.39101356267929077,
0.25210949778556824,
-0.47094815969467163,
-0.23262661695480347,
0.3901282250881195,
0.24034373462200165,
0.12085207551717758,
-0.2877308130264282,
0.176424697041511... |
func (c CIELab) RGBA() (r, g, b, a uint32) {
r, g, b = cieLabToRGB(c.L, c.A, c.B)
a = 0xffff
return
} | [
-0.5925056338310242,
-0.6443312764167786,
0.5963777303695679,
0.10295303910970688,
0.7450356483459473,
-0.15344487130641937,
0.17791840434074402,
-0.7980876564979553,
-0.6085731983184814,
0.24784216284751892,
-0.5787403583526611,
0.05219593644142151,
-0.9487048387527466,
1.2570405006408691... |
func (installParam InstallParam) ToIcAgentIstallMap() (map[string]interface{}, error) {
return golangsdk.BuildRequestBody(installParam, "")
} | [
-0.3308298885822296,
-0.7894326448440552,
0.5717154741287231,
0.15949659049510956,
0.160887211561203,
-0.5096924901008606,
0.35116106271743774,
0.2140972912311554,
0.3540201485157013,
1.6176846027374268,
0.09563007950782776,
-0.2508141100406647,
-0.3378733694553375,
0.33141157031059265,
... |
func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToIcAgentIstallMap()
if err != nil {
r.Err = err
return
}
reqOpt := &golangsdk.RequestOpts{OkCodes: []int{200}}
_, r.Err = c.Post(rootURL(c), b, &r.Body, reqOpt)
return
} | [
-0.7083057165145874,
0.2930692136287689,
0.5249966979026794,
0.5373943448066711,
0.2493067979812622,
-0.20840036869049072,
-0.36425909399986267,
-0.6111986637115479,
-0.32555389404296875,
0.9638933539390564,
0.3904420733451843,
-0.18547871708869934,
-0.6942352056503296,
-0.4158326387405395... |
func Detect_if_anagram(str1 string , str2 string) bool {
var length1 = len(str1)
var length2 = len(str2)
if length1 != length2 {
return false
} else {
str1 := Sort_String(str1)
str2 := Sort_String(str2)
fmt.Println("1. " , str1)
fmt.Println("2. " , str2)
if str1 == str2 {
return tru... | [
0.6420852541923523,
-0.7239678502082825,
0.7971116900444031,
0.9744839072227478,
-0.8692420721054077,
0.003843623911961913,
-0.16808275878429413,
-1.179063320159912,
-0.1968395859003067,
0.641046941280365,
-0.06552021950483322,
1.4146777391433716,
-0.6594446897506714,
-0.00844545103609562,... |
func Detect_If_String_Has_Unique_Chars(str string) bool {
//1. itterate through all the chars and check to see if the char exist in the map if it does return false if not return true.
//var myMap map[byte]bool
myMap := make(map[byte]bool)
//loop through string
/*fmt.Println("Ivan was here", str)
for i := 0... | [
-0.3375362753868103,
-1.1050381660461426,
0.6403377652168274,
-0.2870440185070038,
-0.19273512065410614,
-0.18220862746238708,
0.6743737459182739,
0.5723738670349121,
-0.05967722833156586,
-0.48377957940101624,
-0.7994698882102966,
0.46585145592689514,
-0.6013923287391663,
0.05496202036738... |
func Sort_String(str string) string {
newStr := strings.Split(str, "")
sort.Strings(newStr)
return strings.Join(newStr,"")
} | [
0.6247901916503906,
-0.7541463375091553,
0.47392699122428894,
-0.4025169610977173,
-0.9543061256408691,
0.2247513234615326,
0.14583073556423187,
-1.0868456363677979,
-0.1345892995595932,
0.30011704564094543,
0.4011964201927185,
0.9097859859466553,
-0.471550852060318,
-0.7862520217895508,
... |
func Reverse_String(s string) string {
r := []rune(s)
for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
r[i], r[j] = r[j], r[i]
}
return string(r)
} | [
-0.350372314453125,
-0.05624109134078026,
0.26924535632133484,
-1.0053447484970093,
-0.3553580641746521,
-0.750049352645874,
0.23385153710842133,
0.08655917644500732,
-0.785311758518219,
0.568846583366394,
-0.2769048511981964,
0.8233205080032349,
-0.22733184695243835,
-1.841334581375122,
... |
func Find_Smallest(arr []int ) {
fmt.Println("FIND SMALLEST VALUE")
var smallest = 99999999
for i:=1 ; i < len(arr) ; i++ {
//fmt.Println(arr[i])
if arr[i] <= smallest {
smallest = arr[i]
}
}
fmt.Println("Smallest: " , smallest )
} | [
1.178999423980713,
-0.38963544368743896,
0.5850775241851807,
-0.02889963611960411,
-0.31598082184791565,
0.06824036687612534,
0.9152703881263733,
-1.2987102270126343,
-0.29547426104545593,
-0.4525265097618103,
-0.04030080884695053,
0.047806769609451294,
-0.5167236328125,
1.7567144632339478... |
func Find_Largest(arr []int ) {
fmt.Println("FIND LARGEST VALUE")
var largest = -99999999
for i:=1 ; i < len(arr) ; i++ {
//fmt.Println(arr[i])
if largest <= arr[i] {
largest = arr[i]
}
}
fmt.Println("Largest: " , largest )
} | [
0.7436532974243164,
-0.18252666294574738,
0.7394564747810364,
0.4913308620452881,
0.09005685895681381,
0.6036331057548523,
0.5732871294021606,
-0.8587396144866943,
-0.2786882519721985,
-0.10931414365768433,
0.07590409368276596,
0.004846842028200626,
0.018285734578967094,
2.096543073654175,... |
func (p Person) greet() string {
return "Hello, my name is " + p.firstName + " " + p.lastName + " and I am " + strconv.Itoa(p.age)
} | [
-0.26947084069252014,
-1.0533528327941895,
0.6927011013031006,
-0.780665934085846,
-0.6414332985877991,
1.4015438556671143,
-1.3208242654800415,
0.2044219821691513,
-0.34498530626296997,
-0.3753843307495117,
-0.034733206033706665,
0.007830255664885044,
-0.12977398931980133,
0.4978345036506... |
func (p *Person) hasBirthday() {
p.age++
} | [
0.5779611468315125,
-0.02136036567389965,
0.6156975030899048,
0.6686555743217468,
1.0056957006454468,
0.28573301434516907,
-0.05827547237277031,
0.37978968024253845,
-0.6720841526985168,
-1.1959346532821655,
-0.7074541449546814,
-0.6881292462348938,
0.3591235280036926,
1.3692175149917603,
... |
func (remote *LocalRemote) Push(image, imageRoot string) error {
log.Println("pushing local", remote.Url.Path)
return remote.rsyncTo(imageRoot, "")
} | [
0.277839332818985,
-0.03424505889415741,
0.28018417954444885,
-0.07882243394851685,
-0.6338704228401184,
0.3371647000312805,
-0.8677461743354797,
-0.09978626668453217,
-0.07703454792499542,
0.5958920121192932,
-0.07535207271575928,
1.155083417892456,
-0.6066967844963074,
0.7485215663909912... |
func (remote *LocalRemote) PullImageId(id ID, dst string) error {
log.Println("pulling local", "images/"+id, "->", dst)
return remote.rsyncFrom("images/"+string(id), dst)
} | [
-0.4083389937877655,
-0.4291207194328308,
0.24129065871238708,
-0.6187639236450195,
-0.4886646568775177,
0.3158203959465027,
-1.4487524032592773,
0.6081928610801697,
0.5998313426971436,
1.1897029876708984,
-0.4709893763065338,
0.7700814008712769,
0.19416266679763794,
0.41443735361099243,
... |
func handler(w http.ResponseWriter, r *http.Request) {
// Writes to the client
fmt.Fprintf(w, "Hello World\n")
} | [
0.22228412330150604,
-0.8209177255630493,
0.37706780433654785,
-0.21604476869106293,
0.31041833758354187,
1.1285061836242676,
0.7451003193855286,
0.6150082945823669,
-0.7311134338378906,
-0.6431609988212585,
-0.02904011867940426,
-0.5370518565177917,
0.1383964568376541,
-0.0445396378636360... |
func EvalPackage(ctx context.Context, pkg *Package, input interface{}) (*results.ResultCollection, error) {
allResults := rego.ResultSet{}
for file, text := range pkg.Rego {
// Execute Open Policy Agent rules engine
r := rego.New(
rego.Query(pkg.PolicyManifest.RootQuery),
rego.Module(file, text),
rego.In... | [
-0.682377815246582,
0.08818820863962173,
0.6257120966911316,
-0.26886868476867676,
0.40205323696136475,
0.42999762296676636,
0.13602009415626526,
0.3014025390148163,
-0.029237357899546623,
0.43044090270996094,
0.3576662838459015,
-0.6108901500701904,
-0.8103379607200623,
0.5966092348098755... |
func getCiliumVersionString(epCHeaderFilePath string) ([]byte, error) {
f, err := os.Open(epCHeaderFilePath)
if err != nil {
return []byte{}, err
}
br := bufio.NewReader(f)
defer f.Close()
for {
b, err := br.ReadBytes('\n')
if errors.Is(err, io.EOF) {
return []byte{}, nil
}
if err != nil {
return ... | [
0.5011031627655029,
-1.498381495475769,
0.6526234149932861,
-0.06429752707481384,
-0.5647109746932983,
-0.5332077145576477,
-0.4349489212036133,
0.09482255578041077,
-0.2060782015323639,
1.6516202688217163,
-0.1892118602991104,
0.01258646696805954,
-0.7405633926391602,
0.2558017075061798,
... |
func ReadEPsFromDirNames(ctx context.Context, owner regeneration.Owner, policyGetter policyRepoGetter,
namedPortsGetter namedPortsGetter, basePath string, eptsDirNames []string) map[uint16]*Endpoint {
completeEPDirNames, incompleteEPDirNames := partitionEPDirNamesByRestoreStatus(eptsDirNames)
if len(incompleteEPDi... | [
-0.3014703691005707,
-0.815758466720581,
0.7883161306381226,
-0.1843702793121338,
0.16359157860279083,
-0.24945197999477386,
0.24062524735927582,
0.34844905138015747,
0.41087037324905396,
0.12663452327251434,
0.11857849359512329,
-0.3088941276073456,
0.14224573969841003,
0.5586220026016235... |
func partitionEPDirNamesByRestoreStatus(eptsDirNames []string) (complete []string, incomplete []string) {
dirNames := make(map[string]struct{}, len(eptsDirNames))
for _, epDirName := range eptsDirNames {
dirNames[epDirName] = struct{}{}
}
incompleteSuffixes := []string{nextDirectorySuffix, nextFailedDirectorySuf... | [
-0.37867462635040283,
-0.4451809823513031,
0.9068742990493774,
-0.9691533446311951,
-0.3862915635108948,
-0.43419018387794495,
0.14247119426727295,
0.5433223843574524,
1.0509169101715088,
0.584194540977478,
-0.3105809688568115,
-0.39382219314575195,
-0.3998076319694519,
0.1845393031835556,... |
func (e *Endpoint) RegenerateAfterRestore(regenerator *Regenerator) error {
if err := e.restoreIdentity(regenerator); err != nil {
return err
}
scopedLog := log.WithField(logfields.EndpointID, e.ID)
regenerationMetadata := ®eneration.ExternalRegenerationMetadata{
Reason: "syncing state to host",... | [
-0.4776307940483093,
-0.0204143188893795,
0.4857008159160614,
0.3427129089832306,
0.3034936189651489,
-0.4283439517021179,
-0.23916511237621307,
0.9025225043296814,
0.41581109166145325,
-0.2345409244298935,
-0.3875315189361572,
-0.4213908910751343,
-0.572418749332428,
-1.3468376398086548,
... |
func (e *Endpoint) toSerializedEndpoint() *serializableEndpoint {
return &serializableEndpoint{
ID: e.ID,
ContainerName: e.GetContainerName(),
ContainerID: e.GetContainerID(),
DockerNetworkID: e.dockerNetworkID,
DockerEndpointID: e.dockerEndpoin... | [
-0.4382779002189636,
-0.17218613624572754,
0.6227140426635742,
-0.18253210186958313,
0.5218636989593506,
-0.5612096190452576,
0.006205663084983826,
0.2946467399597168,
1.12358820438385,
0.42860326170921326,
-0.9121466875076294,
0.5963072180747986,
-0.6222589015960693,
0.1447383165359497,
... |
func (ep *Endpoint) UnmarshalJSON(raw []byte) error {
// We may have to populate structures in the Endpoint manually to do the
// translation from serializableEndpoint --> Endpoint.
restoredEp := &serializableEndpoint{
OpLabels: labels.NewOpLabels(),
DNSHistory: fqdn.NewDNSCacheWithLimit(option.Config.ToFQDNsM... | [
-0.9637379050254822,
0.3629470467567444,
0.464703768491745,
-0.2196035236120224,
-0.3547397255897522,
-0.6057961583137512,
0.3061811923980713,
0.8395388126373291,
0.9770432114601135,
0.043411340564489365,
-0.07721307128667831,
-0.2013012021780014,
-0.0018688116688281298,
-0.928449094295501... |
func (ep *Endpoint) MarshalJSON() ([]byte, error) {
return json.Marshal(ep.toSerializedEndpoint())
} | [
-0.8664727210998535,
-0.46231743693351746,
0.35554006695747375,
0.1918928027153015,
0.12425237149000168,
-0.17127729952335358,
-0.2639846205711365,
1.2552831172943115,
0.9236323237419128,
0.32383111119270325,
-0.4738210141658783,
0.8614344596862793,
-0.21252818405628204,
-0.261524289846420... |
func (o *OKEX) GetDefaultConfig() (*config.ExchangeConfig, error) {
o.SetDefaults()
exchCfg := new(config.ExchangeConfig)
exchCfg.Name = o.Name
exchCfg.HTTPTimeout = exchange.DefaultHTTPTimeout
exchCfg.BaseCurrencies = o.BaseCurrencies
err := o.SetupDefaults(exchCfg)
if err != nil {
return nil, err
}
if o.... | [
0.19127750396728516,
0.5609336495399475,
0.6685754656791687,
0.4632340967655182,
-0.37578916549682617,
-0.7246886491775513,
-0.8647072315216064,
-0.1948615312576294,
0.829669713973999,
0.2080431580543518,
-0.766498327255249,
0.297639399766922,
-0.7583180069923401,
0.17737625539302826,
-0... |
func (o *OKEX) SetDefaults() {
o.SetErrorDefaults()
o.SetCheckVarDefaults()
o.Name = okExExchangeName
o.Enabled = true
o.Verbose = true
o.API.CredentialsValidator.RequiresKey = true
o.API.CredentialsValidator.RequiresSecret = true
o.API.CredentialsValidator.RequiresClientID = true
o.CurrencyPairs = currency.P... | [
-0.5676038265228271,
0.2709377110004425,
0.7075421214103699,
-0.4370652735233307,
-0.5525916218757629,
-0.354798287153244,
-0.2793554663658142,
-0.5669220685958862,
0.4389990568161011,
-0.44949203729629517,
-0.8213528394699097,
-0.04595041647553444,
-0.12980036437511444,
-0.038037776947021... |
func (o *OKEX) Start(wg *sync.WaitGroup) {
wg.Add(1)
go func() {
o.Run()
wg.Done()
}()
} | [
0.05919559672474861,
0.6394304633140564,
0.396332710981369,
0.49150872230529785,
-0.6554451584815979,
-0.14562784135341644,
-0.07352016866207123,
-0.17489492893218994,
-0.7527300119400024,
0.4226936995983124,
-0.547250509262085,
1.2304092645645142,
-0.22822517156600952,
0.35645174980163574... |
func (o *OKEX) Run() {
if o.Verbose {
log.Debugf(log.ExchangeSys,
"%s Websocket: %s. (url: %s).\n",
o.Name,
common.IsEnabled(o.Websocket.IsEnabled()),
o.API.Endpoints.WebsocketURL)
}
delim := o.GetPairFormat(asset.Spot, false).Delimiter
forceUpdate := false
if !common.StringDataContains(o.GetEnabled... | [
-0.6675047874450684,
-0.2854229211807251,
0.7563238143920898,
-0.8329294323921204,
-0.7959455847740173,
-0.45420002937316895,
0.3702426850795746,
-0.009784376248717308,
0.26581239700317383,
0.8869162201881409,
-0.33996495604515076,
0.4456709027290344,
-0.706015408039093,
-0.181867033243179... |
func (o *OKEX) FetchTradablePairs(i asset.Item) ([]string, error) {
var pairs []string
switch i {
case asset.Spot:
prods, err := o.GetSpotTokenPairDetails()
if err != nil {
return nil, err
}
for x := range prods {
pairs = append(pairs,
currency.NewPairWithDelimiter(prods[x].BaseCurrency,
prod... | [
-0.9849680662155151,
-0.4417913854122162,
0.5921387672424316,
-0.6828857064247131,
-0.943476140499115,
-0.17594754695892334,
-0.6482742428779602,
-0.8324567079544067,
0.18349690735340118,
1.1310425996780396,
0.2607566714286804,
-0.2379559725522995,
-0.19588802754878998,
-0.1614377349615097... |
func (o *OKEX) UpdateTradablePairs(forceUpdate bool) error {
for x := range o.CurrencyPairs.AssetTypes {
if o.CurrencyPairs.AssetTypes[x] == asset.Index {
// Update from futures
continue
}
pairs, err := o.FetchTradablePairs(o.CurrencyPairs.AssetTypes[x])
if err != nil {
return err
}
if o.Currenc... | [
-1.672114610671997,
0.2528137266635895,
0.6713072061538696,
-0.9234912991523743,
-1.7704401016235352,
-0.33837729692459106,
-0.23940925300121307,
-0.6992819309234619,
-0.3807779848575592,
1.2023234367370605,
-0.15904103219509125,
-0.09442418068647385,
-0.7111684083938599,
-0.40105676651000... |
func (o *OKEX) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error) {
tickerPrice := new(ticker.Price)
switch assetType {
case asset.Spot:
resp, err := o.GetSpotAllTokenPairsInformation()
if err != nil {
return tickerPrice, err
}
for j := range resp {
if !o.GetEnabledPairs(assetTy... | [
-1.0299396514892578,
-0.9508826732635498,
0.8581370711326599,
-0.17173711955547333,
-1.0098637342453003,
-0.4080807864665985,
-0.0984441339969635,
-0.4465681314468384,
-0.5449633598327637,
0.49344542622566223,
0.2755824327468872,
-0.03280724585056305,
-0.6808900237083435,
0.289581567049026... |
func (o *OKEX) FetchTicker(p currency.Pair, assetType asset.Item) (tickerData *ticker.Price, err error) {
if assetType == asset.Index {
return tickerData, errors.New("ticker fetching not supported for index")
}
tickerData, err = ticker.GetTicker(o.Name, p, assetType)
if err != nil {
return o.UpdateTicker(p, ass... | [
-0.4641777575016022,
-0.1138056293129921,
0.33769866824150085,
0.06534402072429657,
-0.7399404644966125,
0.05096663907170296,
-0.09020109474658966,
-1.6660970449447632,
0.1605142503976822,
0.5817317366600037,
-0.06987933814525604,
0.20656976103782654,
-0.18844051659107208,
0.14930380880832... |
func (o *OKEX) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval time.Duration) (kline.Item, error) {
return kline.Item{}, common.ErrFunctionNotSupported
} | [
0.5325644016265869,
0.4956205487251282,
0.4915485978126526,
0.8238809704780579,
0.34077519178390503,
0.011392883025109768,
0.01833374612033367,
-0.8798494338989258,
-0.9161007404327393,
0.5238651037216187,
0.2667248845100403,
1.113206148147583,
-0.6103166937828064,
-0.9317563772201538,
1... |
func (c *ETCDCache) Get(key string) (value string, err error) {
kapi := client.NewKeysAPI(c.client)
resp, err := kapi.Get(context.Background(), c.prefix+"/"+key, nil)
logger := log.WithFields(log.Fields{"class": "ETCDCache", "method": "Get"})
defer func() {
if r := recover(); r != nil {
value = ""
err = Er... | [
-1.3692811727523804,
0.5124922394752502,
0.8890377879142761,
-0.07171023637056351,
-0.26847565174102783,
-0.5850215554237366,
-0.894740104675293,
-0.2958189845085144,
-1.0172799825668335,
1.4360640048980713,
0.09678858518600464,
-0.10956747829914093,
-0.09212590008974075,
0.127636998891830... |
func (c *ETCDCache) Set(key, value string) (err error) {
logger := log.WithFields(log.Fields{"class": "ETCDCache", "method": "Set"})
kapi := client.NewKeysAPI(c.client)
_, err = kapi.Set(context.Background(), c.prefix+"/"+key, value, c.options)
if _, ok := err.(*client.ClusterError); ok {
err = ErrStorageConnect... | [
-1.2407327890396118,
0.37617379426956177,
0.297066330909729,
-0.3036952614784241,
-0.5136587619781494,
0.29037654399871826,
-1.0532065629959106,
-0.25812727212905884,
-1.086199402809143,
1.3889131546020508,
0.0403483547270298,
0.12820743024349213,
-0.2499072551727295,
-0.09899372607469559,... |
func (c *ETCDCache) Remove(key string) (err error) {
logger := log.WithFields(log.Fields{"class": "ETCDCache", "method": "Remove"})
kapi := client.NewKeysAPI(c.client)
_, err = kapi.Delete(context.Background(), c.prefix+"/"+key, nil)
if _, ok := err.(*client.ClusterError); ok {
err = ErrStorageConnectionFailed
... | [
-1.1858878135681152,
0.5040424466133118,
0.4081094264984131,
-0.027440084144473076,
-1.1801483631134033,
-0.21038636565208435,
-0.5976190567016602,
0.8259280323982239,
-0.2833556830883026,
1.2996059656143188,
0.1642490178346634,
-0.6412189602851868,
-0.993675947189331,
0.33694493770599365,... |
func NewEtcdCache(endpoints []string, prefix string, ttl time.Duration) (*ETCDCache, error) {
cfg := client.Config{
Endpoints: endpoints,
Transport: client.DefaultTransport,
// set timeout per request to fail fast when the target endpoint is unavailable
HeaderTimeoutPerRequest: time.Second,
}
c, err := clie... | [
-0.3351159691810608,
-0.24206426739692688,
0.45897096395492554,
-0.34794631600379944,
-0.7200998067855835,
-0.15826556086540222,
-0.9279075860977173,
0.5325832962989807,
-0.7403529286384583,
0.8335883617401123,
0.6994414329528809,
-0.1986367553472519,
-0.02158929407596588,
-0.1152480393648... |
func NewRouter() *mux.Router {
routes := []util.Route{
util.Route{
Name: "Hosts",
Method: "GET",
Pattern: "/hosts",
HandlerFunc: getHosts,
},
util.Route{
Name: "Hosts",
Method: "GET",
Pattern: "/hosts/{id}",
HandlerFunc: getHostInfo,
},
util.Route{
N... | [
-0.5188586711883545,
0.07703366130590439,
0.7412253618240356,
0.47565969824790955,
-0.1571095734834671,
0.19384713470935822,
0.6002522706985474,
0.3907243013381958,
-0.15483246743679047,
-1.051810383796692,
-0.04899860918521881,
-0.06854212284088135,
0.9553579688072205,
0.2949499189853668,... |
func Run() (err error) {
// check if chapid is already running listening on standard socket or per process socket
if IsChapidRunning(ChapidSocketPath+ChapidSocketName) ||
IsChapidRunning(ChapidSocketPath+ChapidSocketName+strconv.Itoa(os.Getpid())) {
// return err as nil to indicate chapid is already running for c... | [
-0.16957126557826996,
-0.8464864492416382,
0.818065881729126,
-1.063811182975769,
0.4157613515853882,
0.6403844952583313,
0.5771212577819824,
-0.019454220309853554,
0.364564448595047,
-0.29864946007728577,
-0.2892851233482361,
0.5156396627426147,
-0.44222691655158997,
-0.15105219185352325,... |
func startChapid(result chan error) {
var err error
// create chapidSocket for listening
chapidListener, err = net.Listen("unix", ChapidSocketPath+ChapidSocketName+strconv.Itoa(os.Getpid()))
if err != nil {
log.Error("listen error, Unable to create ChapidServer ", err.Error())
result <- err
return
}
router ... | [
0.3922022581100464,
-1.0916184186935425,
0.7350708842277527,
-0.5691748857498169,
0.24086076021194458,
1.0735156536102295,
-0.19973760843276978,
0.4340132474899292,
-0.21699731051921844,
-0.17186592519283295,
-0.6776283383369446,
1.071860671043396,
-0.2638562023639679,
0.4901677072048187,
... |
func StopChapid() error {
chapidLock.Lock()
defer chapidLock.Unlock()
// stop the listener
if chapidListener != nil {
err := chapidListener.Close()
if err != nil {
log.Error("Unable to close chapid listener " + chapidListener.Addr().String())
}
chapidListener = nil
os.RemoveAll(ChapidSocketPath + Chap... | [
0.24915336072444916,
-1.2169408798217773,
0.5045734643936157,
-1.3177485466003418,
-0.03670111298561096,
0.8296434283256531,
-0.04064241424202919,
0.27540627121925354,
-0.4236196279525757,
0.49830231070518494,
-0.7127711176872253,
0.3175254464149475,
-0.7168046832084656,
0.2257304042577743... |
func IsChapidRunning(chapidSocket string) bool {
chapidLock.Lock()
defer chapidLock.Unlock()
//first check if the chapidSocket file exists
isPresent, _, _ := util.FileExists(chapidSocket)
if !isPresent {
return false
}
var chapiResp Response
// generate chapid client for default daemon
var errResp *ErrorRes... | [
-0.7188123464584351,
-0.5852380990982056,
0.6353772878646851,
-0.8004019260406494,
0.5674510598182678,
0.878829300403595,
-0.48521745204925537,
0.4532533586025238,
-0.295360803604126,
0.05626246705651283,
-0.2483319789171219,
0.4677802324295044,
-0.6380575895309448,
-0.3370491862297058,
... |
func cleanupExistingSockets() (err error) {
log.Trace("Cleaning up existing socket")
//clean up chapid socket
isPresent, _, err := util.FileExists(ChapidSocketPath + ChapidSocketName)
if err != nil {
log.Trace("err", err)
return err
}
if isPresent {
err = os.RemoveAll(ChapidSocketPath + ChapidSocketName)
... | [
0.57072514295578,
-0.6200389862060547,
0.6868389844894409,
-1.0352524518966675,
0.6757363677024841,
0.6770456433296204,
0.9372996091842651,
0.1828763335943222,
0.07384499907493591,
0.17514996230602264,
0.42477256059646606,
0.4864051342010498,
0.03257687762379646,
0.7574417591094971,
-0.2... |
func CheckFsCreationInProgress(device model.Device) (inProgress bool, err error) {
return linux.CheckFsCreationInProgress(device)
} | [
-0.405455082654953,
0.15665319561958313,
0.5455751419067383,
1.6788743734359741,
-0.7051841020584106,
0.3551214635372162,
0.3644687533378601,
-0.46603646874427795,
-1.181133508682251,
-1.1286368370056152,
0.17284153401851654,
-0.7555301785469055,
-0.5873326063156128,
1.3245948553085327,
... |
func Run(in, out fs.FS, rootDir string, outType string) (map[string]string, error) {
ret := make(map[string]string)
trimPath := func(p string) string {
// return strings.TrimPrefix(strings.TrimPrefix(p, rootDir), "/")
return p
}
// walk the output directory and compare each file to the input
err := fs.WalkD... | [
-0.11441705375909805,
-0.7409067749977112,
0.9703880548477173,
-0.1228029876947403,
-0.5603265762329102,
-0.26940155029296875,
1.048433542251587,
-0.11086586862802505,
-0.5180938839912415,
-0.54010409116745,
0.082624152302742,
-0.23934847116470337,
-0.8289310336112976,
0.3502262830734253,
... |
func diffContents(from, to string, outType string) string {
// // fileAdmp, fileBdmp, dmpStrings := dmp.DiffLinesToChars(fileAtext, fileBtext)
// // _ = dmpStrings
// diffs := dmp.DiffMain(fileAtext, fileBtext, false)
// // diffs := dmp.DiffMain(fileAdmp, fileBdmp, false)
// // diffs = dmp.DiffCharsToLines(d... | [
-0.09186423569917679,
-0.9993947148323059,
0.7607691287994385,
-0.3751332759857178,
-1.1869415044784546,
0.09827934950590134,
0.2070738673210144,
-0.8946442604064941,
0.31773895025253296,
-0.08796267956495285,
0.7277841567993164,
-0.06241646409034729,
-0.6018785238265991,
0.635399937629699... |
func NewTransaction(eventType string, consumerName string, consumerId string, consumerAddress string, consumerRequire string,
consumerCharge string, consumerDischargeRate string, buyRate string, requireEventId string, supplierName string, supplierId string,
supplierAddress string, supplierToSupply string, supplierSup... | [
0.959359347820282,
-0.7043770551681519,
0.6235386729240417,
-0.19804933667182922,
-0.16783538460731506,
-0.8275727033615112,
-0.11167437583208084,
-0.1251896470785141,
0.5887017250061035,
0.925689697265625,
-0.32188236713409424,
0.21261289715766907,
-0.47801926732063293,
0.1788380146026611... |
func PowerFeeCalculation(Json string) int {
//err := transaction.DecodeFromJson(Json)
//if err == nil {
// //TODO take time stamp and calculate power fee
//}
PowerFee := (len(Json) * 2) / 10
return PowerFee
} | [
0.5589778423309326,
-0.11183514446020126,
0.5402481555938721,
-0.7377586364746094,
-0.1282779425382614,
-0.9947524666786194,
-0.37301239371299744,
0.8399794697761536,
-0.5734092593193054,
0.26987791061401367,
0.08805106580257416,
-0.014658447355031967,
0.146967813372612,
0.4220286607742309... |
func (transaction *Transaction) EncodeToJson() (string, error) {
jsonBytes, error := json.Marshal(transaction)
return string(jsonBytes), error
} | [
-0.3144221007823944,
-0.22441111505031586,
0.5732107162475586,
-0.4759703278541565,
-0.8722257614135742,
-0.5561770796775818,
-0.2999818027019501,
-0.5487958192825317,
0.747589647769928,
1.0219241380691528,
-0.17613352835178375,
0.6849613189697266,
-0.3167574405670166,
-0.5943999886512756,... |
func (transaction *Transaction) DecodeFromJson(jsonString string) error {
return json.Unmarshal([]byte(jsonString), transaction)
} | [
0.1899135410785675,
-0.6138198971748352,
0.3514455258846283,
-0.6506062150001526,
-0.832368016242981,
-0.48937833309173584,
-0.5610588192939758,
-0.37464913725852966,
0.6071886420249939,
0.18189853429794312,
-0.9314033389091492,
-0.29680323600769043,
-0.08533327281475067,
-0.56823503971099... |
func (txp *TransactionPool) AddToTransactionPool(tx Transaction) { //duplicates in transactinon pool
txp.mux.Lock()
defer txp.mux.Unlock()
if _, ok := txp.Pool[tx.EventId]; !ok {
log.Println("In AddToTransactionPool : Adding new TX:", tx.EventId)
txp.Pool[tx.EventId] = tx
}
} | [
-0.4119403064250946,
-0.32501220703125,
0.5796927809715271,
-0.6993609070777893,
0.14366039633750916,
0.791624903678894,
0.5102547407150269,
-0.0295708030462265,
0.4875565767288208,
0.7930123209953308,
-0.6278670430183411,
0.10580570250749588,
-0.29162219166755676,
-0.21448074281215668,
... |
func (txp *TransactionPool) DeleteFromTransactionPool(transactionId string) {
txp.mux.Lock()
defer txp.mux.Unlock()
delete(txp.Pool, transactionId)
log.Println("In DeleteFromTransactionPool : Deleting TX:", transactionId)
} | [
0.6990052461624146,
-0.5291398763656616,
-0.20706170797348022,
-0.4647967517375946,
-0.6570469737052917,
0.4303368628025055,
0.06278882175683975,
-0.586415708065033,
0.5493447780609131,
1.093042016029358,
-0.39071232080459595,
0.11337319016456604,
-0.4706847369670868,
-0.16125532984733582,... |
func (txp *TransactionPool) GetTransactionPoolMap() map[string]Transaction {
return txp.Pool
} | [
-0.262249231338501,
-0.06109888106584549,
0.5352658033370972,
-1.0469331741333008,
-0.3713301122188568,
0.2784646153450012,
0.5367638468742371,
-0.08317030221223831,
0.1890605390071869,
0.8370336294174194,
-0.9897360801696777,
-0.27037742733955383,
-0.35602113604545593,
-0.5887792110443115... |
func (txp *TransactionPool) GetOneTxFromPool(TxPool TransactionPool, userBalance int) *Transaction {
txp.mux.Lock()
defer txp.mux.Unlock()
if len(TxPool.GetTransactionPoolMap()) > 0 {
for _, tx := range TxPool.GetTransactionPoolMap() {
if tx.EventType == "require" {
return &tx
}
if tx.EventType == "s... | [
-0.046665042638778687,
-0.14356133341789246,
0.6904829144477844,
-0.09368062019348145,
-0.9685047268867493,
-0.5019538402557373,
0.06625895202159882,
-1.189153790473938,
0.5379998087882996,
0.3273811340332031,
0.33111056685447693,
-0.2485705465078354,
-0.8711620569229126,
-0.34084746241569... |
func (txp *TransactionPool) AddToConfirmedPool(tx Transaction) { //duplicates in transactinon pool
txp.mux.Lock()
defer txp.mux.Unlock()
//TODO:BUG. Transaction ID's coming "" (NULL) we should return false in that case.
if tx.EventId == "" {
fmt.Println("Tx ID is NULL. Do not add to CheckConfirmedPool,TX:", tx.E... | [
-0.23551563918590546,
-0.3525460660457611,
0.7329229116439819,
-0.11781047284603119,
0.17184385657310486,
0.7227090001106262,
0.2686365246772766,
-0.12456708401441574,
0.17786771059036255,
0.6905110478401184,
-0.2762898802757263,
0.33772513270378113,
-0.35806867480278015,
0.710697531700134... |
func (txp *TransactionPool) CheckConfirmedPool(tx Transaction) bool {
txp.mux.Lock()
defer txp.mux.Unlock()
if tx.EventId == "" {
fmt.Println("Tx ID is NULL. Returning false for CheckConfirmedPool,TX:", tx.EventId)
return false
}
if _, ok := txp.Confirmed[tx.EventId]; ok {
fmt.Println("Tx is in ConfirmedPool... | [
0.1338653564453125,
-0.4333716928958893,
0.6458848118782043,
0.26962125301361084,
-0.3599347770214081,
0.45060813426971436,
0.14853507280349731,
-0.13824652135372162,
-0.27126774191856384,
0.7531893849372864,
-0.22240383923053741,
0.7209072113037109,
-0.4269488751888275,
0.9842890501022339... |
func NewTransactionPool() TransactionPool {
Pool := make(map[string]Transaction)
Confirmed := make(map[string]bool)
mutex := sync.Mutex{}
return TransactionPool{Pool, Confirmed, mutex}
} | [
-0.09071438759565353,
-0.07763116806745529,
0.47908884286880493,
0.08363106101751328,
-0.5795016884803772,
-0.8045163750648499,
0.24458007514476776,
0.22130919992923737,
-0.3249072730541229,
0.6029464602470398,
-0.48455628752708435,
-0.2240731120109558,
-0.11012633889913559,
0.233255058526... |
func (h *NFSInstaller) InstallNFSServer(systemNamespace, namespace string, count int) error {
h.k8shelper.CreateAnonSystemClusterBinding()
// install hostpath provisioner if there isn't already a default storage class
storageClassName := ""
defaultExists, err := h.k8shelper.IsDefaultStorageClassPresent()
if err !... | [
-0.6371756792068481,
-0.30235835909843445,
0.7252169847488403,
0.3044370114803314,
0.4254845976829529,
-0.0779244676232338,
0.24055206775665283,
-0.11730612069368362,
0.031679507344961166,
0.5664274096488953,
-0.6114057302474976,
-1.3119908571243286,
-1.0927094221115112,
1.210446834564209,... |
func (h *NFSInstaller) CreateNFSServerOperator(namespace string) error {
logger.Infof("starting nfsserver operator")
logger.Info("creating nfsserver CRDs")
if _, err := h.k8shelper.KubectlWithStdin(h.manifests.GetNFSServerCRDs(), createFromStdinArgs...); err != nil {
return err
}
nfsOperator := h.manifests.Get... | [
-0.4631650149822235,
-0.342483788728714,
0.5415863394737244,
0.3127216696739197,
-0.4281488060951233,
-0.2990093529224396,
-0.1756245195865631,
-0.6025800704956055,
0.4566969871520996,
0.37484803795814514,
-0.14843657612800598,
-0.3730415105819702,
-0.5688009262084961,
0.557340145111084,
... |
func (h *NFSInstaller) CreateNFSServer(namespace string, count int, storageClassName string) error {
if err := h.k8shelper.CreateNamespace(namespace); err != nil {
return err
}
logger.Infof("starting nfs server with kubectl and yaml")
nfsServer := h.manifests.GetNFSServer(namespace, count, storageClassName)
if ... | [
-0.35920092463493347,
-0.8265256881713867,
0.6929076910018921,
0.465305358171463,
0.6318495273590088,
-0.1451835036277771,
-0.3361732065677643,
-0.5514036417007446,
0.6588277816772461,
0.12275516241788864,
-0.33523187041282654,
0.005511924624443054,
-0.35923051834106445,
0.8066523671150208... |
func (h *NFSInstaller) CreateNFSServerVolume(namespace string) error {
logger.Info("creating volume from nfs server in namespace %s", namespace)
clusterIP, err := h.GetNFSServerClusterIP(namespace)
if err != nil {
return err
}
nfsServerPV := h.manifests.GetNFSServerPV(namespace, clusterIP)
nfsServerPVC := h.ma... | [
-0.21600434184074402,
-0.5159443020820618,
0.459419310092926,
0.43526265025138855,
0.2883400022983551,
-0.06942413002252579,
-0.5554375648498535,
-0.9426894187927246,
0.08551377803087234,
0.12416496127843857,
0.30005592107772827,
0.030143359676003456,
-0.11796624958515167,
1.50850725173950... |
func (h *NFSInstaller) UninstallNFSServer(systemNamespace, namespace string) {
logger.Infof("uninstalling nfsserver from namespace %s", namespace)
_, err := h.k8shelper.DeleteResource("pvc", "nfs-pv-claim")
checkError(h.T(), err, fmt.Sprintf("cannot remove nfs pvc"))
_, err = h.k8shelper.DeleteResource("pv", "nfs... | [
0.017296554520726204,
-0.08757787197828293,
0.5444921851158142,
-0.36128661036491394,
-0.5652662515640259,
-0.7466486096382141,
0.19556565582752228,
-0.011487015523016453,
0.42266571521759033,
0.3809908628463745,
-0.2863977253437042,
-0.025573626160621643,
-0.632887065410614,
0.89200812578... |
func (h *NFSInstaller) GatherAllNFSServerLogs(systemNamespace, namespace, testName string) {
logger.Infof("Gathering all logs from NFSServer %s", namespace)
h.k8shelper.GetRookLogs("rook-nfs-operator", Env.HostType, systemNamespace, testName)
h.k8shelper.GetRookLogs("rook-nfs", Env.HostType, namespace, testName)
} | [
0.291706919670105,
-0.5257274508476257,
0.5410222411155701,
0.8789107799530029,
-0.4386152923107147,
-0.4868108034133911,
-0.6369197964668274,
-1.1398106813430786,
0.5398202538490295,
0.3417101502418518,
-0.08694552630186081,
1.355641484260559,
-0.14257557690143585,
2.0492360591888428,
0... |
func (h *NFSInstaller) GetNFSServerClusterIP(namespace string) (string, error) {
clusterIP := ""
service, err := h.k8shelper.GetService("rook-nfs", namespace)
if err != nil {
logger.Errorf("nfs server service in namespace %s is not active", namespace)
return clusterIP, err
}
clusterIP = service.Spec.ClusterIP
... | [
-0.6886401176452637,
-0.6804260611534119,
0.4614148736000061,
0.621612548828125,
-0.5168747901916504,
-0.7397721409797668,
0.295076459646225,
-0.603190004825592,
0.2600724399089813,
0.6696852445602417,
0.09564027190208435,
0.4071199297904968,
-0.9646434783935547,
0.07368291914463043,
0.2... |
func YAML(file *File) Filter {
return FilterFunc(func(input map[string]interface{}) (map[string]interface{}, error) {
obj := map[string]interface{}{}
content, err := ioutil.ReadFile(file.Path)
if err != nil {
if file.IgnoreErrors {
return Merge(obj, input)
}
return nil, err
}
err = yaml.Unmarsh... | [
0.3049658536911011,
-0.09898325800895691,
0.694976270198822,
-0.07616136223077774,
-0.581066370010376,
0.42297986149787903,
0.8685920238494873,
0.5518285036087036,
-0.2367013394832611,
-0.1483735293149948,
0.7206506133079529,
0.23416903614997864,
0.3765689432621002,
0.1486213356256485,
-... |
func YAMLString(content string) Filter {
return FilterFunc(func(input map[string]interface{}) (map[string]interface{}, error) {
obj := map[string]interface{}{}
err := yaml.Unmarshal([]byte(content), &obj)
if err != nil {
return nil, err
}
return Merge(obj, input)
})
} | [
0.2058624029159546,
-0.563985288143158,
0.530484676361084,
-0.5458682775497437,
-0.9910294413566589,
-0.35183602571487427,
0.15157248079776764,
-0.07515200972557068,
-0.3839717209339142,
0.031027812510728836,
-0.199905663728714,
0.03565265238285065,
0.3478669226169586,
-0.35006725788116455... |
func FindObject(c cache.Cache, key string, value interface{}, dbSession *xorm.Session, get bool) (bool, error) {
// first check in cache
has, err := CheckCache(c, key, value)
if err != nil {
return false, err
}
if has {
return true, nil
}
// not found in cache
// search in database
if get {
if has, err ... | [
-0.3603842854499817,
0.017816487699747086,
1.0381492376327515,
0.13387902081012726,
-0.47804656624794006,
0.5717347264289856,
-0.31177669763565063,
-0.24155034124851227,
-0.2263440042734146,
0.8417662382125854,
-0.4021083116531372,
-0.9112164378166199,
-0.5217652320861816,
0.47031900286674... |
func ComparePassword(hash string, password string) bool {
if len(password) == 0 || len(hash) == 0 {
return false
}
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
} | [
1.0329293012619019,
-0.5004845857620239,
0.8837195634841919,
0.9155318140983582,
0.7090261578559875,
0.040840499103069305,
-0.8255991339683533,
0.9078729748725891,
0.14036411046981812,
0.13767486810684204,
-0.04913001134991646,
0.16212105751037598,
-0.9197969436645508,
0.8976882100105286,
... |
func TestGlypRune(t *testing.T) {
for r, g := range glyphlistRuneToGlyphMap {
r2, ok := glyphlistGlyphToRuneMap[g]
if !ok {
t.Errorf("rune→glyph→rune mismatch: %s → %q → %s", rs(r), g, rs(r2))
}
}
for g, r := range glyphlistGlyphToRuneMap {
g2, ok := glyphlistRuneToGlyphMap[r]
if !ok {
t.Errorf("gly... | [
0.2352662831544876,
0.5500862002372742,
0.614244282245636,
-0.14760133624076843,
1.1383181810379028,
0.3775579631328583,
0.3795856237411499,
-0.36930039525032043,
0.050917234271764755,
-0.45172396302223206,
-0.5979759097099304,
0.8106076121330261,
-0.8799208998680115,
0.13462135195732117,
... |
func TestRuneToGlyph(t *testing.T) {
runes := []rune("₂₃₄₅◊fl˝ˇ¾Ðí©ºªı„δ∂ℵ⌡×÷®Ï☎①➔➨")
glyphs := []GlyphName{
"twoinferior", "threeinferior", "fourinferior", "fiveinferior",
"lozenge", "fl", "hungarumlaut", "caron",
"threequarters", "Eth", "iacute", "copyright",
"ordmasculine", "ordfeminine", "dotlessi", "quote... | [
-0.01793614961206913,
1.047200322151184,
0.57742840051651,
-0.8161662220954895,
1.081192135810852,
-0.2451249212026596,
0.248259499669075,
-0.3344098627567291,
0.21909768879413605,
-0.37842345237731934,
-0.9030904173851013,
0.6664502620697021,
-0.8424392342567444,
-0.1593153178691864,
0.... |
func NewReader(ip *Address, protocol uint8) (Reader, error) {
c, err := globalIPReadManager.bind(ip, protocol)
if err != nil {
return nil, err
}
ipr := &ipReader{
incomingPackets: c,
processed: make(chan *IPReadHeader, ipReadBufferSize),
protocol: protocol,
ip: ip,
fragBuf: ... | [
-0.2199665606021881,
-0.24682500958442688,
0.5829136371612549,
-0.5451129078865051,
-1.1922307014465332,
0.21793489158153534,
-0.478403240442276,
-0.04610626772046089,
-0.11283574253320694,
0.2810083329677582,
0.58195561170578,
0.48450806736946106,
-1.0997394323349,
-0.5856747031211853,
... |
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, error) {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &api.PersistentVolumeClaim{} },
NewListFunc: func() runtime.Object { return &api.PersistentVolumeClaimList{} },
PredicateFunc: ... | [
0.6138737797737122,
-1.1180059909820557,
0.641682505607605,
0.05349821224808693,
-0.5408955812454224,
-0.03643886744976044,
-0.5052637457847595,
0.4790993630886078,
1.0688667297363281,
-0.14953546226024628,
0.8526968955993652,
0.6781121492385864,
-0.17380167543888092,
-0.24113570153713226,... |
func (r *REST) ShortNames() []string {
return []string{"pvc"}
} | [
0.6601855754852295,
-0.5656603574752808,
0.371001660823822,
-0.18648101389408112,
1.1220656633377075,
0.34556159377098083,
-1.6896599531173706,
-1.0414351224899292,
1.437042474746704,
-0.15232917666435242,
0.09346326440572739,
0.6407812833786011,
-0.5601437091827393,
-0.05345965176820755,
... |
func (r *REST) defaultOnRead(obj runtime.Object) {
switch s := obj.(type) {
case *api.PersistentVolumeClaim:
r.defaultOnReadPvc(s)
case *api.PersistentVolumeClaimList:
r.defaultOnReadPvcList(s)
default:
// This was not an object we can default. This is not an error, as the
// caching layer can pass through... | [
0.3719649910926819,
-1.1713342666625977,
0.3028146028518677,
0.74709153175354,
0.050924185663461685,
0.22224031388759613,
-0.8735712170600891,
-0.6466485261917114,
0.7840241193771362,
-0.42844000458717346,
0.3094308376312256,
0.18044748902320862,
-0.3496560752391815,
0.21936534345149994,
... |
func (r *REST) defaultOnReadPvcList(pvcList *api.PersistentVolumeClaimList) {
if pvcList == nil {
return
}
for i := range pvcList.Items {
r.defaultOnReadPvc(&pvcList.Items[i])
}
} | [
-0.6186615228652954,
-0.5098004341125488,
0.3798935115337372,
0.4603223502635956,
0.400806188583374,
-0.0905151292681694,
-1.6869480609893799,
0.05263492092490196,
0.3241162896156311,
0.16762110590934753,
0.01694544218480587,
-0.1899736374616623,
-0.32307180762290955,
0.8155191540718079,
... |
func (r *REST) defaultOnReadPvc(pvc *api.PersistentVolumeClaim) {
if pvc == nil {
return
}
// We set dataSourceRef to the same value as dataSource at creation time now,
// but for pre-existing PVCs with data sources, the dataSourceRef field will
// be blank, so we fill it in here at read time.
pvcutil.Normaliz... | [
0.28886187076568604,
-0.5314263105392456,
0.31010815501213074,
-0.8411388397216797,
0.5248569250106812,
-0.5228537321090698,
-0.6530852317810059,
-0.09289291501045227,
0.4643329083919525,
-0.5150060057640076,
0.4772605001926422,
0.34412214159965515,
0.19677121937274933,
0.4643162190914154,... |
func (r *StatusREST) New() runtime.Object {
return &api.PersistentVolumeClaim{}
} | [
0.9138737320899963,
-1.7866458892822266,
0.15273252129554749,
0.38262471556663513,
-0.4438869059085846,
0.06527562439441681,
-1.3822063207626343,
-0.1690608114004135,
-0.16799555718898773,
-0.6482017040252686,
0.3507423996925354,
0.40745458006858826,
-0.06565946340560913,
-0.15129801630973... |
func (r *StatusREST) Destroy() {
// Given that underlying store is shared with REST,
// we don't destroy it here explicitly.
} | [
0.5213105082511902,
-0.32875263690948486,
-0.049802057445049286,
-0.14828753471374512,
-0.2149421125650406,
1.0116136074066162,
-0.7937636375427246,
0.3486271798610687,
0.68315190076828,
-0.6770337224006653,
0.02672072872519493,
-0.5398766398429871,
-1.1442047357559204,
0.48267877101898193... |
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
return r.store.Get(ctx, name, options)
} | [
-0.16514873504638672,
-0.6379885673522949,
0.2920862138271332,
0.17546617984771729,
-0.08878586441278458,
0.06848374754190445,
-0.6413928270339966,
-0.7491190433502197,
0.7047744989395142,
-0.11606674641370773,
-0.4467107653617859,
0.5656372904777527,
-0.49293872714042664,
-1.2131769657135... |
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
// We are explicitly setting forceAllowCreate to ... | [
-0.3327607214450836,
-1.0236865282058716,
0.4544650912284851,
1.1166900396347046,
-0.5912933945655823,
0.9752588272094727,
-0.351761132478714,
-0.703693687915802,
0.2007543295621872,
-0.4414430558681488,
-0.9482908844947815,
-0.3343343436717987,
-0.5579973459243774,
-0.633109986782074,
-... |
func (s *Service) RegistTable(t interface{}) {
if ok := s.DB.HasTable(t); !ok {
if err := s.DB.CreateTable(t).Error; err != nil {
log.Fatalf("create mysql table error:%s", err.Error())
}
}
var tab []interface{}
s.DB.AutoMigrate(append(tab, t))
} | [
-0.10026922076940536,
1.035548448562622,
0.8574549555778503,
0.714337944984436,
0.9592100381851196,
-0.2987978458404541,
0.5991345047950745,
-0.659019947052002,
-0.32740887999534607,
0.29587769508361816,
-0.6411744356155396,
-0.30874118208885193,
-0.033647604286670685,
0.6558583974838257,
... |
func (s *Service) RegistTables(tables []interface{}) {
for _, t := range tables {
if ok := s.DB.HasTable(t); !ok {
if err := s.DB.CreateTable(t).Error; err != nil {
log.Fatalf("create mysql table error:%s", err.Error())
}
}
}
// auto migrate to keep schema update to date
// AutoMigrate will ONLY crea... | [
-0.5153841972351074,
1.0434025526046753,
0.8124834299087524,
1.2445363998413086,
0.8728938102722168,
0.4736691415309906,
0.9910648465156555,
-0.6060672998428345,
0.2551799714565277,
-0.12869387865066528,
-0.5924801230430603,
-0.6541571021080017,
-0.3572131097316742,
0.953816831111908,
-0... |
func (m *RedisStore) Set(key interface{}, value interface{}) error {
m.lock.Lock()
defer m.lock.Unlock()
m.sessionData[key] = value
return nil
} | [
-1.0977463722229004,
0.1473383605480194,
-0.055401187390089035,
0.051932163536548615,
-0.44274255633354187,
0.31735771894454956,
-0.8392575979232788,
-0.8794506788253784,
0.6410489678382874,
0.7400513291358948,
-0.3378523290157318,
0.05620570480823517,
-0.5701602697372437,
0.20968402922153... |
func (m *RedisStore) Get(key interface{}) interface{} {
m.lock.RLock()
defer m.lock.RUnlock()
if v, ok := m.sessionData[key]; ok {
return v
}
return nil
} | [
-0.9382174611091614,
-0.0012614919105544686,
0.2983831465244293,
0.30964818596839905,
-0.4032672345638275,
-0.36431190371513367,
-1.0698350667953491,
-1.0618853569030762,
1.0817369222640991,
0.18699133396148682,
0.15351088345050812,
0.20480869710445404,
-0.6719980239868164,
-0.427629023790... |
func (m *RedisStore) Delete(key interface{}) error {
m.lock.Lock()
defer m.lock.Unlock()
delete(m.sessionData, key)
return nil
} | [
-0.3937740921974182,
0.7021477818489075,
0.03614354878664017,
0.4850843846797943,
-0.34186694025993347,
0.2383561134338379,
-0.5650073885917664,
-0.4095516800880432,
1.4839657545089722,
0.6436665058135986,
-0.12976442277431488,
-0.5410719513893127,
-1.2569538354873657,
0.28667035698890686,... |
func (m *RedisStore) Flush() error {
m.lock.Lock()
defer m.lock.Unlock()
m.sessionData = make(map[interface{}]interface{})
return nil
} | [
-0.7280786037445068,
-0.12595036625862122,
0.17181067168712616,
-0.5607671737670898,
-0.11684964597225189,
0.42284151911735535,
-0.20907552540302277,
-0.776540219783783,
0.6464948058128357,
-0.23895902931690216,
-0.12397822737693787,
0.9986940622329712,
-0.008072474971413612,
0.40023222565... |
func (m *RedisStore) ID() string {
return m.sessionId
} | [
0.25524184107780457,
-0.7884451746940613,
0.16682833433151245,
0.5996505618095398,
-0.37798985838890076,
0.8528366088867188,
-0.4020821154117584,
-0.07972560077905655,
2.5758056640625,
0.0037054673302918673,
-0.10618281364440918,
-0.3086812198162079,
-0.5844109654426575,
0.4345628917217254... |
func (m *RedisStore) Release() (error) {
b, err := EncodeGob(m.sessionData)
if err != nil {
return err
}
err = m.sessionKvstoreProvider.Set(m.sessionId, string(b))
if err != nil {
return err
}
err = m.sessionKvstoreProvider.Expire(m.sessionId, m.sessionMaxAge)
if err != nil {
return err
}
return nil
} | [
-0.6903754472732544,
0.4137643575668335,
0.34001779556274414,
0.20521289110183716,
-0.3654719591140747,
-0.2015521079301834,
-1.3251463174819946,
0.07935318350791931,
1.342777967453003,
0.9550949931144714,
-0.3026700019836426,
0.30558428168296814,
-0.8798626661300659,
0.2436440885066986,
... |
func LookupElasticPool(ctx *pulumi.Context, args *LookupElasticPoolArgs, opts ...pulumi.InvokeOption) (*LookupElasticPoolResult, error) {
var rv LookupElasticPoolResult
err := ctx.Invoke("azure-native:sql/v20140401:getElasticPool", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
} | [
0.04466428980231285,
0.5096102356910706,
0.7029558420181274,
-0.1918017417192459,
0.3964242935180664,
0.4776743948459625,
0.36005163192749023,
-0.6672345399856567,
1.0322558879852295,
0.2430982142686844,
0.5517678260803223,
1.230628252029419,
-0.11691413819789886,
-1.2234382629394531,
-0... |
func GetParsers() []Parser {
return []Parser{
ipParser,
hostnameParser,
lookupParser,
}
} | [
-0.6974881887435913,
-0.09552066028118134,
0.25354790687561035,
0.28470543026924133,
0.8440305590629578,
0.27244237065315247,
-1.4551794528961182,
0.11082182079553604,
0.29158642888069153,
-1.0642716884613037,
-1.0223866701126099,
0.8281223773956299,
-1.2425317764282227,
0.2868151962757110... |
func AddHeader(key, value string) Middleware {
return func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
addHeaderIfNotExists(w.Header(), key, value)
h.ServeHTTP(w, r)
})
}
} | [
-0.11417335271835327,
-0.07351552695035934,
0.6722233891487122,
0.6966113448143005,
-0.7341822981834412,
0.6381540894508362,
-1.1446020603179932,
-0.5312218070030212,
0.1567898839712143,
-0.3539743721485138,
1.3709453344345093,
-0.4522925019264221,
-0.1175251230597496,
0.5271643400192261,
... |
func (ft *FutureTask) Wait(timeout time.Duration) (res *[]byte, err error) {
select {
case res = <-ft.out:
case <-time.After(timeout):
err = fmt.Errorf("task(%+v) timeout", ft)
}
return
} | [
-0.5137261748313904,
0.5793780088424683,
0.3240913152694702,
0.48146146535873413,
-0.7111712098121643,
-0.5965769290924072,
0.1318475753068924,
-0.1412603110074997,
-0.38117533922195435,
-0.04423197731375694,
-0.4561173915863037,
-0.3342052400112152,
0.36999091506004333,
0.1847745776176452... |
func NewAwsClientFromEnv() (*Client, error) {
accessKey := os.Getenv("AWS_ACCESS_KEY_ID")
if accessKey == "" {
accessKey = os.Getenv("AWS_ACCESS_KEY")
if accessKey == "" {
return nil, errors.New("AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment")
}
}
secretKey := os.Getenv("AWS_SECRET_ACCESS_K... | [
-0.1125815361738205,
-0.8328684568405151,
0.5587007999420166,
-0.3375186026096344,
-0.6228994727134705,
-0.19718888401985168,
-0.09834565222263336,
-0.7074154019355774,
0.09157197177410126,
-0.08248163014650345,
0.1234891265630722,
1.2620160579681396,
0.9973333477973938,
-0.454547971487045... |
func (e *LogSpanExporter) ExportSpan(vd *trace.SpanData) {
// todo use some lru cache for hex values of traceID/SpanID
var (
traceID = hex.EncodeToString(vd.SpanContext.TraceID[:])
spanID = hex.EncodeToString(vd.SpanContext.SpanID[:])
parentSpanID = hex.EncodeToString(vd.ParentSpanID[:])
)
logger :... | [
0.4819157123565674,
-0.25829416513442993,
0.7116255760192871,
-0.5302874445915222,
-0.8331242799758911,
0.3953563868999481,
-0.16540877521038055,
-0.20141266286373138,
0.7827154994010925,
-0.3929383158683777,
-0.16258208453655243,
0.37427663803100586,
0.5089520215988159,
0.5631465911865234... |
func LoggerWithTrace(context context.Context, logger *log.Entry) *log.Entry {
span := trace.FromContext(context)
spanContext := span.SpanContext()
if getTraceStatus(context) {
return logger.WithFields(log.Fields{"span_id": spanContext.SpanID, "trace_id": spanContext.TraceID})
}
return logger
} | [
1.3533155918121338,
-0.2921324670314789,
0.6133877635002136,
-0.5992778539657593,
-0.030552126467227936,
0.0506969578564167,
-0.6828069090843201,
-0.6990898847579956,
1.2640467882156372,
0.13556508719921112,
-0.23669372498989105,
-0.40477117896080017,
0.05435242876410484,
0.563731372356414... |
func NewLoggerWithTrace(context context.Context) *log.Entry {
return LoggerWithTrace(context, GetLoggerFromContext(context))
} | [
0.9455909729003906,
-0.4976993501186371,
0.32173746824264526,
0.4722962975502014,
-0.5531448721885681,
-1.1451714038848877,
-1.080033540725708,
-1.2740087509155273,
1.0007332563400269,
0.3450794219970703,
-0.12440723180770874,
-0.07191365212202072,
0.029226452112197876,
0.5199776887893677,... |
func getTraceStatus(ctx context.Context) bool {
value := ctx.Value(traceStatusKey{})
if v, ok := value.(bool); ok {
return v
}
return false
} | [
-0.04620024934411049,
0.6869072914123535,
0.5891348719596863,
-0.3904738426208496,
0.9537776708602905,
0.6601094007492065,
-0.31105560064315796,
-0.3133832812309265,
0.3903672993183136,
0.3709230422973633,
-0.9986932277679443,
0.18107540905475616,
-0.07524271309375763,
-0.25363075733184814... |
func getPositiveNumber(data []byte, cursor int) (int, error) {
if cursor >= len(data)-1 {
return 0, errors.New("Index out of range.")
}
aux := string(data[cursor : cursor+2])
result, err := strconv.Atoi(aux)
if result <= 0 || err != nil {
return 0, errors.New(fmt.Sprintf("Invalid number %s.", aux))
... | [
-0.12689407169818878,
-0.229521244764328,
0.7932054400444031,
-0.039962612092494965,
-1.017134428024292,
-0.4278544783592224,
-0.2059614211320877,
0.6352818012237549,
-0.426629900932312,
-0.15714940428733826,
-0.39804717898368835,
-0.024457741528749466,
-0.1756785660982132,
0.1177946254611... |
func checkFieldValue(value string, expectedType string) error {
if result, err := regexp.MatchString(fieldTypeValidators[expectedType], value); err != nil || !result {
return errors.New(fmt.Sprintf("Invalid field value %s.", value))
}
return nil
} | [
-0.4893735349178314,
0.058312010020017624,
0.5951560139656067,
-0.08399630337953568,
-0.0629025548696518,
0.41667935252189636,
-0.23345084488391876,
0.4210837185382843,
-0.7003167271614075,
0.6620521545410156,
0.03607295826077461,
0.6642476916313171,
0.0005065345903858542,
0.64082574844360... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.