text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (a *application) GetSettingsLoader(acfg *svcconfig.Archivist) archivist.SettingsLoader {
serviceID := a.ServiceID()
return func(c context.Context, proj types.ProjectName) (*archivist.Settings, error) {
// Fold in our project-specific configuration, if valid.
pcfg, err := a.ProjectConfig(c, proj)
if err !=... | [
-0.35310569405555725,
0.5174914598464966,
0.6048101782798767,
-0.21919257938861847,
-0.2231580764055252,
-0.7621752619743347,
0.09951353818178177,
-0.4480292797088623,
-0.4053955376148224,
-0.24526242911815643,
0.03409590199589729,
0.11769573390483856,
0.1709149330854416,
0.164859786629676... |
func (c *Client) GetPresignedPOST(fileExt string, siteID int, environmentID int, appSlot int) (*RFPresignedPostData, error) {
var data RFPresignedPostData
url := "uploads"
req, err := c.NewRequest("GET", url, nil)
q := req.URL.Query()
q.Add("app_site_id", strconv.Itoa(siteID))
q.Add("environment_id", strconv.Itoa... | [
-0.36494579911231995,
0.5414659380912781,
0.8211711645126343,
0.25534355640411377,
-0.5505514740943909,
-0.4769149720668793,
-0.5279857516288757,
-0.12263210117816925,
-0.2389902025461197,
0.1965656727552414,
-0.824478030204773,
0.37263059616088867,
-1.2323256731033325,
0.5540408492088318,... |
func (c *Client) UploadToS3(postData *RFPresignedPostData, filePath string) error {
var req *http.Request
fileName := filepath.Base(filePath)
f, err := os.Open(filePath)
defer f.Close()
if err != nil {
return err
}
fi, err := f.Stat()
if err != nil {
return err
}
fileSize := int64(fi.Size())
contentLe... | [
-0.20836956799030304,
0.26104047894477844,
1.150456190109253,
-0.21933919191360474,
0.2501380741596222,
0.2636478841304779,
-0.025302205234766006,
-0.28853893280029297,
-0.4365224540233612,
0.36737632751464844,
-0.447996586561203,
0.17752705514431,
-0.30809342861175537,
-0.4602194130420685... |
func (c *Client) UpdateURL(siteID int, environmentID int, appSlot int, newURL string) error {
siteEnvironment, err := c.getSiteEnvironment(siteID, environmentID)
if err != nil {
return err
}
index := appSlot - 1 // appSlot is 1-100, make it 0-index based
splitURL := strings.Split(siteEnvironment.URL, "|")[:]
i... | [
-0.9474211931228638,
-0.6334336400032043,
0.5430989861488342,
0.4262336194515228,
-0.43955767154693604,
0.7187885642051697,
0.45888760685920715,
0.4009990990161896,
0.05477753281593323,
1.2475802898406982,
-0.12045739591121674,
0.32084107398986816,
-0.1738457828760147,
0.5688310861587524,
... |
func NewService(config *ServiceConfig, configExt ...*ServiceConfigExt) (*Service, error) {
var serviceLogWriter, accessLogWriter io.Writer
switch len(configExt) {
case 0:
case 1:
serviceLogWriter = configExt[0].ServiceLogWriter
accessLogWriter = configExt[0].AccessLogWriter
default:
return nil, fmt.Errorf("O... | [
0.06226559728384018,
-0.381965696811676,
0.8405168056488037,
0.44678664207458496,
-0.5454062223434448,
-0.20094548165798187,
-0.09402892738580704,
-0.05225822702050209,
-0.4064987599849701,
0.18336747586727142,
-0.29622629284858704,
0.27404963970184326,
-0.5420897006988525,
0.8921977877616... |
func (s *Service) Config() *ServiceConfig {
return s.config
} | [
0.541061520576477,
-0.024756329134106636,
-0.05560219660401344,
0.2901541292667389,
-0.7482399344444275,
0.2879309356212616,
0.5454043745994568,
0.49373504519462585,
0.08181965351104736,
-0.7667394280433655,
-0.1934479922056198,
1.004273533821106,
0.11439236998558044,
0.9830008745193481,
... |
func (s *Service) Logger() *log.Logger {
return s.defaultLogger
} | [
-0.13415563106536865,
0.2063460797071457,
0.09416910260915756,
0.2032381147146225,
0.06037655472755432,
-0.0454699769616127,
-0.44905054569244385,
0.35458284616470337,
0.49293312430381775,
-0.9687151908874512,
0.1304640769958496,
0.23568981885910034,
-0.489407479763031,
1.382880449295044,
... |
func (s *Service) AccessLogger() *log.Logger {
return s.accessLogger
} | [
0.7643836736679077,
-0.33964550495147705,
0.289667010307312,
-0.23428748548030853,
-1.444530963897705,
-0.47854191064834595,
0.32351604104042053,
0.6205889582633972,
0.6990577578544617,
-0.97674560546875,
1.4722667932510376,
0.92874675989151,
-0.23901186883449554,
1.0507781505584717,
1.1... |
func (s *Service) Tracer() opentracing.Tracer {
return s.tracer
} | [
0.35493797063827515,
-0.464923620223999,
0.1464303731918335,
0.2519269585609436,
-1.2545444965362549,
1.1101830005645752,
1.064102292060852,
0.16499318182468414,
1.0785267353057861,
-1.2373547554016113,
0.709894061088562,
0.3733226954936981,
-0.19296090304851532,
0.8541499376296997,
0.82... |
func (s *Service) Router(version int) (*httptreemux.ContextMux, error) {
if version < s.config.Version.Min || version > s.config.Version.Max {
return nil, fmt.Errorf("API version is out of range (min: %d, max: %d)", s.config.Version.Min, s.config.Version.Max)
}
router := s.apiRouters[version]
return router, nil
} | [
-0.9567676186561584,
-0.516120970249176,
0.6540775895118713,
0.22540970146656036,
-0.9352058172225952,
0.042554426938295364,
-0.14269226789474487,
-0.027638690546154976,
0.08467517048120499,
0.25024205446243286,
0.3245914578437805,
0.4449678361415863,
-0.4918327331542969,
0.038047958165407... |
func (s *Service) AppendHandler(h Handler) {
s.handlers = append(s.handlers, h)
} | [
-0.35389676690101624,
0.7475508451461792,
0.11930142343044281,
-0.1149185299873352,
-0.38955187797546387,
0.8226689100265503,
-0.9425305128097534,
0.15621417760849,
0.3341861963272095,
-1.0815004110336304,
-0.5995548963546753,
0.3993619382381439,
-0.23242126405239105,
1.8800139427185059,
... |
func (s *Service) PrependHandler(h Handler) {
s.handlers = append([]Handler{h}, s.handlers...)
} | [
-0.3183586001396179,
0.4728820025920868,
0.28427204489707947,
0.16859658062458038,
-0.10719069093465805,
1.0546247959136963,
-0.4037643373012543,
0.2862825393676758,
0.31274470686912537,
-0.9951780438423157,
-0.5741726756095886,
0.6252256631851196,
-0.283098042011261,
1.7112009525299072,
... |
func (s *Service) AddHandler(h Handler) {
s.AppendHandler(h)
} | [
-0.31738150119781494,
0.9624974131584167,
0.13141027092933655,
1.0671557188034058,
-0.3882017433643341,
0.9762426614761353,
-1.2290557622909546,
0.501862645149231,
0.015937136486172676,
-1.8048583269119263,
-0.17821142077445984,
0.3735751211643219,
-0.06470376998186111,
1.7539691925048828,... |
func (s *Service) AddResource(version int, basePath string, r interface{}) error {
router, err := s.Router(version)
if err != nil {
return err
}
s.addCollectionRoutes(router, basePath, r)
s.addSingletonRoutes(router, basePath, r)
return nil
} | [
-0.28835198283195496,
-0.171423077583313,
0.5469166040420532,
0.79950350522995,
0.33003079891204834,
0.6969491243362427,
0.47618797421455383,
0.7307435870170593,
0.7186883091926575,
-0.019768938422203064,
-0.0678175836801529,
-0.516141414642334,
-0.4446296691894531,
0.714504599571228,
0.... |
func (s *Service) SetSchemas(schemas http.FileSystem) {
s.schemas = schemas
} | [
-0.28174448013305664,
0.10076624900102615,
0.05986088141798973,
0.1242663562297821,
-0.012085976079106331,
0.12205471843481064,
-0.3837112784385681,
-0.013224225491285324,
0.8308772444725037,
-1.2337894439697266,
-0.31987378001213074,
0.5601128339767456,
-0.18805330991744995,
0.96170437335... |
func (s *Service) Run() error {
err := errors.New("service instances may only be run one time")
s.once.Do(func() { err = s.run() })
return err
} | [
-0.9674232006072998,
0.2773117423057556,
0.29345712065696716,
-0.1895960420370102,
0.24915611743927002,
0.14396660029888153,
0.3220728933811188,
-0.21562863886356354,
0.02759545110166073,
-0.2731013894081116,
-0.4115663766860962,
0.19560851156711578,
-0.6728941202163696,
0.6600759029388428... |
func ReadPreferences(filename string) (*Preferences, error) {
if filename == "" {
home, err := os.UserHomeDir()
if err != nil {
panic("Could not get home directory")
}
filename = fmt.Sprintf("%s/%s", home, preferencesFile)
}
jsonFile, err := os.Open(filename)
if err != nil {
return nil, errors.Wrap(err... | [
-1.0424453020095825,
-0.03632592782378197,
0.6802738308906555,
-0.2513403296470642,
-0.29901349544525146,
0.5058764219284058,
0.06761814653873444,
-0.3462107479572296,
-0.7558794617652893,
0.7233517169952393,
0.6533282399177551,
0.6228058934211731,
-1.246505618095398,
-0.18891742825508118,... |
func (p *Preferences) Write(filename string) error {
jsonString, err := json.Marshal(p)
if err != nil {
return errors.Wrap(err, "json marshal failed")
}
err = os.WriteFile(filename, jsonString, os.ModePerm)
if err != nil {
return errors.Wrap(err, "write file failed")
}
return nil
} | [
-1.155835747718811,
-0.1286996752023697,
0.4008798599243164,
-0.26081424951553345,
1.1404701471328735,
0.5390192866325378,
-0.3213050961494446,
0.4497484266757965,
-0.49693307280540466,
0.8510684370994568,
0.0496358722448349,
0.6519220471382141,
-0.3152202069759369,
-0.05945504829287529,
... |
func (*Order) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
for i := range columns {
switch columns[i] {
case order.FieldID:
values[i] = new(sql.NullInt64)
default:
return nil, fmt.Errorf("unexpected column %q for type Order", columns[i])
}
}
return ... | [
-0.9713269472122192,
0.6144246459007263,
0.5527467131614685,
1.4790624380111694,
0.03066023625433445,
-0.8649806380271912,
-1.201669454574585,
-0.9190519452095032,
-0.27359992265701294,
0.11826492100954056,
-0.03223460540175438,
-0.1349327713251114,
0.1108783558011055,
1.0121357440948486,
... |
func (o *Order) assignValues(columns []string, values []interface{}) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case order.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok ... | [
-0.6695501804351807,
0.22938574850559235,
0.5565888285636902,
0.7384868264198303,
0.4665253758430481,
-0.41306716203689575,
-0.623346745967865,
-0.3098362982273102,
-0.5001262426376343,
0.1316492259502411,
0.10982869565486908,
-0.6766166687011719,
-0.11334303766489029,
1.3109245300292969,
... |
func (o *Order) Update() *OrderUpdateOne {
return (&OrderClient{config: o.config}).UpdateOne(o)
} | [
0.014160923659801483,
0.029890907928347588,
0.27848944067955017,
1.060968279838562,
0.3249166011810303,
-0.6076140999794006,
-0.37595123052597046,
-0.3483941853046417,
0.6537390351295471,
0.34545570611953735,
-0.3956899344921112,
-0.33036482334136963,
-0.9625539779663086,
-0.13398961722850... |
func (o *Order) Unwrap() *Order {
tx, ok := o.config.driver.(*txDriver)
if !ok {
panic("ent: Order is not a transactional entity")
}
o.config.driver = tx.drv
return o
} | [
-0.5950675010681152,
0.5158595442771912,
0.5022611618041992,
0.16859303414821625,
-0.1783151477575302,
-0.7742686867713928,
-0.016123907640576363,
0.31401798129081726,
0.1982339769601822,
0.6630273461341858,
0.4108569920063019,
0.04664812237024307,
0.8182432651519775,
-0.49009087681770325,... |
func (o *Order) String() string {
var builder strings.Builder
builder.WriteString("Order(")
builder.WriteString(fmt.Sprintf("id=%v", o.ID))
builder.WriteByte(')')
return builder.String()
} | [
0.06724004447460175,
-0.47182199358940125,
0.29067355394363403,
-0.10742132365703583,
-0.15903441607952118,
0.3773626387119293,
-0.24911773204803467,
-1.5087779760360718,
-0.2629297077655792,
0.10149416327476501,
-0.5830734372138977,
0.21140533685684204,
-0.062324732542037964,
-0.198514953... |
func InitLogger() {
err := ParseLoggerConfig(fileutil.LogConfigPath())
//initialize log in any case
if err != nil {
lager.Init(&lager.Options{
LoggerLevel: lager.LevelDebug,
Writers: lager.Stdout,
})
if os.IsNotExist(err) {
openlog.Info(fmt.Sprintf("[%s] not exist", fileutil.LogConfigPath()))
} ... | [
0.24909375607967377,
-0.2472156584262848,
0.6915743947029114,
0.20896649360656738,
0.4332415461540222,
0.2904052436351776,
-0.33822333812713623,
1.0467420816421509,
-0.48661816120147705,
0.24122639000415802,
0.031160304322838783,
0.21666526794433594,
-0.06563980132341385,
1.744303345680236... |
func ParseLoggerConfig(file string) error {
LoggerOptions = &lager.Options{}
err := unmarshalYamlFile(file, LoggerOptions)
if err != nil && !os.IsNotExist(err) {
return err
}
return err
} | [
0.5503127574920654,
0.0234050489962101,
0.5769695043563843,
-0.7121167778968811,
-0.5121201872825623,
-0.16067591309547424,
-0.3124487102031708,
1.287880301475525,
-0.1572290062904358,
0.9879364371299744,
-0.6385814547538757,
-0.09714378416538239,
-0.015746336430311203,
2.020076036453247,
... |
func (a *Authenticator) GetToken() (jwt.Token, error) {
// If token is not set, and we have a token cache,
// try to retrieve it from the token cache
if a.Token.ExpiryDate == 0 && a.TokenCache != nil {
if err := a.retrieveTokenFromCache(); err != nil {
return jwt.Token{}, err
}
}
if a.Token.Expired() && a.... | [
-1.1125916242599487,
-0.2613760232925415,
0.5338314175605774,
0.2018762081861496,
-0.12723100185394287,
-0.8447118997573853,
0.07203065603971481,
0.1392766684293747,
1.0142533779144287,
-0.8192227482795715,
0.12434963136911392,
1.0452886819839478,
0.3040142357349396,
0.4535411298274994,
... |
func (a *Authenticator) retrieveTokenFromCache() error {
var err error
a.Token, err = a.TokenCache.Get(a.getTokenCacheKey())
if err != nil {
return fmt.Errorf("error getting token from cache: %w", err)
}
return nil
} | [
0.10487674176692963,
-0.013518370687961578,
-0.18932560086250305,
0.1329793632030487,
-0.1433204859495163,
-0.3755585551261902,
-0.2716568410396576,
0.4756174385547638,
0.6048104166984558,
-0.6513157486915588,
-0.5474367141723633,
0.506075382232666,
-0.04540117084980011,
0.1687879115343094... |
func (a *Authenticator) requestNewToken() (jwt.Token, error) {
restRequest, err := a.getAuthRequest()
if err != nil {
return jwt.Token{}, fmt.Errorf("error during auth request creation: %w", err)
}
getMethod := rest.PostMethod
httpRequest, err := restRequest.GetHTTPRequest(a.BasePath, getMethod.Method)
if err... | [
-1.2871392965316772,
-0.6840757131576538,
0.9364556670188904,
0.0481916144490242,
-0.22125667333602905,
-0.9722128510475159,
-0.3248022496700287,
-0.5250247716903687,
-0.008435188792645931,
-1.0931692123413086,
-0.5447273850440979,
1.137610673904419,
0.001128381467424333,
0.095807246863842... |
func (a *Authenticator) getNonce() (string, error) {
randomBytes := make([]byte, 8)
_, err := rand.Read(randomBytes)
if err != nil {
return "", fmt.Errorf("error when getting random data for new nonce: %w", err)
}
// convert to hex
return fmt.Sprintf("%02x", randomBytes), nil
} | [
-0.635427713394165,
0.2757134437561035,
0.9091947674751282,
0.3767598867416382,
-0.451277494430542,
-0.05043961480259895,
-0.6897634267807007,
-0.13977384567260742,
0.652381181716919,
-0.08616670966148376,
0.5511202812194824,
0.5189595222473145,
-0.9896060824394226,
0.133119598031044,
0.... |
func (a *Authenticator) getAuthRequest() (rest.Request, error) {
labelPostFix := time.Now().Unix()
nonce, err := a.getNonce()
if err != nil {
return rest.Request{}, err
}
authRequest := AuthRequest{
Login: a.Login,
Nonce: nonce,
Label: fmt.Sprintf("%s-%d", labelPrefix, labelPos... | [
-0.9772821068763733,
-0.16828788816928864,
0.6323319673538208,
0.1858271062374115,
-0.26990053057670593,
-0.6062617301940918,
-0.24331767857074738,
0.13376852869987488,
0.516413688659668,
-0.19604827463626862,
0.7959091067314148,
1.4027149677276611,
0.15012238919734955,
0.1307184249162674,... |
func (a *Authenticator) getTokenCacheKey() string {
return fmt.Sprintf("%s-%s-token", labelPrefix, a.Login)
} | [
-1.050937533378601,
0.3982739746570587,
0.3199661076068878,
0.03343641385436058,
-0.34838220477104187,
-0.03615039214491844,
-0.983758270740509,
-0.5016589164733887,
0.2525283098220825,
-0.09220804274082184,
-0.26634085178375244,
0.687779426574707,
0.48044008016586304,
0.009289219044148922... |
func (a *Authenticator) getTokenExpirationString() string {
if a.TokenExpiration != time.Duration(0) {
return fmt.Sprintf("%0.0f seconds", a.TokenExpiration.Seconds())
}
return defaultTokenExpiration
} | [
-0.01208920031785965,
0.29147014021873474,
0.10117985308170319,
0.5885888338088989,
-0.27743250131607056,
-0.009628921747207642,
-1.1723859310150146,
-0.5615965723991394,
0.05112861096858978,
0.7664116621017456,
0.693497359752655,
-0.028767075389623642,
-0.21429526805877686,
0.325103074312... |
func NewClient(ctx context.Context, cfg ClientConfig) (*Client, error) {
config := &tfe.Config{
Token: cfg.Token,
}
tfeClient, err := tfe.NewClient(config)
if err != nil {
return nil, fmt.Errorf("could not create a new TFE tfeClient: %w", err)
}
w, err := tfeClient.Workspaces.Read(ctx, cfg.Organization, cfg.... | [
0.29768815636634827,
-0.24926187098026276,
0.141849547624588,
-0.5393434762954712,
-0.07888736575841904,
0.07737328112125397,
0.5747894048690796,
-0.5771955251693726,
-0.5663487911224365,
0.11078065633773804,
-0.41917067766189575,
0.46494001150131226,
0.05010958015918732,
0.195798888802528... |
func (c *Client) Run(ctx context.Context, options RunOptions) (output RunOutput, err error) {
cvOptions := tfe.ConfigurationVersionCreateOptions{
// Don't automatically queue the new run, we want to create the run
// manually to be able to set the message.
AutoQueueRuns: tfe.Bool(false),
Speculative: tfe.Boo... | [
-0.20361825823783875,
-0.1544303297996521,
0.608574628829956,
0.04910782724618912,
0.7634433507919312,
-0.3815605342388153,
1.1068817377090454,
-0.8625566363334656,
-0.6285224556922913,
0.48812898993492126,
-0.285550594329834,
0.6001878380775452,
-0.2741820514202118,
0.5415766835212708,
... |
func (c *Client) GetTerraformOutputs(ctx context.Context) (map[string]string, error) {
s, err := c.client.StateVersions.Current(ctx, c.workspace.ID)
if err != nil {
return nil, fmt.Errorf("could not get current state: %w", err)
}
bytes, err := c.client.StateVersions.Download(ctx, s.DownloadURL)
if err != nil {
... | [
-0.42228373885154724,
-1.339127779006958,
0.37905895709991455,
-0.7064937949180603,
-0.41672226786613464,
-0.6037196516990662,
-0.33870729804039,
-0.8879067897796631,
-0.532758891582489,
0.5055158734321594,
-0.44034814834594727,
0.007490960881114006,
0.08939222246408463,
0.1265087872743606... |
func pollWithContext(ctx context.Context, timeout time.Duration, pollFn func() (success bool, err error)) error {
start := time.Now()
for {
select {
case <-ctx.Done():
return context.Canceled
case <-time.After(500 * time.Millisecond):
success, err := pollFn()
if err != nil || success {
return err
... | [
-0.036307912319898605,
0.5471305251121521,
0.7289958000183105,
0.29242032766342163,
-1.262174129486084,
0.6402540802955627,
-1.134214162826538,
-0.9132760763168335,
0.5962736010551453,
1.3034980297088623,
0.2339436411857605,
-0.30886131525039673,
0.4363000690937042,
-0.15957163274288177,
... |
func AddServant(v dispatch, f interface{}, obj string) {
addServantCommon(v, f, obj, false)
} | [
-0.0861334428191185,
-0.19587811827659607,
0.5085697770118713,
0.4516107439994812,
-0.44388216733932495,
0.4066688120365143,
-0.2236095666885376,
0.14926080405712128,
-0.0221774410456419,
-0.992188036441803,
-1.2111561298370361,
0.11706725507974625,
0.6843101978302002,
0.2738892138004303,
... |
func AddServantWithContext(v dispatch, f interface{}, obj string) {
addServantCommon(v, f, obj, true)
} | [
0.06759773194789886,
-0.36157017946243286,
0.7807071208953857,
0.7565747499465942,
-0.5388964414596558,
0.3387581706047058,
-0.5348286032676697,
-0.45398110151290894,
0.7943016886711121,
0.11711971461772919,
-1.177908182144165,
0.07691874355077744,
0.8501313924789429,
0.17706185579299927,
... |
func AddHttpServant(mux *TarsHttpMux, obj string) {
AddHttpServantWithExceptionStatusChecker(mux, obj, DefaultExceptionStatusChecker)
} | [
-0.13482460379600525,
-0.27428027987480164,
0.5763607025146484,
-0.026642607524991035,
-0.7872325778007507,
1.0099444389343262,
-0.8724753260612488,
0.1418795883655548,
-0.46461912989616394,
-0.6319952011108398,
-0.7696871161460876,
-0.1731812208890915,
0.26432499289512634,
0.4951671361923... |
func AddHttpServantWithExceptionStatusChecker(mux *TarsHttpMux, obj string, exceptionStatusChecker func(int) bool) {
cfg, ok := tarsConfig[obj]
if !ok {
ReportNotifyInfo(NOTIFY_ERROR, "servant obj name not found:"+obj)
TLOG.Debug("servant obj name not found:", obj)
panic(ok)
}
TLOG.Debug("add http server:", c... | [
-0.21453064680099487,
-0.4210824966430664,
0.9986722469329834,
-0.2500332295894623,
-0.7096056938171387,
1.2630773782730103,
-0.3567832410335541,
0.5135629773139954,
-0.3824188709259033,
-0.23510229587554932,
-0.41137340664863586,
0.1708880364894867,
0.40037742257118225,
0.8483564257621765... |
func AddServantWithProtocol(proto transport.ServerProtocol, obj string) {
objRunList = append(objRunList, obj)
cfg, ok := tarsConfig[obj]
if !ok {
ReportNotifyInfo(NOTIFY_ERROR, "servant obj name not found:"+obj)
TLOG.Debug("servant obj name not found ", obj)
panic(ok)
}
TLOG.Debug("add:", cfg)
s := transpo... | [
-0.27085360884666443,
-0.4172506332397461,
0.7265217900276184,
-0.18389640748500824,
-0.25293388962745667,
1.2662675380706787,
-0.22023238241672516,
-0.16667672991752625,
0.05925990641117096,
0.09054367989301682,
-1.6303068399429321,
0.24685434997081757,
-0.6166056394577026,
0.498748779296... |
func NewUtilizationTracker(
workerName string,
windowSize time.Duration,
pollingInterval time.Duration,
) (UtilizationTracker, error) {
return newUtilizationTrackerWithClock(
workerName,
windowSize,
pollingInterval,
clock.New(),
)
} | [
-0.1259724497795105,
0.39013826847076416,
0.44483548402786255,
0.31196296215057373,
-1.4823700189590454,
-0.1041879653930664,
0.0443609356880188,
-0.41256818175315857,
-0.2018773853778839,
-0.21168303489685059,
-0.5824475288391113,
-0.1612180918455124,
-0.6513134241104126,
1.37610363960266... |
func newUtilizationTrackerWithClock(
workerName string,
windowSize time.Duration,
pollingInterval time.Duration,
clk clock.Clock,
) (UtilizationTracker, error) {
sw, err := util.NewSlidingWindowWithClock(windowSize, pollingInterval, clk)
if err != nil {
return nil, err
}
ut := &utilizationTracker{
workerN... | [
-0.02934904210269451,
0.3595432937145233,
0.9464510083198547,
-0.26102975010871887,
-0.9921867847442627,
0.36064013838768005,
0.6692546010017395,
-0.6536484360694885,
0.02305813692510128,
-0.08778511732816696,
0.02269083634018898,
0.2584877610206604,
-0.002756571164354682,
1.05461990833282... |
func (ut *utilizationTracker) Start() error {
ut.Lock()
defer ut.Unlock()
if ut.started {
return fmt.Errorf("Attempted to use UtilizationTracker.Start() when the tracker was already started")
}
if ut.stopped {
return fmt.Errorf("Attempted to use UtilizationTracker.Start() after the tracker was stopped")
}
... | [
-0.03747732192277908,
0.47677916288375854,
0.40049126744270325,
0.1273539662361145,
0.3573431074619293,
0.22044625878334045,
0.5302045941352844,
0.47051578760147095,
-0.5567429661750793,
-0.17640165984630585,
0.29227814078330994,
0.806541383266449,
0.1273966133594513,
0.6794882416725159,
... |
func (ut *utilizationTracker) Stop() error {
ut.Lock()
defer ut.Unlock()
if !ut.started {
return fmt.Errorf("Attempted to use UtilizationTracker.Stop() when the tracker was never started")
}
if ut.stopped {
return fmt.Errorf("Attempted to use UtilizationTracker.Stop() when the tracker was already stopped")
... | [
-0.8377264142036438,
0.472467839717865,
0.46929752826690674,
-0.13667850196361542,
0.2923603057861328,
0.6614577770233154,
0.49707362055778503,
-0.008975214324891567,
-0.6930839419364929,
0.06802190095186234,
0.19809478521347046,
0.3858821988105774,
-0.3650955855846405,
0.1463080644607544,... |
func (ut *utilizationTracker) CheckStarted(longRunning bool) {
ut.Lock()
ut.isRunningLongCheck = longRunning
ut.checkStart = ut.clock.Now()
ut.Unlock()
} | [
0.06732352077960968,
-0.4030071198940277,
0.6245133876800537,
0.2301304042339325,
0.7444711923599243,
0.9117560386657715,
0.1044258177280426,
0.7278101444244385,
0.038125064224004745,
-0.327619731426239,
-0.3158414959907532,
1.090010166168213,
-0.26066160202026367,
0.48372215032577515,
-... |
func (ut *utilizationTracker) CheckFinished() {
ut.Lock()
duration := ut.clock.Now().Sub(ut.checkStart)
ut.busyDuration += duration
ut.isRunningLongCheck = false
ut.checkStart = time.Time{}
ut.Unlock()
} | [
-0.3415628969669342,
0.13280987739562988,
0.39087218046188354,
0.16495485603809357,
0.880526602268219,
0.5415652394294739,
0.29936206340789795,
0.04285706952214241,
-0.5792716145515442,
0.3252963125705719,
-0.24588580429553986,
0.975507378578186,
-0.12764038145542145,
1.1671026945114136,
... |
func (ut *utilizationTracker) IsRunningLongCheck() bool {
ut.RLock()
defer ut.RUnlock()
return ut.isRunningLongCheck
} | [
-0.6716569662094116,
0.1401350498199463,
0.5269252061843872,
0.6900607347488403,
0.1631840467453003,
0.5925620198249817,
0.18634895980358124,
0.39249008893966675,
-0.3919943571090698,
-1.129770278930664,
-0.012976023368537426,
0.49541282653808594,
-0.3167446255683899,
0.31899094581604004,
... |
func (gsR *GameStatusRecord) ScreenOutput() {
fmt.Println(gsR)
} | [
0.16344964504241943,
-0.694046139717102,
0.36427170038223267,
-0.4116919934749603,
-0.20449383556842804,
0.442587286233902,
-0.15254367887973785,
-0.5447905659675598,
-0.5730913281440735,
0.4146886467933655,
0.364790678024292,
0.6520939469337463,
-0.36942335963249207,
1.1620831489562988,
... |
func (gsR *GameStatusRecord) FileOutput(filePtr *os.File) {
fmt.Fprintf(filePtr, "%s|%d|%s|%s|%s|%d|%t|%d|%d|%d|%s|%s|%t|%t|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
gsR.EffectiveDate.Format(time.UnixDate),
gsR.ID,
gsR.Status,
gsR.Ind,
gsR.Reason,
gsR.CurrentInning,
gsR.TopOfInning,
gsR.Balls,
gsR.Stri... | [
0.7652391195297241,
-0.9570012092590332,
0.606977641582489,
-1.0566662549972534,
0.07378137111663818,
0.2444147914648056,
-0.17818035185337067,
0.2875169813632965,
-1.2958407402038574,
0.27752506732940674,
0.24989299476146698,
0.429024338722229,
0.13199059665203094,
-0.03634548932313919,
... |
func (gsR *GameStatusRecord) CreateTable(db *sql.DB) {
statement := `CREATE TABLE IF NOT EXISTS GameStatusRecord (
effectiveDate timestamp with time zone,
id bigint,
status varchar(128),
ind varchar(8),
reason varchar(128),
currentInning int,
topOfInning boolean,
balls int,
strikes i... | [
0.8074703812599182,
-0.126007080078125,
0.734409511089325,
-0.6514923572540283,
0.9193388223648071,
0.5101053714752197,
0.2963739037513733,
-0.4168660640716553,
-0.6062110066413879,
0.1405346393585205,
0.13500604033470154,
-0.25463369488716125,
-0.2083694487810135,
0.03432965278625488,
0... |
func (gsR *GameStatusRecord) UpdateRecord(db *sql.DB) {
/*
1. If this is a unique record, insert it.
2. If this is a duplicate record and the effective date is later,
update the existing record.
*/
statement := `SET timezone='UTC';`
_, err := db.Exec(statement)
if err != nil {
if pqerr, ok := err.(*pq.... | [
0.028755150735378265,
0.20424725115299225,
0.9090728759765625,
-0.4785934388637543,
0.27557656168937683,
0.6554186344146729,
0.21848225593566895,
0.3164374828338623,
-0.44419875741004944,
0.5657839179039001,
0.25840863585472107,
0.2084924578666687,
-0.08909585326910019,
0.35220611095428467... |
func RegisterGlobalRule(selector string, properties ...Declaration) {
styles = append(styles, Rule{
Selector: selector,
Declarations: properties,
})
} | [
0.0010909111006185412,
0.6819626688957214,
0.2668071389198303,
-0.40775033831596375,
1.1018881797790527,
1.0545763969421387,
-1.225422739982605,
1.3808220624923706,
-1.144816279411316,
0.6528245806694031,
-0.3704371154308319,
1.1030076742172241,
-0.28842681646347046,
0.8480778932571411,
... |
func RegisterGlobalClass(name string, properties ...Declaration) {
if !strings.HasPrefix(name, ".") {
name = "." + name
}
styles = append(styles, Rule{
Selector: name,
Declarations: properties,
})
} | [
-0.21149340271949768,
0.7326257228851318,
0.5871513485908508,
-0.04300391301512718,
0.508952260017395,
1.0860087871551514,
-1.129162311553955,
0.6724720597267151,
-0.8321382403373718,
0.3842875361442566,
-0.20407509803771973,
0.4120500683784485,
-0.03893280029296875,
1.271723985671997,
0... |
func Stylesheet() string {
var sb strings.Builder
for i := 0; i < len(styles); i++ {
r := styles[i]
sb.WriteString(r.String())
}
return sb.String()
} | [
-0.19190476834774017,
-0.8739327788352966,
0.3445560932159424,
-0.9753591418266296,
0.5354515910148621,
0.7704294323921204,
0.05552246794104576,
-0.5161357522010803,
-0.5363885760307312,
0.21577873826026917,
1.4147313833236694,
0.05870025232434273,
-0.5185068249702454,
-0.47294366359710693... |
func (r Rule) String() string {
//TODO: Should write this directly to a writer instead of to an internal builder.
var sb strings.Builder
sb.WriteString(r.Selector)
sb.WriteRune('{')
for i := 0; i < len(r.Declarations); i++ {
d := r.Declarations[i]
sb.WriteString(d.Property)
sb.WriteRune(':')
sb.WriteString... | [
0.348386287689209,
-0.918744683265686,
0.273180216550827,
-0.809718906879425,
0.7187082767486572,
0.6502888202667236,
0.5285259485244751,
-0.23946291208267212,
-0.7269735932350159,
-0.018652327358722687,
0.33287835121154785,
0.44699257612228394,
0.2276650071144104,
-0.3448634445667267,
0... |
func Class(name string, properties ...Declaration) (id ClassID) {
id = ClassID(fmt.Sprintf("%s_%d", name, len(styles)))
r := Rule{
Selector: "." + string(id),
Declarations: properties,
}
styles = append(styles, r)
return
} | [
-0.07382950186729431,
-0.07570260763168335,
0.43048158288002014,
-0.799425482749939,
0.06387842446565628,
0.43422621488571167,
-0.25523054599761963,
0.9365442395210266,
-0.1611870676279068,
-0.4458894431591034,
0.08406885713338852,
0.30202436447143555,
0.5422411561012268,
0.537324070930481... |
func Property(name, value string) Declaration {
return Declaration{
Property: name,
Value: value,
}
} | [
0.8714448809623718,
-1.4626519680023193,
0.31964603066444397,
-0.030078470706939697,
-1.111238718032837,
0.08607753366231918,
-0.10589858144521713,
0.5249540209770203,
0.5163468718528748,
-0.5331409573554993,
0.3602619171142578,
0.7179430723190308,
0.44524404406547546,
-0.383861780166626,
... |
func BackgroundColor(v ColorValue) Declaration {
return Declaration{
Property: "background-color",
Value: string(v),
}
} | [
1.7702339887619019,
0.1746225357055664,
0.42367130517959595,
-0.4455759525299072,
-0.04538676515221596,
0.049480825662612915,
0.5893341898918152,
0.8339208960533142,
0.5087318420410156,
-0.02728050760924816,
0.448490709066391,
0.5712147355079651,
0.2669776678085327,
0.369023859500885,
-0... |
func Color(v ColorValue) Declaration {
return Declaration{
Property: "color",
Value: string(v),
}
} | [
0.6826128363609314,
-0.15399250388145447,
0.28926709294319153,
-0.7330498695373535,
-0.03995796665549278,
0.5816908478736877,
0.330439031124115,
0.7415158748626709,
0.709123432636261,
-0.25183260440826416,
0.6797767877578735,
0.9225834608078003,
1.0823346376419067,
0.91853266954422,
-0.5... |
func UnmarshallServiceKeyJSON(serviceKeyJSON string) (ansServiceKey ServiceKey, err error) {
if err = json.Unmarshal([]byte(serviceKeyJSON), &ansServiceKey); err != nil {
err = errors.Wrap(err, "error unmarshalling ANS serviceKey")
}
return
} | [
-0.6080707907676697,
-0.3120384216308594,
0.2346368134021759,
-1.0989160537719727,
-2.0819337368011475,
-0.3635495901107788,
-0.17839395999908447,
0.20477575063705444,
0.15586158633232117,
0.8933488130569458,
0.10452467948198318,
0.7558028101921082,
0.14764314889907837,
1.1699750423431396,... |
func (ans *ANS) SetServiceKey(serviceKey ServiceKey) {
ans.XSUAA = xsuaa.XSUAA{
OAuthURL: serviceKey.OauthUrl,
ClientID: serviceKey.ClientId,
ClientSecret: serviceKey.ClientSecret,
}
ans.URL = serviceKey.Url
} | [
-0.7506548166275024,
-0.13632170855998993,
0.23343095183372498,
-0.4855472147464752,
-0.523308515548706,
-0.5158509016036987,
0.13615737855434418,
0.09873595088720322,
0.15365667641162872,
0.5601650476455688,
-0.36742401123046875,
1.770722508430481,
0.32545560598373413,
1.4187963008880615,... |
func (ans *ANS) CheckCorrectSetup() error {
const testPath = "/cf/consumer/v1/matched-events"
entireUrl := strings.TrimRight(ans.URL, "/") + testPath
response, err := ans.sendRequest(http.MethodGet, entireUrl, nil)
if err != nil {
return err
}
return handleStatusCode(entireUrl, http.StatusOK, response)
} | [
-0.6352024078369141,
0.38913002610206604,
0.9441657066345215,
0.4879140257835388,
0.2517227828502655,
-0.5904045701026917,
0.9313532114028931,
0.06876444071531296,
-0.039253298193216324,
0.5847751498222351,
0.6782448887825012,
-0.05986389145255089,
-0.40583834052085876,
0.4168260991573334,... |
func (ans *ANS) Send(event Event) error {
const eventPath = "/cf/producer/v1/resource-events"
entireUrl := strings.TrimRight(ans.URL, "/") + eventPath
requestBody, err := json.Marshal(event)
if err != nil {
return err
}
response, err := ans.sendRequest(http.MethodPost, entireUrl, bytes.NewBuffer(requestBody))... | [
-0.9357017278671265,
0.41302818059921265,
0.6060090065002441,
0.419747918844223,
-0.8007065653800964,
0.11021821945905685,
0.14639313519001007,
-0.19549083709716797,
0.00978722982108593,
0.5294362306594849,
-0.3997221887111664,
0.2416267991065979,
0.005299449898302555,
0.44242602586746216,... |
func (m BytesOutProtocol) Marshal() ([]byte, error) {
return []byte(m), nil
} | [
0.4009361267089844,
0.5770270824432373,
0.15390600264072418,
-0.5245574116706848,
-0.5343984961509705,
0.6236867308616638,
-0.7963665723800659,
0.09219060838222504,
-0.2821834981441498,
0.142955482006073,
-0.6338440775871277,
1.5218243598937988,
-1.3593339920043945,
0.1514783799648285,
-... |
func (m BytesOutProtocol) String() string {
return string(m)
} | [
0.7735571265220642,
-0.597313642501831,
0.05515694618225098,
-0.9855920672416687,
-0.922447919845581,
0.7123777270317078,
0.7508026361465454,
-1.0914576053619385,
-0.3027172088623047,
0.33444464206695557,
-0.4629403054714203,
0.7234318852424622,
-1.2768018245697021,
-0.69529789686203,
-0... |
func NewModule(mid uint8, acts ...IAction) IModule {
modActions := make(map[uint8]IAction, len(acts))
for _, v := range acts {
modActions[v.GetAID()] = v
}
return &baseModule{mid: mid, actions: modActions}
} | [
-0.5517494082450867,
-0.46451282501220703,
0.18907123804092407,
-0.06380926072597504,
0.14213056862354279,
0.09755928069353104,
0.1756954938173294,
-0.725254237651825,
1.3469325304031372,
0.11354143917560577,
0.3341407775878906,
0.6517043113708496,
-0.2101660817861557,
-0.3395387530326843,... |
func OptionRouteEnabler(enabler IRouteEnabler) RouterOptionFunc {
return func(r *Router) {
r.enabler = enabler
}
} | [
-0.008868992328643799,
-0.8142627477645874,
0.46891623735427856,
-0.12521867454051971,
-0.7114121913909912,
-0.10892518609762192,
0.30759987235069275,
1.3285391330718994,
0.8205463886260986,
1.2201757431030273,
-0.2539156973361969,
-0.6704541444778442,
-0.25579097867012024,
-0.575604140758... |
func OptionTimeoutResponse(timeout ITimeouter) RouterOptionFunc {
return func(r *Router) {
r.timeout = timeout
}
} | [
0.05290530249476433,
-0.9481157064437866,
0.17579083144664764,
-0.55855792760849,
0.0025874397251755,
-0.47241976857185364,
0.5813649296760559,
0.989487886428833,
1.4014722108840942,
1.124502420425415,
-0.41521695256233215,
-0.7960902452468872,
-0.021579459309577942,
-1.089802622795105,
... |
func OptionNoneResponse(resp IOutProtocol) RouterOptionFunc {
return func(r *Router) {
r.noneResp = resp
}
} | [
-0.7807838320732117,
-0.4355950653553009,
0.30398815870285034,
-0.7612770795822144,
0.5145562887191772,
-0.6488373279571533,
1.089905023574829,
-0.07903755456209183,
1.0045974254608154,
-0.5488404631614685,
-0.30371811985969543,
-1.037392497062683,
-0.7217538356781006,
-1.4602843523025513,... |
func NewRouter(opts ...RouterOptionFunc) *Router {
router := &Router{map[uint8]IModule{}, FullRouteEnabler, nil, nil}
for _, opt := range opts {
opt(router)
}
return router
} | [
-0.09689375758171082,
0.020165368914604187,
0.28162911534309387,
0.8793725967407227,
-0.42281681299209595,
-0.2590283155441284,
-0.1517437994480133,
0.012287168763577938,
0.6791333556175232,
0.23507601022720337,
-0.09858840703964233,
0.4452129006385803,
-0.9090225696563721,
0.1087398901581... |
func (router *Router) Register(modules ...IModule) {
for _, m := range modules {
router.modules[m.GetMID()] = m
}
} | [
-1.52657949924469,
0.09160605818033218,
0.18530091643333435,
0.021110355854034424,
1.0126112699508667,
0.5262731313705444,
-0.7211076617240906,
-0.5720773935317993,
-0.3208790421485901,
0.14342863857746124,
-0.7584691643714905,
0.10795572400093079,
-1.1748850345611572,
0.9178916215896606,
... |
func (router *Router) Dispatch(r IRequest) (IOutProtocol, bool) {
moduleID := r.GetMID()
actionID := r.GetAID()
var module IModule
if router.enabler.Enabled(moduleID, actionID) {
var ok bool
module, ok = router.modules[moduleID]
if !ok {
//TODO: log
//zaplog.S.Errorf("router: module(%d) not found", mod... | [
-0.792294979095459,
-0.4758252203464508,
0.8257466554641724,
-0.2793031930923462,
-0.5166411995887756,
0.46542981266975403,
-0.12199404090642929,
-0.3064062297344208,
0.5128852128982544,
0.6199103593826294,
0.1375599056482315,
-0.42924943566322327,
-1.2666563987731934,
0.06760840117931366,... |
func SetStatus(ctx context.Context, id string, status int) error {
// language=SQL
_, err := pgctx.Exec(ctx, `
update payments
set status = $2,
updated_at = now(),
at = now()
where id = $1
`, id, status)
return err
} | [
-0.6199674010276794,
-0.5038096308708191,
0.31509414315223694,
0.05421724170446396,
-0.6264261603355408,
0.15183116495609283,
-1.2350175380706787,
0.4831809103488922,
-0.0839252918958664,
0.5001275539398193,
-0.25689831376075745,
0.6286004781723022,
0.1508048176765442,
0.256736159324646,
... |
func HasPending(ctx context.Context, userID, courseID string) (exists bool, err error) {
// language=SQL
err = pgctx.QueryRow(ctx, `
select exists (
select 1
from payments
where user_id = $1 and course_id = $2 and status = $3
)
`, userID, courseID, Pending).Scan(&exists)
return
} | [
0.4467407166957855,
-0.06540314853191376,
0.7022770643234253,
-0.4536963701248169,
0.23360051214694977,
-0.05067848786711693,
-1.0938369035720825,
0.35359179973602295,
-1.044145941734314,
0.10322006046772003,
0.5210917592048645,
-0.18843868374824524,
0.4700988531112671,
0.5318970084190369,... |
func New() *service {
return &service{}
} | [
-0.17098240554332733,
-1.0978775024414062,
-0.3487088978290558,
-0.11594614386558533,
-0.788176953792572,
-0.20266889035701752,
-0.15932172536849976,
-0.7916200757026672,
-0.617013692855835,
-0.9510068893432617,
-0.26183098554611206,
0.7728388905525208,
-0.026231391355395317,
0.71668028831... |
func (c *Chain) UseC(f func(next HandlerC) HandlerC) {
*c = append(*c, f)
} | [
0.5474525690078735,
0.1931876391172409,
0.8669248819351196,
0.020672954618930817,
0.19634640216827393,
0.29987844824790955,
0.8099511861801147,
-0.11611460149288177,
-1.116698980331421,
-1.1123160123825073,
0.24099422991275787,
0.08677620440721512,
0.46191099286079407,
-0.00194225413724780... |
func (c *Chain) Use(f func(next http.Handler) http.Handler) {
xf := func(next HandlerC) HandlerC {
return HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
n := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTPC(ctx, w, r)
})
f(n).ServeHTTP(w, ... | [
-0.19003894925117493,
0.6387463212013245,
1.0289584398269653,
-0.23589080572128296,
0.12205959856510162,
-0.299112468957901,
0.05468278005719185,
-0.7204478979110718,
-0.9654393792152405,
-0.632962703704834,
0.10940692573785782,
0.5114530324935913,
-0.044018298387527466,
0.2315996438264846... |
func (c Chain) Handler(xh HandlerC) http.Handler {
ctx := context.Background()
return c.HandlerCtx(ctx, xh)
} | [
0.6880021691322327,
0.06527586281299591,
0.16549082100391388,
-0.08449184149503708,
0.20614385604858398,
0.9304205179214478,
-0.09780397266149521,
-0.36452630162239075,
0.0823676586151123,
-0.9627006649971008,
-0.7191770672798157,
0.670402467250824,
0.12379994243383408,
0.14542225003242493... |
func (c Chain) HandlerCtx(ctx context.Context, xh HandlerC) http.Handler {
return New(ctx, c.HandlerC(xh))
} | [
0.47289636731147766,
-0.6089852452278137,
0.23914822936058044,
-0.42175915837287903,
-0.1153954491019249,
1.0439473390579224,
-0.8658257126808167,
-0.1816861629486084,
-0.2543756663799286,
-0.8292998671531677,
-0.8579685688018799,
0.342529296875,
0.5010425448417664,
-0.7787233591079712,
... |
func (c Chain) HandlerC(xh HandlerC) HandlerC {
for i := len(c) - 1; i >= 0; i-- {
xh = c[i](xh)
}
return xh
} | [
0.8026750683784485,
-0.20878849923610687,
0.6106706857681274,
0.20575402677059174,
0.22253796458244324,
0.6391112208366394,
0.4141402542591095,
-0.22555330395698547,
-0.7152959108352661,
-0.5392158031463623,
0.1759168952703476,
0.43546152114868164,
0.23212966322898865,
0.03555427864193916,... |
func Host(host string) Option {
return func(o *Options) {
o.host = host
}
} | [
1.1241754293441772,
-0.08061914891004562,
0.30486589670181274,
0.42468351125717163,
0.03287326171994209,
0.5617716312408447,
0.19836831092834473,
0.4940885007381439,
0.4364527761936188,
-0.509806215763092,
-0.5696501135826111,
-0.17838063836097717,
0.1437988579273224,
-0.8462951183319092,
... |
func Name(name string) Option {
return func(o *Options) {
o.name = name
}
} | [
0.3072143495082855,
-0.06209656223654747,
0.5705527663230896,
-0.07976321130990982,
-0.5156275033950806,
-0.3569222688674927,
0.6697268486022949,
-0.6219159960746765,
0.6007322669029236,
0.6218698024749756,
-1.3017815351486206,
-0.7564377188682556,
0.7234032154083252,
-0.4436403512954712,
... |
func MainRouter(ctx context.Context, w http.ResponseWriter, r *http.Request) {
renderer.HTML(w, 200, "index", map[string]interface{}{})
} | [
-0.9444692730903625,
-0.4084216058254242,
0.6002585887908936,
0.22108665108680725,
-0.5559148192405701,
0.6806972026824951,
0.5283342599868774,
0.6669960618019104,
0.37606582045555115,
0.0124859269708395,
1.0876004695892334,
-0.6284053325653076,
-0.034182358533144,
0.9123260378837585,
-0... |
func ElectionsRouter(ctx context.Context, w http.ResponseWriter, r *http.Request) {
ElectionsMutex.RLock()
defer ElectionsMutex.RUnlock()
renderer.HTML(w, 200, "elections/index", map[string]interface{}{})
} | [
-1.9128063917160034,
-0.5040923953056335,
0.4225914180278778,
-0.23030957579612732,
0.11383306980133057,
-0.039361558854579926,
0.40766626596450806,
0.41309860348701477,
0.6734529733657837,
0.5192959308624268,
0.5499597191810608,
0.02737382799386978,
-0.5143341422080994,
0.5684447884559631... |
func FourSquareRouter(ctx context.Context, w http.ResponseWriter, r *http.Request) {
fs := fsq.NewFSVenuesClient(os.Getenv("FOURSQUARE_ID"), os.Getenv("FOURSQUARE_SECRET"))
params := map[string]string{
"near": r.FormValue("loc"),
"query": r.FormValue("for"),
"limit": "5",
}
venues, err := fs.GetVenues(param... | [
-1.1360268592834473,
-0.21690227091312408,
0.6549004316329956,
-0.6350621581077576,
-1.0597597360610962,
-0.5177470445632935,
0.43040645122528076,
0.737022876739502,
0.452588826417923,
0.9437143206596375,
-0.39185279607772827,
-0.005726528819650412,
-0.34492790699005127,
0.7027056217193604... |
func CloseRouter(ctx context.Context, w http.ResponseWriter, r *http.Request) {
// get the uuid
targetUUID := r.FormValue("uuid")
toUUID := uuid.FromStringOrNil(targetUUID)
// close
ElectionsMutex.Lock()
election := Elections[toUUID]
delete(Elections, toUUID)
ElectionsMutex.Unlock()
if election == nil {
pa... | [
-1.479470133781433,
-0.5593318343162537,
0.6506578922271729,
-0.6324779391288757,
-1.3324718475341797,
0.23075644671916962,
-0.09931900352239609,
0.7488259673118591,
0.4498648941516876,
0.688015878200531,
0.009314067661762238,
0.045062121003866196,
-0.5656066536903381,
0.5905221700668335,
... |
func VoteRouter(ctx context.Context, w http.ResponseWriter, r *http.Request) {
// get uuid if any
targetUUID := r.FormValue("uuid")
toUUID := uuid.FromStringOrNil(targetUUID)
ElectionsMutex.RLock()
defer ElectionsMutex.RUnlock()
election := Elections[toUUID]
if election == nil {
renderer.HTML(w, 200, "vote/i... | [
-1.5266284942626953,
-0.30613911151885986,
0.5129115581512451,
-0.5507422685623169,
-0.7401136159896851,
-0.1889890730381012,
-0.22383840382099152,
1.0602846145629883,
0.33271196484565735,
0.9580858945846558,
-0.030034219846129417,
0.2538067400455475,
0.11853079497814178,
0.589382410049438... |
func VotePushRouter(ctx context.Context, w http.ResponseWriter, r *http.Request) {
targetUUID := r.FormValue("uuid")
toUUID := uuid.FromStringOrNil(targetUUID)
ElectionsMutex.Lock()
defer ElectionsMutex.Unlock()
election := Elections[toUUID]
if election == nil {
panic(ErrBadRequest)
}
// get a vote
ranked... | [
-1.0800985097885132,
0.17631268501281738,
0.6852089762687683,
-0.14689595997333527,
-0.21264280378818512,
-0.20487616956233978,
-0.8509432077407837,
0.9444262981414795,
0.14956192672252655,
1.1506421566009521,
-0.08224686980247498,
0.3416152000427246,
0.13969506323337555,
0.612298250198364... |
func (c *Client) ByID(id string) (Movie, error) {
return Movie{}, fmt.Errorf("not implemented")
} | [
-0.7453213334083557,
-1.0680426359176636,
0.5268188118934631,
0.1635875701904297,
-0.5302430987358093,
0.21063095331192017,
0.020373215898871422,
-0.5244824886322021,
0.42523977160453796,
0.5597602725028992,
-0.7750760316848755,
2.26547908782959,
-0.7368320822715759,
0.3087754547595978,
... |
func (c *Client) ByTitle(title string, year int) (Movie, error) {
if title == "" {
return Movie{}, fmt.Errorf("can not find movie with empty title")
}
req, err := http.NewRequest("GET", apiEndpoint, nil)
if err != nil {
return Movie{}, fmt.Errorf("error when create http request: %v", err)
}
req.Header.Add("... | [
-1.110893964767456,
-0.7464190721511841,
1.075514793395996,
-0.2380674183368683,
-0.4587389826774597,
-0.3207123577594757,
-0.5512857437133789,
-0.6165474653244019,
-0.1219249740242958,
1.0151841640472412,
-0.16367824375629425,
1.240472435951233,
-0.8272478580474854,
0.02394566871225834,
... |
func (c *Client) Search(keyword string) ([]Movie, error) {
return []Movie{}, fmt.Errorf("not implemented")
} | [
-1.8690216541290283,
0.3215152323246002,
0.7416632771492004,
1.1239479780197144,
-0.5669907927513123,
0.4727356433868408,
-0.5113768577575684,
-0.9082760214805603,
0.3428609371185303,
0.624928891658783,
-0.992421567440033,
1.6174917221069336,
-1.3186147212982178,
1.087063193321228,
0.028... |
func New(apiKey string) *Client {
if apiKey == "" {
panic("can not create omdb client with empty apikey")
}
httpClient := &http.Client{Timeout: time.Duration(10) * time.Second}
return &Client{httpClient, apiKey}
} | [
-0.3850483298301697,
-0.17522551119327545,
0.21001321077346802,
-0.3018060624599457,
-1.0324667692184448,
-0.12404586374759674,
-0.2784024477005005,
-0.2059297114610672,
-0.09408674389123917,
0.8020861148834229,
-0.12423344701528549,
-0.04778704792261124,
-0.9647867679595947,
0.17732697725... |
func MergeSort(src []int64) {
if len(src) > 1 {
mid := len(src) / 2
// 定一个阀值,小于这个阀值就不再用多goroutine来MergeSort
// 如果不定一个阀值的话goroutine会过多,导致系统卡住,别问我是怎么知道的-_-
if len(src) <= max {
MergeSort(src[0:mid])
MergeSort(src[mid:])
} else {
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
... | [
-0.36723437905311584,
1.271120548248291,
0.7831704020500183,
0.07590682804584503,
-0.4511498808860779,
-0.031899407505989075,
0.0985293835401535,
-0.4617462158203125,
0.6475208401679993,
-0.1213422641158104,
-0.8177517652511597,
0.48376721143722534,
-1.5718979835510254,
0.794594407081604,
... |
func NewShardReplicationInfo(sr *ShardReplication, cell, keyspace, shard string) *ShardReplicationInfo {
return &ShardReplicationInfo{
ShardReplication: sr,
cell: cell,
keyspace: keyspace,
shard: shard,
}
} | [
0.8020524382591248,
0.39278078079223633,
0.3449385464191437,
-0.047128982841968536,
-0.9746000170707703,
-0.5500289797782898,
-0.5313613414764404,
0.07809358835220337,
-0.1895587295293808,
0.2065168023109436,
-0.892728328704834,
1.1699838638305664,
0.3249979019165039,
-0.3434978723526001,
... |
func (s *Service) ListWithSplit(keysChan chan *File) error {
req := &s3.ListObjectsV2Input{
Bucket: aws.String(s._s3.Bucket),
Prefix: aws.String(s._s3.Prefix),
}
err := s._client.ListObjectsV2Pages(req, func(resp *s3.ListObjectsV2Output, lastPage bool) bool {
for _, content := range resp.Contents {
var md... | [
-0.7654632329940796,
-0.6367620229721069,
1.0000840425491333,
-1.035132646560669,
-0.30172520875930786,
0.37028583884239197,
0.2696021497249603,
0.02088124305009842,
0.21817243099212646,
0.44810736179351807,
-1.189016580581665,
-0.5842081904411316,
-1.0449174642562866,
0.33515432476997375,... |
func ToRomanNumeral(arabic int) (string, error) {
if arabic <= 0 || arabic > 3000 {
return "", errors.New("true")
}
var romannumeral string
residual := arabic
for a := 0; a < (arabic / 1000); a++ {
romannumeral = romannumeral + "M"
residual = residual - 1000
}
arabic = residual
if arabic >= 900 {
ro... | [
-0.41092008352279663,
-0.6754708886146545,
0.7388008832931519,
-1.213195562362671,
-0.6416125297546387,
-0.23230025172233582,
0.2030894011259079,
-0.4486639201641083,
0.49019479751586914,
0.1871439814567566,
-0.055430419743061066,
0.422664612531662,
0.20651875436306,
-1.1616166830062866,
... |
func New() handler.Handler {
return &ceilometerMetricHandler{
ceilo: ceilometer.New(),
}
} | [
1.5044505596160889,
-0.9562440514564514,
-0.1557609736919403,
0.5817795991897583,
-1.2053641080856323,
1.4801005125045776,
0.4187193214893341,
0.3577316403388977,
-1.2435301542282104,
-0.04251236096024513,
-0.2850596308708191,
-0.9621550440788269,
0.6541993618011475,
0.22574661672115326,
... |
func (*_menuController) ListAuthTree(c *gin.Context) {
authData, err := service.GetLoginInfoByHeader(c)
if err != nil {
logger.Logger.Errorf("_menuController.ListAuthTree service.GetLoginInfoByHeader error: %#v", err)
c.JSON(http.StatusOK, mp.JsonData(def.AdminSystemErr, "", nil))
return... | [
-0.9537789225578308,
-0.598164439201355,
0.9071031808853149,
0.12593090534210205,
-0.6542534828186035,
-0.030492611229419708,
-0.6545971632003784,
-0.20297753810882568,
0.4256105124950409,
0.11520051211118698,
0.25299951434135437,
1.5196276903152466,
-0.3739074170589447,
1.6897366046905518... |
func New(cfg *config.Config) *HsmProvidersService {
return &HsmProvidersService{Client: client.New(
*cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
Endpoint: *cfg.Endpoint,
APIVersion: pingaccess.SDKVersion,
},
)}
} | [
-0.18999998271465302,
-1.338542103767395,
0.08730463683605194,
0.09486842900514603,
-0.030622383579611778,
-0.42899665236473083,
-0.7144540548324585,
-0.012867753393948078,
-0.4766964018344879,
0.6367796659469604,
0.3170090615749359,
0.7143176794052124,
-0.9692646265029907,
-0.038017217069... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.