text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func NewTickerDB(session *mgo.Session, buf int) TickerDB {
reporter := make(chan time.Time, buf)
publisher := make(chan *time.Time)
ticker := TickerDB{
session,
nil,
publisher,
reporter,
}
// Initialize ticker.latest from DB on remake
conn := ticker.session.Copy()
defer conn.Close()
tracks := conn.DB("... | [
0.04861818999052048,
-0.6551469564437866,
0.5832785367965698,
0.4277613162994385,
-0.1361847221851349,
-0.04944119602441788,
0.07516568899154663,
-0.3726819157600403,
-0.6057787537574768,
-0.36695653200149536,
-0.24902212619781494,
-0.1855207085609436,
-0.3996809720993042,
1.39771091938018... |
func (t *TickerDB) Reporter(latest time.Time) {
t.reporter <- latest
} | [
-0.7643394470214844,
0.2735384702682495,
0.407537043094635,
0.015468890778720379,
0.9455413818359375,
0.616754412651062,
0.5288938879966736,
0.507975697517395,
-0.7643036246299744,
-0.38217636942863464,
-0.8883091807365417,
-1.8895167112350464,
0.041015636175870895,
1.520851492881775,
-0... |
func (t *TickerDB) Latest() *time.Time {
return <-t.publisher
} | [
-0.22973734140396118,
-0.31038957834243774,
0.22529760003089905,
-0.4916592538356781,
0.32773011922836304,
0.2269991636276245,
-0.729107141494751,
-0.09098733961582184,
-1.2999895811080933,
0.11870919167995453,
0.053940318524837494,
-0.09739872068166733,
-0.6687347292900085,
0.622863054275... |
func (t *TickerDB) GetReport(limit int) (rep TickerReport, err error) {
rep, err = t.GetReportAfter(time.Unix(0, 0), limit)
return
} | [
0.1360798478126526,
1.7447437047958374,
0.5011663436889648,
0.14573895931243896,
1.0268079042434692,
-0.7671916484832764,
0.3755331337451935,
-0.39954477548599243,
-0.46996334195137024,
-0.4768027663230896,
-0.2207922488451004,
0.10608968138694763,
-1.0596344470977783,
-0.0665164440870285,... |
func (t *TickerDB) GetReportAfter(timestamp time.Time, limit int) (rep TickerReport, err error) {
start := time.Now()
conn := t.session.Copy()
defer conn.Close()
tracks := conn.DB("").C(trackCollection)
var trackMetas []TrackMeta
err = tracks.
Find(bson.M{"timestamp": bson.M{"$gt": timestamp}}).
Limit(limit... | [
0.6370006203651428,
1.0069540739059448,
0.8274123072624207,
-0.4078337252140045,
0.8087529540061951,
-0.6304959654808044,
-0.3287932574748993,
-0.10066694766283035,
-0.42333027720451355,
-0.48998159170150757,
-0.14737461507320404,
0.264004647731781,
-0.4680275321006775,
-0.3662382066249847... |
func Query(db gnorm.DB, schema string) ([]*Row, error) {
const sqlstr = `
SELECT name,
type,
rootpage,
sql
FROM sqlite_master
WHERE type = 'table'
;
`
log.Println("querying tables ", sqlstr)
var vals []*Row
q, err := db.Query(sqlstr, schema)
if err != ni... | [
-0.14173609018325806,
0.7951985001564026,
0.43146997690200806,
1.318931221961975,
-1.050068974494934,
-0.012543510645627975,
-0.7298855781555176,
0.05222779139876366,
0.48008501529693604,
0.0521707758307457,
0.7774653434753418,
0.027525514364242554,
-0.6116148829460144,
1.1082041263580322,... |
func (c *Conoha) ComputeKeypairs(ctx context.Context) ([]*KeypairParent, *ResponseMeta, error) {
apiEndPoint := fmt.Sprintf("%s/v2/%s/os-keypairs", c.ComputeServiceURL, c.TenantID)
p := getComputeKeypairsResponseParam{}
contents, meta, err := c.buildAndExecRequest(ctx, http.MethodGet, apiEndPoint, nil)
if err ==... | [
-1.3983979225158691,
0.6857854127883911,
0.4739135503768921,
0.5349106192588806,
-0.48811209201812744,
-0.04509403184056282,
-0.18067406117916107,
0.047078169882297516,
-0.29861512780189514,
0.7718205451965332,
-0.6220372319221497,
-0.008495141752064228,
-1.5306813716888428,
0.530042946338... |
func (c *Create) AccessValidate() error {
if !c.Role.FileAccess.Can(data.AccessWrite) {
return apperr.Access{Where: "File", Permission: string(data.AccessWrite)}
}
return nil
} | [
0.8443095684051514,
-0.48831209540367126,
0.5352783203125,
-0.2828410565853119,
-0.029669737443327904,
0.2877079248428345,
0.4094453454017639,
0.0421159565448761,
-1.126976490020752,
-0.05188896507024765,
2.2386202812194824,
0.11293306201696396,
-0.22246114909648895,
0.7322468757629395,
... |
func ParsePlaidLinkData(in string) (*PlaidLinkData, error) {
var data PlaidLinkData
err := json.Unmarshal([]byte(in), &data)
if err != nil {
return nil, errors.Wrap(err, "unjson data")
}
return &data, nil
} | [
-0.564434289932251,
-0.5196033716201782,
0.44216790795326233,
-1.9411847591400146,
-0.8498439192771912,
0.7893399596214294,
-0.561065137386322,
0.11284863948822021,
0.9856215119361877,
-0.8101486563682556,
-0.7000276446342468,
0.8450430631637573,
-0.9185040593147278,
-0.05304376035928726,
... |
func createClientPlaid() (*plaid.Client, error) {
options := plaid.ClientOptions{
ClientID: GetPlaidClientID(),
Secret: GetPlaidSecret(),
}
//set the environment
if GetPlaidSandboxDisable() {
options.Environment = plaid.Production
} else {
options.Environment = plaid.Sandbox
}
client, err := plaid.New... | [
0.9927380084991455,
-0.6723365783691406,
0.3907071352005005,
-1.2210580110549927,
-0.32891416549682617,
1.3571304082870483,
-0.5724127292633057,
-0.790947675704956,
0.8012794256210327,
-0.13841965794563293,
0.3827941417694092,
0.7060900926589966,
-1.1365466117858887,
-0.1510743349790573,
... |
func CreatePlaidLinkToken(ctx context.Context, orderID *uuid.UUID, email string) (*PlaidLinkToken, error) {
ctx, logger := GetLogger(ctx)
start := time.Now()
defer func() {
logger.Debugw("plaid create link token", "elapsedMS", FormatElapsedMS(start))
AddCtxStatsAPI(ctx, ServerStatAPIPlaid, "plaid create link tok... | [
-0.04924603924155235,
-0.18582183122634888,
0.4411405622959137,
-1.1823004484176636,
0.25226524472236633,
0.6685405373573303,
-0.7239400148391724,
-0.14443577826023102,
0.7780603766441345,
-0.5441592931747437,
-0.630486249923706,
1.428600788116455,
-0.6177064776420593,
0.12645818293094635,... |
func ExchangePlaidToken(ctx context.Context, token string) (*PlaidAccessToken, error) {
ctx, logger := GetLogger(ctx)
start := time.Now()
defer func() {
logger.Debugw("plaid exchange token", "elapsedMS", FormatElapsedMS(start))
AddCtxStatsAPI(ctx, ServerStatAPIPlaid, "plaid exchange token", time.Since(start))
}... | [
-0.1927747130393982,
0.27887463569641113,
0.4848184585571289,
-1.8518089056015015,
-0.4237988591194153,
0.23051361739635468,
-0.5559215545654297,
0.15979617834091187,
0.9807677268981934,
-0.011449203826487064,
-0.6100740432739258,
1.5766825675964355,
-0.4385310113430023,
0.5265042781829834... |
func CreatePlaidStripeToken(ctx context.Context, token string, accountID string) (*PlaidStripeToken, error) {
ctx, logger := GetLogger(ctx)
start := time.Now()
defer func() {
logger.Debugw("plaid stripe token", "elapsedMS", FormatElapsedMS(start))
AddCtxStatsAPI(ctx, ServerStatAPIPlaid, "plaid stripe token", tim... | [
-0.24970389902591705,
-0.18447837233543396,
0.31258732080459595,
-1.7116659879684448,
-0.10050005465745926,
0.5221933126449585,
-0.8499446511268616,
-0.040939461439847946,
0.6157436370849609,
-0.4831301271915436,
-1.0986675024032593,
0.905616819858551,
-0.16852255165576935,
0.3616207838058... |
func closeAll(closers ...xclose.Closer) error {
multiErr := xerrors.NewMultiError()
for _, closer := range closers {
if err := closer.Close(); err != nil {
multiErr = multiErr.Add(err)
}
}
return multiErr.FinalError()
} | [
-0.42157235741615295,
-0.3600154519081116,
0.6824911832809448,
0.9478715062141418,
-0.258853018283844,
0.5691309571266174,
-1.0246483087539673,
-0.6129888296127319,
-0.15980467200279236,
-0.21511325240135193,
0.7043375968933105,
-0.2114705890417099,
-0.5303109288215637,
0.7729077935218811,... |
func DeleteFiles(filePaths []string) error {
multiErr := xerrors.NewMultiError()
for _, file := range filePaths {
if err := os.Remove(file); err != nil {
detailedErr := fmt.Errorf("failed to remove file %s: %v", file, err)
multiErr = multiErr.Add(detailedErr)
}
}
return multiErr.FinalError()
} | [
0.6339878439903259,
0.6100595593452454,
0.2281699776649475,
0.18984512984752655,
0.32727140188217163,
0.2908501923084259,
0.2516772747039795,
0.4771067798137665,
0.20645177364349365,
0.27118563652038574,
1.054931402206421,
-0.4730079770088196,
-0.8920103311538696,
0.4110037088394165,
-0.... |
func DeleteDirectories(dirPaths []string) error {
multiErr := xerrors.NewMultiError()
for _, dir := range dirPaths {
if err := os.RemoveAll(dir); err != nil {
detailedErr := fmt.Errorf("failed to remove dir %s: %v", dir, err)
multiErr = multiErr.Add(detailedErr)
}
}
return multiErr.FinalError()
} | [
-0.2979605495929718,
0.6477490663528442,
0.32883551716804504,
0.5794972777366638,
0.11013446748256683,
0.20346146821975708,
0.7479375600814819,
-0.04080483689904213,
0.9294384121894836,
-0.4639939069747925,
0.6633431315422058,
-0.9158341288566589,
-0.653798520565033,
0.5428580045700073,
... |
func TimeFromFileName(fname string) (time.Time, error) {
_, t, err := componentsAndTimeFromFileName(fname)
return t, err
} | [
-0.04985205456614494,
-0.699120044708252,
0.552334725856781,
-0.1572810560464859,
-0.5102798342704773,
0.30013757944107056,
0.060503002256155014,
0.07856471836566925,
-0.41963616013526917,
1.0707097053527832,
-0.6036785840988159,
-1.3055130243301392,
0.008009440265595913,
0.122488193213939... |
func TimeAndIndexFromFileName(fname string) (time.Time, int, error) {
components, t, err := componentsAndTimeFromFileName(fname)
if err != nil {
return timeZero, 0, err
}
str := strings.Replace(components[2], fileSuffix, "", 1)
index, err := strconv.ParseInt(str, 10, 64)
if err != nil {
return timeZero, 0, er... | [
-0.5699145793914795,
-1.3466079235076904,
0.6604771614074707,
-0.49783480167388916,
-0.22977712750434875,
-0.4598216712474823,
0.34405800700187683,
0.7865356206893921,
-0.14522378146648407,
0.9685499668121338,
-0.5049939751625061,
-0.3274133801460266,
0.42605990171432495,
0.674793481826782... |
func ReadInfoFiles(
filePathPrefix string,
namespace ident.ID,
shard uint32,
readerBufferSize int,
decodingOpts msgpack.DecodingOptions,
) []schema.IndexInfo {
var indexEntries []schema.IndexInfo
decoder := msgpack.NewDecoder(decodingOpts)
forEachInfoFile(filePathPrefix, namespace, shard, readerBufferSize, func... | [
-0.15097737312316895,
-0.11318414658308029,
0.4633031487464905,
-0.06121628358960152,
0.17154446244239807,
-0.14705994725227356,
-0.07028200477361679,
-0.13644178211688995,
-0.13766604661941528,
0.25507766008377075,
-0.29043489694595337,
0.2197953462600708,
-0.9417388439178467,
-0.20880638... |
func FilesetBefore(filePathPrefix string, namespace ident.ID, shard uint32, t time.Time) ([]string, error) {
matched, err := filesetFiles(filePathPrefix, namespace, shard, filesetFilePattern)
if err != nil {
return nil, err
}
return filesBefore(matched, t)
} | [
0.3504910171031952,
0.03981732577085495,
0.24541912972927094,
-0.2723222076892853,
0.34161025285720825,
-1.1696869134902954,
-0.3567991256713867,
-1.2275855541229248,
-0.1979936808347702,
0.7105082869529724,
0.2617584466934204,
0.03680148720741272,
-0.16185806691646576,
-0.1650572717189788... |
func DeleteInactiveDirectories(parentDirectoryPath string, activeDirectories []string) error {
var toDelete []string
activeDirNames := make(map[string]struct{})
allSubDirs, err := findSubDirectoriesAndPaths(parentDirectoryPath)
if err != nil {
return nil
}
// Create shard set, might also be useful to just send... | [
0.18764358758926392,
-0.9200789928436279,
0.6819392442703247,
-0.10551256686449051,
-0.28334298729896545,
0.03865024447441101,
0.6456491351127625,
-0.42702561616897583,
0.2610360383987427,
-0.31336265802383423,
0.1779545247554779,
-0.3349204957485199,
-0.9302335381507874,
0.010225929319858... |
func CommitLogFiles(commitLogsDir string) ([]string, error) {
return commitlogFiles(commitLogsDir, commitLogFilePattern)
} | [
-1.2202292680740356,
-0.35711631178855896,
0.4263592064380646,
0.4317777156829834,
-0.19886146485805511,
0.7942684888839722,
0.5502302646636963,
0.44773173332214355,
0.18104839324951172,
1.3507808446884155,
-0.34753620624542236,
0.5492713451385498,
-1.0822986364364624,
-0.08258480578660965... |
func CommitLogFilesForTime(commitLogsDir string, t time.Time) ([]string, error) {
commitLogFileForTimePattern := fmt.Sprintf(commitLogFileForTimeTemplate, t.UnixNano())
return commitlogFiles(commitLogsDir, commitLogFileForTimePattern)
} | [
-0.7475913763046265,
-0.8602476716041565,
0.5909712314605713,
-0.053478844463825226,
0.31398648023605347,
0.4076952338218689,
-0.3059106469154358,
0.19436553120613098,
-0.44735002517700195,
1.0716357231140137,
0.04427085816860199,
0.1599324345588684,
-0.28058239817619324,
0.706726789474487... |
func CommitLogFilesBefore(commitLogsDir string, t time.Time) ([]string, error) {
commitLogs, err := CommitLogFiles(commitLogsDir)
if err != nil {
return nil, err
}
return filesBefore(commitLogs, t)
} | [
-0.20649632811546326,
-0.4046589732170105,
0.6609842777252197,
0.4053678512573242,
0.06665653735399246,
-0.03348350152373314,
0.0262724868953228,
-0.3724023103713989,
0.03279496729373932,
1.4348300695419312,
0.13186971843242645,
0.21921321749687195,
-0.7617649435997009,
0.02767003513872623... |
func DataDirPath(prefix string) string {
return path.Join(prefix, dataDirName)
} | [
0.35896632075309753,
-0.2218320369720459,
0.2320576012134552,
-1.3549840450286865,
-1.0530716180801392,
0.7149502635002136,
-1.238528847694397,
0.4575231969356537,
0.4118328094482422,
0.4256223142147064,
-0.07807420939207077,
0.593028724193573,
0.2100185751914978,
0.2202165573835373,
-0.... |
func NamespaceDirPath(prefix string, namespace ident.ID) string {
return path.Join(prefix, dataDirName, namespace.String())
} | [
0.4678939878940582,
-0.600190281867981,
0.272112101316452,
-0.5116250514984131,
-1.2187166213989258,
0.6932423710823059,
-1.6622720956802368,
-0.6583319902420044,
0.7900887131690979,
0.5225638747215271,
0.5528494119644165,
0.41094303131103516,
0.2588266432285309,
0.4702558219432831,
0.15... |
func ShardDirPath(prefix string, namespace ident.ID, shard uint32) string {
namespacePath := NamespaceDirPath(prefix, namespace)
return path.Join(namespacePath, strconv.Itoa(int(shard)))
} | [
0.6052623987197876,
-0.027161188423633575,
0.6685258746147156,
-0.49805590510368347,
-0.26187846064567566,
0.25901731848716736,
-0.7743964195251465,
-0.6446163058280945,
1.0642083883285522,
0.30162906646728516,
0.5792701840400696,
0.40390652418136597,
-0.02384044975042343,
0.00113128544762... |
func CommitLogsDirPath(prefix string) string {
return path.Join(prefix, commitLogsDirName)
} | [
-0.33380386233329773,
-0.7922062277793884,
0.6450865268707275,
-0.8774595260620117,
-0.3718027174472809,
1.147657871246338,
0.44350454211235046,
-0.14902076125144958,
0.5969406366348267,
1.064355492591858,
0.5710233449935913,
0.5586483478546143,
-0.392164945602417,
0.1730668991804123,
-0... |
func FilesetExistsAt(prefix string, namespace ident.ID, shard uint32, blockStart time.Time) bool {
shardDir := ShardDirPath(prefix, namespace, shard)
checkpointFile := filesetPathFromTime(shardDir, blockStart, checkpointFileSuffix)
return FileExists(checkpointFile)
} | [
0.13302649557590485,
-0.8193303346633911,
0.485183984041214,
-0.6890484690666199,
1.2791060209274292,
-0.33804234862327576,
-0.8095594644546509,
-0.7786563634872437,
-0.591934323310852,
0.2399958372116089,
0.5579593777656555,
0.16953396797180176,
0.5332648754119873,
0.04771982133388519,
... |
func NextCommitLogsFile(prefix string, start time.Time) (string, int) {
for i := 0; ; i++ {
entry := fmt.Sprintf("%d%s%d", start.UnixNano(), separator, i)
fileName := fmt.Sprintf("%s%s%s%s", commitLogFilePrefix, separator, entry, fileSuffix)
filePath := path.Join(CommitLogsDirPath(prefix), fileName)
if !FileEx... | [
-0.48858505487442017,
-0.5250710248947144,
0.5227605104446411,
-1.0151127576828003,
-0.7729259133338928,
-0.01143584493547678,
0.5544708967208862,
0.22712257504463196,
-1.2604103088378906,
0.23410354554653168,
0.2553170919418335,
0.11839539557695389,
-0.4601612091064453,
0.2138596475124359... |
func FileExists(filePath string) bool {
_, err := os.Stat(filePath)
return err == nil
} | [
-0.33894863724708557,
-0.221656933426857,
0.3869461715221405,
-0.3544679582118988,
1.7979087829589844,
0.8887893557548523,
-0.5166910886764526,
0.16564162075519562,
-0.2992246448993683,
-0.2994985580444336,
0.04428518936038017,
-0.8987081050872803,
0.8377407789230347,
0.253547728061676,
... |
func OpenWritable(filePath string, perm os.FileMode) (*os.File, error) {
return os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
} | [
-0.23667553067207336,
-0.4433746337890625,
0.6033461689949036,
-0.17634573578834534,
-0.8265716433525085,
0.7223003506660461,
0.8733397126197815,
0.5031418204307556,
-0.8050035834312439,
0.6511964797973633,
0.5555299520492554,
0.5592054724693298,
-0.4187506437301636,
-0.5720579028129578,
... |
func SynthesizeToBase(img image.Image) (image.Image, error) {
baseImg, err := getBaseImg()
if err != nil {
return nil, err
}
startPointLogo := image.Point{20, 24}
userRectangle := image.Rectangle{startPointLogo, startPointLogo.Add(img.Bounds().Size())}
originRectangle := image.Rectangle{image.Point{0, 0}, base... | [
-0.017496511340141296,
-0.6827062964439392,
0.6708181500434875,
-0.6067351698875427,
0.09599301218986511,
-0.604587972164154,
0.8096049427986145,
-0.6701822876930237,
0.046881139278411865,
0.051123686134815216,
-0.06370226293802261,
0.4814653694629669,
0.7143548727035522,
0.396403193473815... |
func (s *MeService) GetLibraryPlaylist(ctx context.Context, id string, opt *Options) (*LibraryPlaylists, *Response, error) {
u := fmt.Sprintf("v1/me/library/playlists/%s", id)
return s.getLibraryPlaylists(ctx, u, opt)
} | [
-0.11897794902324677,
-0.207825168967247,
0.3914335370063782,
0.0036327021662145853,
0.21039412915706635,
-0.04588310047984123,
0.2650998830795288,
-1.05576753616333,
0.7474161386489868,
0.1816830337047577,
-0.3494836390018463,
0.09270718693733215,
-1.1534969806671143,
-0.5187795162200928,... |
func (s *MeService) GetLibraryPlaylistsByIds(ctx context.Context, opt *LibraryPlaylistsByIdsOptions) (*LibraryPlaylists, *Response, error) {
u := "v1/me/library/playlists"
return s.getLibraryPlaylists(ctx, u, opt)
} | [
-0.38466814160346985,
-0.5183213949203491,
0.10161733627319336,
-0.04880865290760994,
0.09500983357429504,
0.08708915114402771,
0.3872446119785309,
-1.564121961593628,
0.6513070464134216,
0.0921059250831604,
-0.45069923996925354,
0.07092757523059845,
-1.8270832300186157,
-0.388237148523330... |
func (s *MeService) GetAllLibraryPlaylists(ctx context.Context, opt *PageOptions) (*LibraryPlaylists, *Response, error) {
u := "v1/me/library/playlists"
return s.getLibraryPlaylists(ctx, u, opt)
} | [
-0.10145905613899231,
-0.43316230177879333,
0.3449036478996277,
1.1949563026428223,
-0.06782743334770203,
0.3514677584171295,
0.047652728855609894,
-1.104613184928894,
1.0460846424102783,
-0.28923705220222473,
-0.06733281165361404,
-0.038316674530506134,
-1.6149749755859375,
0.531826257705... |
func (s *MeService) GetLibraryPlaylistTracks(ctx context.Context, id string, opt *Options) ([]Song, error) {
u := fmt.Sprintf("v1/me/library/playlists/%s/tracks", id)
var tracks []Song
for len(u) > 0 {
lpt, _, err := s.getLibraryPlaylistsTracks(ctx, u, opt)
if err != nil {
return tracks, err
}
tracks = ... | [
-0.17417550086975098,
0.3757915794849396,
0.48000794649124146,
0.14383140206336975,
0.45011812448501587,
0.4247353672981262,
-0.553582489490509,
-0.4870624840259552,
0.011604735627770424,
-0.09700987488031387,
-0.33002641797065735,
0.20975138247013092,
-1.9606177806854248,
0.56343263387680... |
func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, getRSList RsListFunc) ([]*appsv1.ReplicaSet, error) {
// TODO: Right now we list replica sets by their labels. We should list them by selector, i.e. the replica set's selector
// should be a superset of the deployment's selector, see https://github... | [
0.1383449137210846,
-0.29288434982299805,
0.2144423872232437,
-0.04470161348581314,
0.1394042670726776,
-0.5153753757476807,
0.35164210200309753,
-0.026790158823132515,
1.2002168893814087,
0.12199781835079193,
0.22155793011188507,
0.8966150879859924,
-0.39744052290916443,
-0.09050319343805... |
func ListPodsByRS(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, f PodListFunc) ([]*corev1.Pod, error) {
namespace := deployment.Namespace
selector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector)
if err != nil {
return nil, err
}
all, err := f(namespace, selector)
if err != nil {
... | [
-0.2623126804828644,
-0.9990512132644653,
0.46505308151245117,
-0.19770970940589905,
-0.19273145496845245,
-0.8375605344772339,
0.33753395080566406,
-0.20338065922260284,
0.5117467045783997,
0.36549973487854004,
0.19366103410720825,
0.6916062235832214,
-0.23403069376945496,
-0.142459094524... |
func EqualIgnoreHash(template1, template2 *corev1.PodTemplateSpec) bool {
t1Copy := template1.DeepCopy()
t2Copy := template2.DeepCopy()
// Remove hash labels from template.Labels before comparing
delete(t1Copy.Labels, appsv1.DefaultDeploymentUniqueLabelKey)
delete(t2Copy.Labels, appsv1.DefaultDeploymentUniqueLabel... | [
0.2817775309085846,
-0.335670530796051,
0.6861251592636108,
-0.20916935801506042,
-0.11034633964300156,
0.9053462147712708,
-0.516305148601532,
-0.07261350750923157,
-0.7432948350906372,
0.6252696514129639,
-0.9425873160362244,
0.09361959248781204,
-0.6685470342636108,
-0.30015191435813904... |
func GetNewReplicaSet(deployment *appsv1.Deployment, f RsListFunc) (*appsv1.ReplicaSet, error) {
rsList, err := ListReplicaSetsByDeployment(deployment, f)
if err != nil {
return nil, err
}
return FindNewReplicaSet(deployment, rsList), nil
} | [
-0.2277342826128006,
0.42887160181999207,
0.4120524525642395,
0.07346919178962708,
-0.8911959528923035,
-0.9853071570396423,
-0.24760980904102325,
0.043105434626340866,
-0.308774471282959,
0.05965259298682213,
0.31292814016342163,
1.1270341873168945,
-0.358527809381485,
-0.1625810861587524... |
func FindNewReplicaSet(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) *appsv1.ReplicaSet {
sort.Sort(ReplicaSetsByCreationTimestamp(rsList))
for i := range rsList {
if EqualIgnoreHash(&rsList[i].Spec.Template, &deployment.Spec.Template) {
// In rare cases, such as after cluster upgrades, Deployment ... | [
0.30798739194869995,
-0.3157558739185333,
0.5640021562576294,
-0.2992876172065735,
-0.9865095615386963,
-0.24044393002986908,
-0.45322322845458984,
-0.8486772775650024,
0.0932503342628479,
0.13914640247821808,
0.5051382184028625,
0.17099936306476593,
-0.993571937084198,
0.5043210387229919,... |
func (api *API) HostsInterfacesGetByIds(ids []string) (res HostInterfaces, err error) {
return api.HostsInterfaceGet(Params{"hostids": ids})
} | [
-1.1796505451202393,
0.49666690826416016,
0.2343354970216751,
0.10076480358839035,
0.08472305536270142,
-0.3058111071586609,
0.22373773157596588,
-0.6788395047187805,
-0.9646739959716797,
0.38447439670562744,
-0.4250237047672272,
-0.17279422283172607,
-0.7772213220596313,
0.557075858116149... |
func (g *Game) Event(b *chat.Bot, m *chat.Message) {
log.Println("event?")
if !directed(m) {
log.Println("not directed")
return
}
g.mu.Lock()
defer g.mu.Unlock()
if g.room == "" || m.Room == g.room {
text := strings.TrimPrefix(m.Text, "magicalbot: ")
if text == "start" {
log.Println("start")
g.start... | [
0.08845897018909454,
-0.33834341168403625,
0.932727575302124,
0.5049351453781128,
0.03078976459801197,
0.33786845207214355,
0.9346766471862793,
-0.07095129042863846,
0.27613094449043274,
0.08131543546915054,
0.0840107873082161,
0.36015355587005615,
-0.431736022233963,
0.6810066103935242,
... |
func directed(m *chat.Message) bool {
return m.Room == "" || strings.HasPrefix(m.Text, "magicalbot:") // lol
} | [
-0.05878230929374695,
-0.8531535267829895,
0.4147370755672455,
0.2671501636505127,
-0.28639844059944153,
1.5256896018981934,
-0.49300089478492737,
-0.1339500993490219,
-0.5636958479881287,
-0.8300244212150574,
0.4346331059932709,
0.5198914408683777,
-0.28175804018974304,
1.4710910320281982... |
func (g *Game) playing(p chat.Person) bool {
for _, q := range g.players {
if p == q {
return true
}
}
return false
} | [
-0.8845471143722534,
-0.6802481412887573,
0.4764796793460846,
0.18957467377185822,
0.05080939456820488,
0.6966801881790161,
-1.3465116024017334,
0.22719471156597137,
-0.808533787727356,
0.6514450311660767,
0.09865609556436539,
-0.3296469449996948,
-0.8787114024162292,
-0.4514033794403076,
... |
func New(pc chan []string) *Drawer {
d := Drawer{nil, nil, nil, nil}
d.list = ld.New(pc)
d.sparkline = sd.New(pc)
d.table = td.New(pc)
d.packetChannel = pc
return &d
} | [
-0.5835466384887695,
-0.318505197763443,
0.25252920389175415,
-0.8602678179740906,
-0.5926180481910706,
0.21281497180461884,
-0.4871481657028198,
0.1390848308801651,
-0.010838962160050869,
-0.8934831023216248,
-0.547235906124115,
0.012983136810362339,
-0.03199782595038414,
0.68731915950775... |
func (d Drawer) Initialize() []ui.Drawable {
slg := d.sparkline.Initialize()
l := d.list.Initialize()
table := d.table.Initialize()
arrange(l, table, slg)
return []ui.Drawable{
slg,
l,
table,
}
} | [
-1.2487016916275024,
1.0546692609786987,
0.6061317324638367,
0.21107901632785797,
0.3771972954273224,
-0.36987927556037903,
-0.1475479006767273,
0.2143905609846115,
0.16757915914058685,
-0.6083442568778992,
-0.7661538124084473,
-0.6307680010795593,
0.5928937792778015,
0.9213442802429199,
... |
func arrange(l *widgets.List, table *widgets.Table, slg *widgets.SparklineGroup) {
l.SetRect(0, 0, 50, 5)
slg.SetRect(50, 0, 100, 5)
table.SetRect(0, 5, 100, 20)
} | [
-0.336330771446228,
0.35414832830429077,
0.14890287816524506,
-0.6502043008804321,
0.2969704568386078,
-0.24542884528636932,
-0.036558836698532104,
0.9570901989936829,
-0.36431828141212463,
-0.5520822405815125,
-0.09114090353250504,
-0.004539403133094311,
0.3010362386703491,
1.660976052284... |
func Parse(opt string) (string, bool, error) {
return option.ParseOption(opt, &Library)
} | [
-0.24622496962547302,
0.0871010273694992,
0.27312171459198,
0.2670932710170746,
-0.21745508909225464,
-0.26241829991340637,
-0.21273773908615112,
-0.09578452259302139,
0.07459159940481186,
0.38270264863967896,
-0.541098415851593,
-1.0430793762207031,
-1.1089154481887817,
-0.499373048543930... |
func PossibleApplicationStateValues() []ApplicationState {
return []ApplicationState{ACCEPTED, FAILED, FINISHED, FINISHING, KILLED, NEW, NEWSAVING, RUNNING, SUBMITTED}
} | [
-0.5637226700782776,
-0.8083995580673218,
0.1320069283246994,
0.7899651527404785,
-1.0090950727462769,
0.7917852997779846,
-0.7673513889312744,
0.3265455365180969,
-0.13001614809036255,
0.08565352857112885,
0.23667575418949127,
0.07251237332820892,
0.3776512145996094,
1.272316813468933,
... |
func Init(c *conf.Config) {
initService(c)
// init inner router
engine := bm.DefaultServer(c.HTTPServer)
innerRouter(engine)
// init inner server
if err := engine.Start(); err != nil {
log.Error("engine.Start error(%v)", err)
panic(err)
}
} | [
-0.4645550847053528,
-0.35811758041381836,
0.5728846788406372,
0.3312664031982422,
0.7523701786994934,
0.6543127298355103,
0.12977227568626404,
0.8749474883079529,
-1.1459696292877197,
-0.19471120834350586,
-0.5827401876449585,
1.2046784162521362,
-0.9898513555526733,
0.6099026799201965,
... |
func innerRouter(e *bm.Engine) {
// health check
e.Ping(ping)
spy := e.Group("/x/admin/spy", vfySvc.Verify)
score := spy.Group("/score")
score.GET("/query", userInfo)
score.GET("/record", historyPage)
score.POST("/base/reset", resetBase)
score.POST("/base/refresh", refreshBase)
score.POST("/event/reset", rese... | [
-0.7390239238739014,
-0.20468714833259583,
1.0505321025848389,
0.26007261872291565,
0.10256797075271606,
0.007941488176584244,
0.28921443223953247,
-0.11550208181142807,
0.12978102266788483,
0.2631109952926636,
0.0010781791061162949,
0.37784066796302795,
-0.5008487105369568,
0.974348247051... |
func ping(c *bm.Context) {
if err := spySrv.Ping(c); err != nil {
log.Error("spy admin ping error(%v)", err)
c.JSON(nil, err)
c.AbortWithStatus(http.StatusServiceUnavailable)
}
} | [
-0.23131398856639862,
0.1615542471408844,
0.3915919363498688,
0.3371657729148865,
0.6288739442825317,
-0.005433839280158281,
-0.19574978947639465,
-0.14718963205814362,
0.8191711902618408,
1.3767755031585693,
0.4328864812850952,
0.7405185699462891,
-0.4840351343154907,
0.7572945952415466,
... |
func (Symptom) Fields() []ent.Field {
return []ent.Field{
field.String("Syname").Unique(),
}
} | [
-0.14433613419532776,
-0.01585322804749012,
0.027774466201663017,
-1.226815938949585,
0.9808738231658936,
0.137612983584404,
-0.7794663906097412,
0.9935153722763062,
1.2205853462219238,
-0.3158841133117676,
-1.262536644935608,
0.024508995935320854,
-0.14215420186519623,
-0.9342741370201111... |
func (Symptom) Edges() []ent.Edge {
return []ent.Edge{
edge.To("repair_information", RepairInvoice.Type).StorageKey(edge.Column("symptom_id")),
}
} | [
-0.2308529019355774,
-0.18303684890270233,
0.2575327455997467,
-0.594113826751709,
1.1542271375656128,
-0.7693129777908325,
-1.40626060962677,
0.9094026684761047,
0.9658323526382446,
0.3028895854949951,
-0.2353447526693344,
0.44041571021080017,
0.053102120757102966,
-1.1468394994735718,
... |
func QuickSort(arr []int64, start int, end int) {
quickSort(arr, start, end)
} | [
0.3764180839061737,
-0.22591575980186462,
0.41060870885849,
0.5665712356567383,
-0.6407256126403809,
-0.1051030308008194,
-0.3176147937774658,
-0.122635617852211,
0.15920957922935486,
-0.7943824529647827,
-0.3431723415851593,
0.6121069192886353,
0.019505754113197327,
-0.12151231616735458,
... |
func NewGroupsProvider(config *Config) (*GroupsProvider, error) {
return &GroupsProvider{
Config: config,
}, nil
} | [
-0.6523881554603577,
0.15121595561504364,
-0.46074703335762024,
0.04582691192626953,
-1.1618456840515137,
-0.18487970530986786,
-0.5143928527832031,
-0.8755707144737244,
0.21423502266407013,
0.826050877571106,
-0.328063428401947,
-0.915364682674408,
-0.8852049708366394,
0.47196489572525024... |
func (p *GroupsProvider) RetrieveGroups() ([]string, error) {
authAuthenticatorURL := p.Config.OIDC.TokenSVC.String()
client := &http.Client{}
req, err := http.NewRequest("POST", authAuthenticatorURL, nil)
req.Header.Add("Authorization", p.Config.OIDC.Token)
req.Header.Add("Stage", p.Config.Stage)
req.Header.A... | [
-0.8325197100639343,
0.3642282485961914,
0.47976088523864746,
-0.7290109992027283,
0.17137625813484192,
-0.9970742464065552,
-0.21909259259700775,
-0.7041115164756775,
0.3940136730670929,
0.0549703948199749,
0.02028520777821541,
1.0364725589752197,
-1.23502516746521,
0.10679654031991959,
... |
func ConstructRoleArns(groups []string) []string {
var roleGroups []string
for _, group := range groups {
s := strings.Split(group, "#")
_, roleName, accountNumber := s[0], s[1], s[2]
roleGroups = append(roleGroups, fmt.Sprintf("arn:aws:iam::%s:role/%s", accountNumber, roleName))
}
return roleGroups
} | [
-0.959942102432251,
-0.47966334223747253,
0.43485936522483826,
-1.1759647130966187,
0.5411860346794128,
-0.5855246782302856,
-0.13458646833896637,
0.28491052985191345,
0.048945266753435135,
0.21461060643196106,
0.3798621892929077,
0.44883254170417786,
0.5184356570243835,
-0.316963523626327... |
func NewPid(pid int) (Capabilities, error) {
return newPid(pid)
} | [
-0.0045399717055261135,
-0.9979239702224731,
0.3310773968696594,
1.2989052534103394,
-0.6408641934394836,
-0.43656042218208313,
-0.5146943926811218,
-0.2741363048553467,
0.9512875080108643,
-0.257754385471344,
0.13537608087062836,
-0.47397905588150024,
-0.04513082280755043,
0.1472792029380... |
func NewFile(name string) (Capabilities, error) {
return newFile(name)
} | [
0.6448192596435547,
-0.3392718434333801,
0.42296621203422546,
1.1925182342529297,
-0.9985590577125549,
-0.5894099473953247,
-0.029551703482866287,
-0.13626526296138763,
-0.4190928637981415,
-0.21062277257442474,
-0.10917327553033829,
-0.4726175367832184,
0.2644617259502411,
0.3307020068168... |
func (a InstanceMetadataTemplateAction) Event(inst instance, requestor *api.EventLifecycleRequestor, ctx map[string]any) api.EventLifecycle {
u := api.NewURL().Path(version.APIVersion, "instances", inst.Name(), "metadata", "templates").Project(inst.Project().Name)
return api.EventLifecycle{
Action: string(a),
... | [
0.05049993097782135,
0.00020242470782250166,
0.3776564300060272,
-0.9281315803527832,
0.03172127902507782,
0.9138838052749634,
0.27917951345443726,
0.5498272180557251,
0.5157911777496338,
0.6697593927383423,
-0.5824630856513977,
1.3087049722671509,
0.39639899134635925,
0.2949349582195282,
... |
func (m *IncomingMessage) UnmarshalJSON(data []byte) error {
incomingMessageTypeOnly := struct {
Type string `json:"type"`
}{}
if err := json.Unmarshal(data, &incomingMessageTypeOnly); err != nil {
return err
}
switch incomingMessageTypeOnly.Type {
case "webhook_event":
var evt WebhookEvent
if err := jso... | [
-0.543002724647522,
0.5273124575614929,
0.9675708413124084,
-1.1116725206375122,
-0.3988201916217804,
0.020392252132296562,
0.2703026831150055,
-0.13842056691646576,
-0.4145030379295349,
0.47419580817222595,
-0.2047915756702423,
0.8448534607887268,
-0.9102464914321899,
0.8946222066879272,
... |
func (m OutgoingMessage) MarshalJSON() ([]byte, error) {
if m.WebhookResponse != nil {
return json.Marshal(m.WebhookResponse)
} else if m.EventAck != nil {
return json.Marshal(m.EventAck)
}
return json.Marshal(nil)
} | [
0.14152702689170837,
0.04781093820929527,
0.5592471957206726,
-0.2786828875541687,
0.17132967710494995,
-0.36509376764297485,
0.29576992988586426,
0.3950558006763458,
0.5174736380577087,
0.3945668935775757,
0.25457459688186646,
0.9571880102157593,
-0.9054305553436279,
1.5543726682662964,
... |
func NewEventAck(eventID, webhookConversationID string) *OutgoingMessage {
return &OutgoingMessage{
EventAck: &EventAck{
EventID: eventID,
WebhookConversationID: webhookConversationID,
Type: "event_ack",
},
}
} | [
0.9247283935546875,
-0.2829141318798065,
0.4219452440738678,
-0.08987592905759811,
-0.29111042618751526,
-0.5190911293029785,
0.43220779299736023,
-0.15664279460906982,
0.10772144794464111,
0.6219428777694702,
0.476231187582016,
0.7114390730857849,
-0.5006384253501892,
1.1450499296188354,
... |
func MountController(service *goa.Service) {
service.ServeFiles("/schema.json", "schema/schema.json")
} | [
0.8040611147880554,
-0.1741231232881546,
0.37784093618392944,
0.03233743831515312,
-0.20094040036201477,
-0.3570762574672699,
0.12283869087696075,
-0.23165613412857056,
-0.6707606911659241,
0.01620408520102501,
-0.0218349639326334,
0.7423157095909119,
0.6004236340522766,
1.0841960906982422... |
func WithActivation(activateAfter *time.Time) SecretOption {
return func(op *Options) {
op.Activates = activateAfter
}
} | [
-0.032592207193374634,
-0.45763203501701355,
0.42139580845832825,
0.8243081569671631,
-0.48530611395835876,
-0.5309796333312988,
0.48559829592704773,
0.04633806273341179,
0.35999196767807007,
0.4301345944404602,
-1.0703486204147339,
-0.11355464905500412,
0.6944767832756042,
-1.007669210433... |
func WithExpiration(expireAfter *time.Time) SecretOption {
return func(op *Options) {
op.Expires = expireAfter
}
} | [
0.14608418941497803,
-0.02972814254462719,
0.281806081533432,
0.6697099208831787,
-0.15143798291683197,
-0.2632468640804291,
-0.5599059462547302,
0.03866403177380562,
0.8760148286819458,
0.959948718547821,
-0.873429000377655,
-0.08135033398866653,
0.7274560332298279,
-0.4619219899177551,
... |
func WithOwner(owner SecretOwner) SecretOption {
return func(op *Options) {
op.Owner = owner
}
} | [
0.5255014896392822,
-0.015736572444438934,
0.3975960910320282,
1.5028156042099,
-0.31146305799484253,
0.17550550401210785,
0.9939152598381042,
-0.26012924313545227,
0.8526297211647034,
-0.7553430199623108,
-0.7982496619224548,
0.1932404339313507,
0.7423443794250488,
-0.24341662228107452,
... |
func WithScheme(scheme *runtime.Scheme) SecretOption {
return func(op *Options) {
op.Scheme = scheme
}
} | [
0.11741625517606735,
0.6685994863510132,
0.5282220840454102,
0.42273610830307007,
0.20167545974254608,
-0.4069638252258301,
0.07784000784158707,
-0.0865030437707901,
0.7062011361122131,
0.20321640372276306,
-0.4770870804786682,
-0.22445830702781677,
0.5191929340362549,
0.1108081266283989,
... |
func Flatten(flatten bool) SecretOption {
return func(op *Options) {
op.Flatten = flatten
}
} | [
-0.47585538029670715,
0.6955090761184692,
0.21503053605556488,
0.8524803519248962,
0.20659136772155762,
0.09888893365859985,
0.7558950185775757,
0.49178290367126465,
0.6122162938117981,
-0.5582127571105957,
-1.5235741138458252,
0.5229948163032532,
-0.9415380954742432,
-0.7223488092422485,
... |
func NewTemplatePackage(entities []model.Entity, options Options) TemplatePackage {
imports := util.NewSet()
var models []TemplateEntity
for _, entity := range entities {
mdl := NewTemplateEntity(entity, options)
if len(mdl.Columns) == 0 {
continue
}
for _, imp := range mdl.Imports {
imports.Add(imp)... | [
-0.8815016150474548,
0.13731801509857178,
0.41411396861076355,
-0.17365103960037231,
-0.1614750325679779,
-0.20427703857421875,
-0.09217023104429245,
-0.44882795214653015,
0.4757228195667267,
0.5488238334655762,
-0.1360890120267868,
-0.688666045665741,
0.254654198884964,
1.077755093574524,... |
func NewTemplateEntity(entity model.Entity, options Options) TemplateEntity {
if entity.HasMultiplePKs() {
options.KeepPK = true
}
imports := util.NewSet()
var columns []TemplateColumn
for _, column := range entity.Columns {
if !isValidatable(column) {
continue
}
tmpl := NewTemplateColumn(column, opt... | [
-0.12054868042469025,
-0.23606692254543304,
0.5766800045967102,
0.11203259974718094,
-0.2738441228866577,
0.13553465902805328,
-0.5241588354110718,
-0.2879334092140198,
0.5465128421783447,
0.3607485890388489,
-0.9763559699058533,
-0.8561848402023315,
0.25460973381996155,
1.032550573348999,... |
func NewTemplateColumn(column model.Column, options Options) TemplateColumn {
if !options.KeepPK && column.IsPK {
column.GoName = util.ID
}
tmpl := TemplateColumn{
Column: column,
Check: check(column),
}
if len(column.Values) > 0 {
tmpl.Enum = template.HTML(fmt.Sprintf(`"%s"`, strings.Join(column.Values... | [
-0.6881099939346313,
-0.4541032910346985,
0.3718984127044678,
-0.36364805698394775,
-0.2494690865278244,
-0.22982577979564667,
-0.3429422080516815,
-0.060290999710559845,
0.030953723937273026,
0.4404292106628418,
-1.3133060932159424,
0.4212665259838104,
0.3614013195037842,
0.52695465087890... |
func isValidatable(c model.Column) bool {
// validate FK
if c.IsFK {
return true
}
// validate complex types
if !c.Nullable && (c.IsArray || c.GoType == model.TypeMapInterface || c.GoType == model.TypeMapString) {
return true
}
// validate strings len
if c.GoType == model.TypeString && c.MaxLen > 0 {
re... | [
-0.34125831723213196,
-0.2714743912220001,
0.7426192164421082,
0.49414411187171936,
-0.364234983921051,
0.36866670846939087,
0.3673405349254608,
-0.6493974328041077,
-0.3367058336734772,
0.2395445853471756,
-0.35729244351387024,
0.04897934943437576,
-0.7344179749488831,
0.20352156460285187... |
func check(c model.Column) string {
if !isValidatable(c) {
return ""
}
if c.IsArray || c.GoType == model.TypeMapInterface || c.GoType == model.TypeMapString {
return Nil
}
if c.IsFK {
if c.Nullable {
return PZero
}
return Zero
}
if c.GoType == model.TypeString && c.MaxLen > 0 {
if c.Nullable {
... | [
-0.19114063680171967,
-0.0008430086309090257,
0.6369117498397827,
0.40424367785453796,
-0.03725298494100571,
0.3191108703613281,
0.10232972353696823,
-0.7024807333946228,
-0.0165789183229208,
0.5144729614257812,
0.4538753628730774,
0.09841017425060272,
-0.39495763182640076,
0.6879910230636... |
func SetVar(field interface{}, varName string, defaultValue interface{}) {
switch v := field.(type) {
case *string:
*field.(*string) = setStringVar(*field.(*string), varName, defaultValue.(string))
case *[]string:
*field.(*[]string) = setStringSliceVar(*field.(*[]string), varName, defaultValue.([]string))
defau... | [
-0.07060311734676361,
0.25949761271476746,
0.2432386577129364,
0.14794498682022095,
0.38061457872390747,
-0.189479261636734,
0.0718524158000946,
0.2198767066001892,
-1.0285656452178955,
-0.2067841738462448,
-0.1537177413702011,
0.8043469190597534,
0.22025632858276367,
0.6190687417984009,
... |
func Compile(statements []string, filters map[string]Filter, fieldsFn FieldsFunc) (Matcher, error) {
matchers := []Matcher{}
for _, s := range statements {
ss := strings.SplitN(s, statementSeparator, 2)
if len(ss) != 2 {
return nil, ErrKeylessStatement
}
k, v := ss[0], ss[1]
f, ok := filters[k]
if !ok ... | [
-0.1457785964012146,
-0.8353424668312073,
0.6651462316513062,
0.26481032371520996,
-0.34437859058380127,
-0.9539044499397278,
-0.26296722888946533,
0.2167155146598816,
-0.6128800511360168,
-0.0027769720181822777,
0.22252961993217468,
-0.7672492861747742,
-0.4460776746273041,
0.035718109458... |
func setField(obj interface{}, name string, value interface{}) error {
structValue := reflect.ValueOf(obj).Elem()
structFieldValue := structValue.FieldByName(name)
if !structFieldValue.IsValid() {
return fmt.Errorf("No such field: %s in obj", name)
}
if !structFieldValue.CanSet() {
return fmt.Errorf("Cannot ... | [
-0.40081772208213806,
-0.057377561926841736,
0.7164962887763977,
-0.69061279296875,
-0.7425847053527832,
0.5549615621566772,
0.2375139445066452,
-0.6298345923423767,
-0.3785784840583801,
0.18481327593326569,
-1.1681262254714966,
0.17037518322467804,
0.05251176282763481,
0.32548752427101135... |
func MarkInactiveStaticHosts(activeStaticHosts []string, distroID string) error {
query := bson.M{
IdKey: bson.M{"$nin": activeStaticHosts},
ProviderKey: evergreen.HostTypeStatic,
}
if distroID != "" {
query[bsonutil.GetDottedKeyName(DistroKey, distro.IdKey)] = distroID
}
toTerminate, err := Find(db.... | [
-0.8029388189315796,
-0.18514519929885864,
0.3512450158596039,
0.9547205567359924,
0.0692867785692215,
0.27711889147758484,
0.03519277647137642,
0.14222224056720734,
-0.7295342683792114,
0.2612612843513489,
-0.06008416414260864,
0.34541741013526917,
-0.02369692362844944,
0.1676363050937652... |
func (s *TestService) InsertTests(tests []string) error {
var data []interface{}
session := s.DBSession.Copy()
defer session.Close()
c := session.DB(conf.DBName).C("test")
for _, val := range tests {
data = append(data, &models.Test{Foo: val})
}
return c.Insert(data...)
} | [
-0.9393447041511536,
0.9011942744255066,
0.12482544034719467,
-0.2360820472240448,
0.7760175466537476,
0.5908052921295166,
-0.02206902951002121,
-0.41006383299827576,
-0.2714759111404419,
0.20701643824577332,
-0.3168576955795288,
-0.9821028709411621,
-1.9396198987960815,
0.3304271996021271... |
func (s *TestService) FindTests() ([]models.Test, error) {
var tests = []models.Test{}
session := s.DBSession.Copy()
defer session.Close()
c := session.DB(conf.DBName).C("test")
err := c.Find(nil).All(&tests)
return tests, err
} | [
-0.22555316984653473,
0.2049814760684967,
0.047171011567115784,
0.6220824718475342,
1.0491658449172974,
0.1312228888273239,
0.39246639609336853,
-0.9476335644721985,
0.17536866664886475,
-0.04033796116709709,
0.13366298377513885,
-0.055481091141700745,
-1.5250020027160645,
1.04650306701660... |
func newConsumerGroupCache(destPath string, cgDesc shared.ConsumerGroupDescription, cgLogger bark.Logger, h *OutputHost) *consumerGroupCache {
cgCache := &consumerGroupCache{
destPath: destPath,
cachedCGDesc: cgDesc,
cachedTime: common.Now(),
extentCache: ... | [
0.6051633954048157,
-0.10001257061958313,
0.6604061722755432,
-0.01711900904774666,
-0.9801628589630127,
-0.4798612892627716,
0.34942492842674255,
-0.34018802642822266,
-0.7927352786064148,
0.6775341033935547,
0.19351515173912048,
0.5283339023590088,
-0.6439260244369507,
0.9524056315422058... |
func (cgCache *consumerGroupCache) loadExtentCache(ctx thrift.Context, destType shared.DestinationType, cge *shared.ConsumerGroupExtent) {
var committer Committer
extUUID := cge.GetExtentUUID()
if extCache, exists := cgCache.extentCache[extUUID]; !exists {
extCache = &extentCache{
cgUUID: cgCache.... | [
-0.04660268500447273,
0.5421789288520813,
0.851862907409668,
-0.2656558156013489,
-0.7745135426521301,
0.2631989121437073,
0.06367777287960052,
-0.2346886843442917,
-0.05031029134988785,
0.45745986700057983,
-0.10084468126296997,
0.14002488553524017,
-0.7020934224128723,
0.5692000389099121... |
func (cgCache *consumerGroupCache) unloadExtentCache(extUUID string) (ackMgrUnloadID uint32) {
if extCache, ok := cgCache.extentCache[extUUID]; ok {
extCache.logger.Info("removing extent")
ackMgrUnloadID = uint32(extCache.ackMgr.ackMgrID)
cgCache.cgMetrics.Decrement(load.CGMetricNumOpenExtents)
cgCache.hostMet... | [
-0.17612849175930023,
0.3830507695674896,
0.7863627076148987,
-0.6819065809249878,
-1.5264321565628052,
-0.09002387523651123,
0.6939195394515991,
-0.2139028161764145,
0.0025722128339111805,
0.2150537073612213,
0.15179400146007538,
0.18150413036346436,
-0.4974130392074585,
0.324807405471801... |
func (cgCache *consumerGroupCache) manageConsumerGroupCache() {
cgCache.logger.Info(`cgCache initialized`)
defer cgCache.shutdownWG.Done()
quit := false
refreshTicker := time.NewTicker(metaPollTimeout) // start ticker to refresh metadata
defer refreshTicker.Stop()
unloadTicker := time.NewTicker(unloadTickerTi... | [
0.16187134385108948,
-0.4467754662036896,
0.837053656578064,
-0.10384839028120041,
-0.8193181157112122,
-0.3840056359767914,
0.21916823089122772,
-0.5012117624282837,
-0.34411588311195374,
0.8066819906234741,
0.7310336232185364,
0.5491665005683899,
-0.7436138391494751,
1.0619890689849854,
... |
func (cgCache *consumerGroupCache) refreshCgCacheNoLock(ctx thrift.Context) error {
cgCache.extMutex.Lock()
defer cgCache.extMutex.Unlock()
// Make sure we don't race with an unload
if cgCache.isClosed() || cgCache.unloadInProgress {
return ErrCgUnloaded
}
return cgCache.refreshCgCache(ctx)
} | [
0.12684854865074158,
0.2720698118209839,
0.27185600996017456,
0.41787225008010864,
-0.7913199067115784,
-0.38637861609458923,
-0.15764731168746948,
-0.7393468618392944,
-0.5063796043395996,
0.487578421831131,
0.7956040501594543,
0.26261037588119507,
-0.6872748732566833,
1.0954492092132568,... |
func (cgCache *consumerGroupCache) refreshCgCache(ctx thrift.Context) error {
// First check any status changes to the destination or consumer group
// If one of them is being deleted, then just unload all extents and
// move on. If not, check for new extents for this consumer group
dstReq := &shared.ReadDestinat... | [
0.19670701026916504,
-0.21373708546161652,
0.7175897359848022,
0.03258322551846504,
-0.8926878571510315,
-0.38071656227111816,
-0.3578513264656067,
-0.23886726796627045,
-0.3115635812282562,
0.9005082249641418,
1.003096342086792,
0.6238701343536377,
0.29005634784698486,
0.8493019938468933,... |
func (cgCache *consumerGroupCache) checkSingleCGVisible(ctx thrift.Context, cge *shared.ConsumerGroupExtent) (singleCgVisible bool) {
// Note that this same extent can be loaded by either a consumer group of the DLQ destination (i.e. for inspection,
// with consumer group visibility = nil), or as an extent being merg... | [
-0.23857024312019348,
0.7755228877067566,
0.8204988241195679,
-0.5326275825500488,
-1.3237072229385376,
0.3554091453552246,
-0.1279766857624054,
-0.057427942752838135,
0.3696199953556061,
0.9784847497940063,
0.13551492989063263,
0.510239839553833,
-0.16695845127105713,
1.1075785160064697,
... |
func (cgCache *consumerGroupCache) getDynamicCgConfig() (OutputCgConfig, error) {
dCfgIface, err := cgCache.cfgMgr.Get(common.OutputServiceName, `*`, `*`, `*`)
if err != nil {
cgCache.logger.WithFields(bark.Fields{common.TagErr: err}).Error(`Couldn't get the configuration object`)
return OutputCgConfig{}, err
}
... | [
-0.5587850213050842,
0.16841436922550201,
0.6236572265625,
0.5168341994285583,
-0.7422918677330017,
-1.4556766748428345,
0.9320238828659058,
-0.8239647746086121,
-1.0057095289230347,
0.48566964268684387,
0.2896912097930908,
0.7788204550743103,
-0.27542802691459656,
1.155516266822815,
0.5... |
func (cgCache *consumerGroupCache) getMessageCacheSize(cfg OutputCgConfig, oldSize int32) (cacheSize int32) {
logFn := func() bark.Logger {
return cgCache.logger
}
ruleKey := cgCache.destPath + `/` + cgCache.cachedCGDesc.GetConsumerGroupName()
cacheSize = int32(common.OverrideValueByPrefix(logFn, ruleKey, cfg.Mes... | [
0.23203636705875397,
0.5755872130393982,
0.7990880012512207,
0.0017273694975301623,
-0.8543185591697693,
-0.6038649678230286,
0.7274075150489807,
-0.0009438154520466924,
-0.5333309173583984,
0.3566797971725464,
0.5782805681228638,
0.5463539361953735,
-0.41326314210891724,
1.318760514259338... |
func (cgCache *consumerGroupCache) loadConsumerGroupCache(ctx thrift.Context, exists bool) error {
cgCache.extMutex.Lock()
defer cgCache.extMutex.Unlock()
// Make sure we don't race with an unload
if cgCache.isClosed() || cgCache.unloadInProgress {
return ErrCgUnloaded
}
// If we are loading this cache for th... | [
0.09874339401721954,
0.06909418851137161,
0.8250741362571716,
-0.21896407008171082,
-0.852978527545929,
-0.33990877866744995,
-0.38685616850852966,
-0.6109997630119324,
-0.014283198863267899,
0.8889210820198059,
0.4018740653991699,
-0.14144478738307953,
-0.6818264126777649,
0.9788523912429... |
func (cgCache *consumerGroupCache) Report(reporter common.LoadReporter) {
msgsOut := cgCache.cgMetrics.GetAndReset(load.CGMetricMsgsOut)
bytesOut := cgCache.cgMetrics.GetAndReset(load.CGMetricBytesOut)
numConns := cgCache.cgMetrics.Get(load.CGMetricNumOpenConns)
numExtents := cgCache.cgMetrics.Get(load.CGMetricNum... | [
0.17010970413684845,
0.6188693642616272,
0.587600827217102,
-0.3568384349346161,
-0.8563578128814697,
-0.027575990185141563,
0.8386991620063782,
-0.011593909002840519,
-0.9594368934631348,
0.4714222252368927,
0.3325860798358917,
0.02376876026391983,
-0.6683835983276367,
0.8211895823478699,... |
func (cgCache *consumerGroupCache) getNumOpenConns() int32 {
return int32(cgCache.cgMetrics.Get(load.CGMetricNumOpenConns))
} | [
-0.40913423895835876,
0.9926548600196838,
0.4844859540462494,
-0.15629591047763824,
-1.0261609554290771,
-0.38758575916290283,
1.2600467205047607,
-0.36398839950561523,
-0.026956869289278984,
-0.33400002121925354,
-0.5241842865943909,
-0.05995199456810951,
0.12409380078315735,
-0.095135755... |
func (cgCache *consumerGroupCache) incNumOpenConns(delta int32) int32 {
return int32(cgCache.cgMetrics.Add(load.CGMetricNumOpenConns, int64(delta)))
} | [
-0.8955938220024109,
0.8823742270469666,
0.5005991458892822,
-0.567474365234375,
-1.4492276906967163,
0.2633819282054901,
1.477825403213501,
-0.25389334559440613,
0.15235942602157593,
-0.5349042415618896,
-0.3576337397098541,
-0.1776263266801834,
0.15716949105262756,
-0.551738440990448,
... |
func (cgCache *consumerGroupCache) utilSendCreditsToExtent(extUUID string, credits int32) bool {
cgCache.extMutex.RLock()
defer cgCache.extMutex.RUnlock()
ret := false
if extCache, ok := cgCache.extentCache[extUUID]; ok {
ret = extCache.grantCredits(credits)
}
return ret
} | [
-0.40633583068847656,
0.8023556470870972,
0.8728932738304138,
-0.4662802815437317,
-0.8681329488754272,
0.46943092346191406,
-0.5313512682914734,
-0.5894410014152527,
-0.1473897099494934,
0.9523201584815979,
0.17458118498325348,
0.7279247045516968,
-1.2248481512069702,
0.0367288663983345,
... |
func (cgCache *consumerGroupCache) unloadConsumerGroupCache() {
cgCache.extMutex.Lock()
if cgCache.isClosed() || cgCache.unloadInProgress {
cgCache.extMutex.Unlock()
return
}
cgCache.unloadInProgress = true
for _, conn := range cgCache.connections {
go conn.close()
}
// close all replica streams for each... | [
0.22080092132091522,
-0.3024347722530365,
0.5467236638069153,
-0.5562360286712646,
-1.0336134433746338,
-0.3732888400554657,
0.7546740174293518,
-0.1929277926683426,
-0.9786331057548523,
0.4432239234447479,
0.4084654450416565,
-0.0919150710105896,
-1.2459321022033691,
0.5661882162094116,
... |
func (cgCache *consumerGroupCache) cleanupChannels() {
// close msgsCh
close(cgCache.msgsCh)
// close cacheCh
close(cgCache.msgCacheCh)
// redelivery channel
close(cgCache.msgsRedeliveryCh)
// priority redelivery channel
close(cgCache.priorityMsgsRedeliveryCh)
// redeliverd channel
close(cgCache.msgCacheRedel... | [
0.3104085624217987,
0.003762665670365095,
0.3739907741546631,
-0.7225140333175659,
-0.24608257412910461,
-0.33945149183273315,
0.46070194244384766,
-0.855183482170105,
-0.07624348253011703,
0.29632601141929626,
0.16299958527088165,
-0.1753220409154892,
-0.2437242865562439,
1.65298175811767... |
func WithName(name string) Option {
return func(o *Options) {
o.Name = name
}
} | [
0.42893120646476746,
-0.12740874290466309,
0.5182127952575684,
-0.20917612314224243,
-0.3146660327911377,
-0.6920489072799683,
0.5941833853721619,
-0.58357173204422,
0.4346826374530792,
0.945050835609436,
-0.8736714124679565,
-0.7858527302742004,
0.6899991035461426,
-0.7569491863250732,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.