text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (bot *DiscordBot) onMessageCreate(e *gateway.MessageCreateEvent) { // Ignore messages from ourselves if e.Author.ID != bot.id && e.Message.WebhookID.String() == "" { // Check if the message is a bot command if strings.HasPrefix(e.Message.Content, "!") { c := make(chan bool) go parser.Parse(e.Message, b...
[ 0.3489997982978821, -0.5051484107971191, 0.699329137802124, -0.19095782935619354, 0.6460622549057007, -0.45553648471832275, 0.011968213133513927, -0.12216592580080032, 0.02747897244989872, 0.45395132899284363, 0.25135689973831177, 0.011268168687820435, -0.26094919443130493, 1.1550482511520...
func (bot *DiscordBot) sendToDiscord(m *MinecraftMessage) { // Insert Discord mentions if configured and present if Config.Discord.AllowMentions { // Insert Discord mentions m.Message = bot.insertMentions(m.Message) } // Send the message to Discord either via webhook or normal channel message if Config.Discor...
[ 0.08285962045192719, 0.4826371669769287, 0.7289625406265259, -0.27351710200309753, 0.8959716558456421, -0.10655081272125244, -0.17758992314338684, 0.8119187951087952, -0.07590185105800629, 0.5362482666969299, 0.008823706768453121, 1.4838725328445435, -0.824512243270874, 1.4644992351531982,...
func (bot *DiscordBot) getNickname(id discord.UserID) string { var m *discord.Member // Look in the cached state for the Member m, _ = bot.state.Member(bot.guildID, id) // Make sure we do have a user if m == nil { return "" } if m.Nick == "" { return m.User.Username } return m.Nick }
[ 0.5367798209190369, 0.14912216365337372, 0.4400731027126312, 0.6762344837188721, -0.5092338919639587, -1.1592758893966675, -0.4076254367828369, -0.32689860463142395, 0.24073909223079681, 0.5498616099357605, -0.12013939768075943, 0.28660377860069275, -0.34294402599334717, 0.6894076466560364...
func (bot *DiscordBot) getUserFromName(text string) (target *discord.User) { // Look through all guild members in the state members, _ := bot.state.Members(bot.guildID) for _, u := range members { // Check if the name matches, case-insensitive if strings.EqualFold(u.User.Username, text) { target = &u.User ...
[ 0.41624027490615845, -0.6754208207130432, 0.4340549111366272, 0.2872450053691864, -0.3734404146671295, 0.08318664133548737, -0.8417285680770874, -0.11389733105897903, -0.10131201148033142, -0.15099568665027618, 0.0032131418120115995, 0.46122944355010986, -1.5958259105682373, -0.45723992586...
func (bot *DiscordBot) insertMentions(msg string) string { // Split the message into words words := strings.Split(msg, " ") // Iterate over each word for _, word := range words { // Check if the word might be a mention if strings.HasPrefix(word, "@") { // Attempt to get the user user := bot.getUserFromNa...
[ 0.5509069561958313, 0.5639011263847351, 0.4600940942764282, -0.9026021957397461, 0.2975628077983856, -0.51497483253479, 0.8186741471290588, 0.6117417812347412, -0.39396950602531433, 1.053804636001587, 0.23145277798175812, 0.29166170954704285, -2.375905752182007, 1.0895475149154663, -0.25...
func (bot *DiscordBot) setWebhookParams(m *MinecraftMessage) api.ExecuteWebhookData { // Get the avatar to use for this message var avatarURL string if m.Username == bot.name { // Use the bot's avatar avatarURL = bot.avatarURL } else { // Player's Minecraft head as the avatar avatarURL = fmt.Sprintf("https...
[ -0.9449710845947266, 0.08821340650320053, 0.5837950706481934, -0.39274659752845764, -0.5089142918586731, 0.23424573242664337, -0.15770135819911957, -0.3133516311645508, -0.34112003445625305, 0.39059650897979736, 0.08137594908475876, 0.7172500491142273, -0.9590665102005005, 1.29341661930084...
func removeDuplicates(stringSlices ...[]string) []string { uniqueMap := map[string]bool{} for _, stringSlice := range stringSlices { for _, str := range stringSlice { uniqueMap[str] = true } } // Create a slice with the capacity of unique items // This capacity make appending flow much more efficient res...
[ -0.06618843972682953, -1.0824601650238037, 0.7786465883255005, -0.7204781174659729, 0.08469174802303314, -0.4849233627319336, -0.3349861800670624, 1.163926362991333, 0.45968109369277954, 0.5979105830192566, -0.28503790497779846, 0.33588558435440063, -1.0097301006317139, -0.0906168445944786...
func (c *Client) InfluxdbPost(falcopayload types.FalcoPayload) { c.Stats.Influxdb.Add(Total, 1) err := c.Post(newInfluxdbPayload(falcopayload, c.Config)) if err != nil { go c.CountMetric(Outputs, 1, []string{"output:influxdb", "status:error"}) c.Stats.Influxdb.Add(Error, 1) c.PromStats.Outputs.With(map[string...
[ 0.5444492697715759, 0.3180633783340454, 0.7008774280548096, 1.47551429271698, 0.26782897114753723, 0.657195508480072, 0.11512823402881622, 0.45555585622787476, -0.6488267779350281, 0.2809413969516754, -0.25333982706069946, -0.206685870885849, -0.7631864547729492, 0.6847944259643555, 0.99...
func Evaluate(input string) (decimal.Decimal, error) { var stack []decimal.Decimal inputs := strings.Split(input, " ") for _, command := range inputs { switch command { case "+", "-", "*", "/", "%", "^": if len(stack) < 2 { return decimal.Zero, errors.New("stack overflow") } lhs := stack[len(stack)...
[ 0.08697899430990219, 0.238282710313797, 1.1285815238952637, 0.0702512189745903, -0.6654829978942871, -0.38312357664108276, 0.5989416837692261, -0.872583270072937, -0.5525577068328857, -0.5236501693725586, 0.2850506007671356, -0.35717785358428955, -0.2670922577381134, 0.4931478202342987, ...
func (u user) notify() { fmt.Printf("Sending an email to %s<%s>\n", u.name, u.email) }
[ 0.09161601960659027, 0.42161643505096436, 0.20447246730327606, 0.0024848622269928455, -0.1546219289302826, -0.10872022062540054, -0.20359265804290771, 0.7680561542510986, -0.6593418121337891, -0.10134834796190262, -0.8575266003608704, 1.7406105995178223, 0.8222086429595947, -0.182030722498...
func (u *user) changeEmail(email string) { u.email = email }
[ -0.5011506080627441, 0.5731341242790222, -0.13708116114139557, 0.3130545914173126, -0.1708149015903473, 0.4571164548397064, -0.3371114432811737, 1.0709896087646484, -0.45033901929855347, 0.12918557226657867, -0.5911012291908264, 1.2684433460235596, -0.1424054056406021, 0.3868016302585602, ...
func main() { c := car.Car{Nome: "BMW"} fmt.Println(c) fmt.Println(c.Inc()) fmt.Println(c.Dec()) fmt.Println(c.Inc()) fmt.Println(c.Inc()) fmt.Println(c.Inc()) }
[ 0.394212007522583, -0.4621787369251251, 0.9468920230865479, -0.03699861466884613, -0.4076652228832245, 0.9482553005218506, 1.017750859260559, -0.1305389255285263, -1.2022926807403564, -1.05085289478302, -0.5892739295959473, 0.18512481451034546, -0.21607056260108948, 0.12743693590164185, ...
func (q *SimpleQueue) MutexFileSave() *mfs.PMutex { return &q.mxFileSave }
[ 0.3488823473453522, -0.29536786675453186, 0.49287208914756775, -0.15848249197006226, -1.0246416330337524, 0.4284002184867859, -1.3914638757705688, 0.25205132365226746, 0.11740458011627197, -0.5385551452636719, -1.1045883893966675, -0.9352818131446838, -1.220704436302185, -0.566316127777099...
func (block *SimpleQueueBlock) MutexFileSave() *mfs.PMutex { return &block.mxFileSave }
[ 0.35062146186828613, -0.24379371106624603, 0.5249746441841125, 0.07882539927959442, -1.0328669548034668, 0.21900245547294617, -1.1124697923660278, 0.3182571232318878, 0.057781003415584564, -0.5613376498222351, -1.1270134449005127, -0.8572832942008972, -1.1721640825271606, -0.46384179592132...
func (q *SimpleQueue) MutexBlockSaveWait() *mfs.PMutex { return &q.mxBlockSaveWait }
[ 0.06001788377761841, -0.005032351240515709, 0.570301353931427, 0.08934229612350464, -1.0670270919799805, -0.014377200976014137, -1.4028311967849731, 0.10702810436487198, 0.8872656226158142, 0.23709014058113098, -1.5069624185562134, -0.7767190933227539, -1.0011919736862183, -0.4038619995117...
func CreateSimpleQueue(cntLimit int, timeLimit time.Duration, lenLimit int, metaStorage storage.Storage, subscriberStorage storage.Storage, markerBlockDataStorage map[string]storage.Storage, idGenerator *mft.G) *SimpleQueue { if idGenerator == nil { idGenerator = &mft.G{} } return &SimpleQueue{ MetaStorage: ...
[ -0.09155334532260895, -0.8967598676681519, 0.6329473853111267, 0.040816184133291245, -0.36886024475097656, -0.4026508331298828, -0.9967301487922668, 0.5423992872238159, 0.4064091742038727, -0.12385482341051102, -1.0684057474136353, 0.13639189302921295, -0.25562164187431335, 0.4251800477504...
func LoadSimpleQueue(ctx context.Context, metaStorage storage.Storage, subscriberStorage storage.Storage, markerBlockDataStorage map[string]storage.Storage, idGenerator *mft.G) (q *SimpleQueue, err *mft.Error) { if idGenerator == nil { idGenerator = &mft.G{} } q = &SimpleQueue{ MetaStorage: metaSto...
[ -0.3169357180595398, -0.7979985475540161, 0.9779558181762695, -0.7103848457336426, -0.427372008562088, -0.7912415862083435, -0.6581680178642273, -0.19793598353862762, 0.06571339815855026, 0.4983462989330292, -0.8140872716903687, 0.4567109942436218, -0.495478093624115, 0.5320444703102112, ...
func (q *SimpleQueue) currentBlockForWrite(ctx context.Context, saveMode cn.SaveMode) (block *SimpleQueueBlock, chWait chan bool, err *mft.Error) { if len(q.Blocks) == 0 { return q.checkAndAddCurrentBlockForWrite(ctx, saveMode) } ok, err := q.Blocks[len(q.Blocks)-1].canAppend(ctx, q.CntLimit, q.TimeLimit, q.LenLi...
[ -0.6659952998161316, -0.8846288919448853, 0.8267837166786194, 0.02432539314031601, -0.30660513043403625, 0.07317250967025757, 0.08085808157920837, -0.18897120654582977, -0.22004401683807373, 0.22231747210025787, 0.6367077827453613, 0.1569257378578186, -0.6973791122436523, 0.210389122366905...
func (q *SimpleQueue) checkAndAddCurrentBlockForWrite(ctx context.Context, saveMode cn.SaveMode) (block *SimpleQueueBlock, chWait chan bool, err *mft.Error) { if !q.mx.TryPromoteF(ctx) { return nil, nil, GenerateError(10010003) } if len(q.Blocks) == 0 { block := &SimpleQueueBlock{ ID: q.IDGenerator.RvGetPa...
[ -0.2282411903142929, -0.2838636040687561, 1.0459927320480347, 0.10989132523536682, -0.1949051320552826, -0.01973322220146656, -0.2215862274169922, -0.013944472186267376, -0.07635898143053055, 0.48503661155700684, 0.11976604163646698, 0.015101880766451359, -0.9033675193786621, 0.72017526626...
func (q *SimpleQueue) Add(ctx context.Context, user cn.CapUser, message []byte, externalID int64, externalDt int64, source string, segment int64, saveMode cn.SaveMode) (id int64, err *mft.Error) { if externalDt > time.Now().Unix() { return id, GenerateError(10010008, externalDt, time.Now()) } if !q.mx.RTryLock(...
[ -0.7000835537910461, -0.22865931689739227, 1.052209496498108, 0.14914236962795258, -0.267415314912796, 0.3284103572368622, 0.27054810523986816, -0.22807574272155762, -0.1438443958759308, 0.1250673234462738, -0.6753348112106323, -0.08124426007270813, -0.6463238000869751, 0.5087878108024597,...
func (block *SimpleQueueBlock) add(ctx context.Context, message []byte, externalID int64, externalDt int64, source string, segment int64, idGen *mft.G, saveMode cn.SaveMode) (id int64, chWait chan bool, err *mft.Error) { if !block.mx.TryLock(ctx) { return id, nil, GenerateError(10010001) } if block.IsUnload { ...
[ -0.9475247859954834, -0.16055706143379211, 0.9623968601226807, -0.5098977088928223, -0.18615339696407318, 0.2619278132915497, -0.28579241037368774, -0.04448607936501503, -0.0576760433614254, -0.2558879554271698, -0.9564995765686035, 0.3348607122898102, -0.8872606158256531, 0.62998747825622...
func (block *SimpleQueueBlock) canAppend(ctx context.Context, cntLimit int, timeLimit time.Duration, lenLimit int) (ok bool, err *mft.Error) { if !block.mx.RTryLock(ctx) { return ok, GenerateError(10010002) } ok = true if block.IsUnload { ok = false } if ok && timeLimit > 0 && time.Since(block.Dt) >= timeL...
[ 0.08221637457609177, -0.1697291135787964, 0.9127389788627625, 0.365109384059906, -1.2108856439590454, 0.38604217767715454, -0.5407395362854004, 0.2665582001209259, -0.10336791723966599, 0.5341026782989502, -0.16855138540267944, 0.5226144194602966, -0.3571625351905823, 1.1186249256134033, ...
func (q *SimpleQueue) getBlockForNext(ctx context.Context, idStart int64) (block []*SimpleQueueBlock, err *mft.Error) { if len(q.Blocks) == 0 { return nil, nil } idx := sort.Search(len(q.Blocks), func(i int) bool { return q.Blocks[i].ID >= idStart }) if idx > 0 { idx-- } for idx < len(q.Blocks) { if !...
[ -0.12684881687164307, 0.12064461410045624, 0.9508947134017944, -0.06276072561740875, -0.960148274898529, -0.7549543976783752, -0.9933731555938721, -1.5637810230255127, 0.08602569252252579, -0.46930503845214844, -0.5220255851745605, 0.7731216549873352, -0.9913495779037476, 0.168549001216888...
func (block *SimpleQueueBlock) getItemsAfter(ctx context.Context, q *SimpleQueue, idStart int64, cntLimit int, queueSaveRv int64, segments *segment.Segments, ) (messages []*MessageWithMeta, lastId int64, err *mft.Error) { if !block.mx.RTryLock(ctx) { return nil, lastId, GenerateError(10011001) } if block.IsUnlo...
[ -0.26969099044799805, -0.7716583013534546, 0.9804704189300537, 0.007056037429720163, -0.16317880153656006, -0.5191907286643982, -0.06147988513112068, -0.71184241771698, 0.14741210639476776, -0.14861086010932922, -0.8431789875030518, 0.246687114238739, -0.5339328646659851, 0.353889405727386...
func (q *SimpleQueue) Get(ctx context.Context, user cn.CapUser, idStart int64, cntLimit int) (messages []*MessageWithMeta, err *mft.Error) { messages, _, err = q.GetSegment(ctx, user, idStart, cntLimit, nil) return messages, err }
[ -0.62115877866745, -0.22177347540855408, 0.6237931847572327, 0.08003000915050507, 0.8168479204177856, -0.2992364466190338, -0.21419042348861694, -0.930776059627533, 0.04641614481806755, -0.13808810710906982, -0.3301411271095276, 1.3597376346588135, -0.368147611618042, -0.1441987007856369, ...
func (q *SimpleQueue) GetSegment(ctx context.Context, user cn.CapUser, idStart int64, cntLimit int, segments *segment.Segments, ) (messages []*MessageWithMeta, lastId int64, err *mft.Error) { lastId = idStart if !q.mx.RTryLock(ctx) { return nil, lastId, GenerateError(10011002) } blocks, err := q.getBlockForNe...
[ -0.29581448435783386, -0.3912731111049652, 0.9924613237380981, 0.3128105700016022, 0.45013123750686646, -0.6118279695510864, 0.5762251019477844, -1.067246913909912, -0.1312577873468399, 0.5711544156074524, -0.31716394424438477, 0.22201664745807648, -0.9239002466201782, 0.25683504343032837,...
func (q *SimpleQueue) Save(ctx context.Context, user cn.CapUser) (err *mft.Error) { if q.MetaStorage == nil { return nil } if !q.mxFileSave.TryLock(ctx) { return GenerateError(10012000) } defer q.mxFileSave.Unlock() if !q.mx.RTryLock(ctx) { return GenerateError(10012001) } if q.SaveRv == q.ChangesRv { ...
[ -0.33837565779685974, 0.019500670954585075, 0.89328533411026, 0.17524585127830505, -0.2838541865348816, -0.014014855027198792, -0.5344998836517334, -0.3025476634502411, -0.7719205021858215, 0.8495442271232605, -0.5866842269897461, 0.7996044754981995, -0.28139737248420715, 0.744752228260040...
func (q *SimpleQueue) getStorage(name string) storage.Storage { if q.MetaStorage == nil { return nil } if st, ok := q.MarkerBlockDataStorage[name]; ok { return st } return q.MetaStorage }
[ 0.2062455117702484, -0.17179109156131744, 0.6299512386322021, 1.0076102018356323, -0.35564300417900085, -0.97910076379776, 0.20412278175354004, -1.180892825126648, 0.9024922251701355, 0.19405236840248108, -0.16999904811382294, -0.08951108157634735, -0.1936076581478119, 0.49791988730430603,...
func (q *SimpleQueue) getStorageLock(ctx context.Context, name string) (st storage.Storage, err *mft.Error) { if !q.mx.RTryLock(ctx) { return nil, GenerateError(10016000) } st = q.getStorage(name) q.mx.RUnlock() return st, nil }
[ -0.025702789425849915, 0.6187273263931274, 0.6172845363616943, 0.8977084755897522, 0.06725965440273285, -0.4524965286254883, 0.3708423674106598, -1.337613582611084, 0.12187046557664871, -0.8694024085998535, -0.421041876077652, 0.5932345986366272, -0.39425432682037354, 0.5050048232078552, ...
func (block *SimpleQueueBlock) Save(ctx context.Context, q *SimpleQueue) (err *mft.Error) { if q.MetaStorage == nil { return nil } if !block.mxFileSave.TryLock(ctx) { return GenerateError(10013000) } defer block.mxFileSave.Unlock() if !block.mx.RTryLock(ctx) { return GenerateError(10013001) } if block.S...
[ -0.1836172193288803, -0.24188007414340973, 0.996068000793457, 0.16400988399982452, -0.2935410439968109, -0.4296359419822693, -0.15022315084934235, -0.2970210909843445, -0.7448464632034302, 0.7127452492713928, -0.8225094079971313, 0.6488925218582153, -0.2668537199497223, 0.7047627568244934,...
func (q *SimpleQueue) SaveAll(ctx context.Context, user cn.CapUser) (err *mft.Error) { if !q.mxBlockSaveWait.TryLock(ctx) { return GenerateError(10014000) } waitSaveBlocks := q.SaveBlocks if len(waitSaveBlocks) > 0 { q.SaveBlocks = make(map[int64]*SimpleQueueBlock) } q.mxBlockSaveWait.Unlock() err = q.Save...
[ 0.30819937586784363, -0.18814904987812042, 1.037091612815857, 0.7252773642539978, 0.02120685763657093, -0.10404884070158005, -0.5124368071556091, -0.49182289838790894, -0.2086779922246933, 0.20418807864189148, -1.1200292110443115, -0.017938241362571716, -0.542982816696167, 1.42024886608123...
func (block *SimpleQueueBlock) load(ctx context.Context, q *SimpleQueue) (err *mft.Error) { if !block.IsUnload { return nil } if !block.mxFileSave.TryLock(ctx) { return GenerateError(10020000) } defer block.mxFileSave.Unlock() if !block.mx.TryPromote(ctx) { return GenerateError(10020001) } if !block.IsUn...
[ -0.5676382780075073, -0.3472597897052765, 1.1286060810089111, -0.7512876391410828, -0.17028933763504028, -0.436054527759552, -0.4768873453140259, -0.3402426242828369, -0.23666737973690033, 0.2472003698348999, -0.9158799052238464, 0.39681243896484375, -0.7187936902046204, -0.015433029271662...
func (block *SimpleQueueBlock) Unload(ctx context.Context, q *SimpleQueue) (isNotSave bool, err *mft.Error) { if !block.mxFileSave.TryLock(ctx) { return false, GenerateError(10019000) } defer block.mxFileSave.Unlock() if !block.mx.TryLock(ctx) { return false, GenerateError(10019001) } defer block.mx.Unlock() ...
[ -0.5275500416755676, 0.2918359935283661, 0.966938316822052, -0.2705516219139099, -0.6123350858688354, -0.5146893262863159, -0.32792139053344727, -0.4002593755722046, 0.07532592862844467, -0.11981023848056793, -0.654961347579956, -0.512302577495575, -0.5998371243476868, -0.16341793537139893...
func (block *SimpleQueueBlock) moveToNewStorage(ctx context.Context, q *SimpleQueue) (err *mft.Error) { if !block.mxFileSave.TryLock(ctx) { return GenerateError(10018000) } defer block.mxFileSave.Unlock() if !block.mx.RTryLock(ctx) { return GenerateError(10018001) } if block.NextMark == block.Mark { block....
[ -0.2808850109577179, -0.06960883736610413, 0.9945240020751953, 0.29819121956825256, -0.1972372829914093, -0.40557125210762024, 0.5215905904769897, -0.6804192662239075, -0.19335420429706573, 0.4343394935131073, -0.7230477929115295, 0.08854144811630249, -0.00808858685195446, 0.72251772880554...
func (block *SimpleQueueBlock) clearOldStorage(ctx context.Context, q *SimpleQueue) (notNeed bool, err *mft.Error) { if !block.mxFileSave.TryLock(ctx) { return false, GenerateError(10017000) } defer block.mxFileSave.Unlock() if len(block.RemoveMarks) == 0 { return true, nil } fileName := block.blockFileNam...
[ -0.08026186376810074, -0.11599110066890717, 1.022555947303772, -0.07455618679523468, -0.36975038051605225, -0.15870951116085052, 0.48604917526245117, -0.8367103338241577, 0.08178447186946869, 0.7659711837768555, -0.3855845630168915, -0.3970603048801422, -0.16823545098304749, 0.968210637569...
func (q *SimpleQueue) SetUnload(ctx context.Context, user cn.CapUser, setBlockUnload func(ctx context.Context, i int, len int, q *SimpleQueue, block *SimpleQueueBlock) (needUnload bool, err *mft.Error)) (err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return GenerateError(1002100...
[ -0.5939523577690125, 0.10119445621967316, 0.8452875018119812, -0.22004061937332153, -0.6020634174346924, -0.6348996758460999, 0.026366105303168297, -0.6670748591423035, -0.42606857419013977, 0.28627052903175354, -0.8845835328102112, -0.2571379542350769, -0.8273979425430298, 0.2093405872583...
func (q *SimpleQueue) SetMarks(ctx context.Context, user cn.CapUser, setBlockMark func(ctx context.Context, i int, len int, q *SimpleQueue, block *SimpleQueueBlock) (needSetMark bool, nextMark string, err *mft.Error)) (err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return Genera...
[ -0.49398595094680786, 0.2367112636566162, 0.46835803985595703, 0.5142691731452942, 0.1547774225473404, -0.22911730408668518, 0.5993266701698303, -0.5275803208351135, 0.01650146394968033, 0.042677365243434906, -0.8302903175354004, 0.40646839141845703, -0.45477399230003357, 0.741003215312957...
func (q *SimpleQueue) SetDelete(ctx context.Context, user cn.CapUser, setNeedDelete func(ctx context.Context, i int, len int, q *SimpleQueue, block *SimpleQueueBlock) (needDelete bool, err *mft.Error)) (err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return GenerateError(10025000...
[ -0.2737026810646057, 0.2075086385011673, 0.7851321697235107, 0.27118197083473206, 0.14435328543186188, -0.19058255851268768, -0.1391691416501999, -0.9095222353935242, -0.28690487146377563, 0.5296814441680908, -0.6243258118629456, 0.18412141501903534, -0.8442049622535706, 0.9465805888175964...
func (q *SimpleQueue) UpdateMarks(ctx context.Context, user cn.CapUser, blocksCount int) (err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return GenerateError(10026000) } for i := 0; i < len(q.Blocks); i++ { blocks = append(blocks, q.Blocks[i]) } q.mx.RUnlock() changes :...
[ -0.4239915907382965, 0.18348491191864014, 0.8359521627426147, 0.12829387187957764, -0.5412299036979675, -0.8214097619056702, 0.8128695487976074, -0.698652982711792, 0.0021756284404546022, 0.5442755222320557, -0.04371887445449829, 0.04208485409617424, -0.4779728055000305, 0.6500826478004456...
func (q *SimpleQueue) DeleteBlocks(ctx context.Context, user cn.CapUser, blocksCount int) (err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return GenerateError(10026000) } for i := 0; i < len(q.Blocks); i++ { blocks = append(blocks, q.Blocks[i]) } q.mx.RUnlock() changes ...
[ 0.11763057112693787, 0.4601154029369354, 0.6362552046775818, 0.055913180112838745, -0.3066893517971039, -0.4526783227920532, 0.13503025472164154, -1.1482839584350586, -0.08910856395959854, -0.09421472996473312, -0.33275744318962097, 0.16567036509513855, -0.9073578715324402, 0.8688569068908...
func (q *SimpleQueue) SetMaxExtID(source string, extID int64) { q.mxExt.DoGlobal(func() { if q.lastExtID == nil { q.lastExtID = make(map[string]int64) } v, ok := q.lastExtID[source] if !ok { q.lastExtID[source] = extID } else if v < extID { q.lastExtID[source] = extID } }) }
[ -0.27661216259002686, -0.6667330861091614, 0.5390828847885132, -0.4593237042427063, -1.7375553846359253, -0.07194750010967255, -1.248278260231018, 0.5751917362213135, 0.703792154788971, 0.7242072224617004, -1.1698764562606812, 0.8449387550354004, -0.4719158113002777, 0.1660463958978653, ...
func (q *SimpleQueue) getCurrentMaxExtID(source string) (extID int64, ok bool) { q.mxExt.DoGlobal(func() { if q.lastExtID != nil { extID, ok = q.lastExtID[source] } }) return extID, ok }
[ -0.11303827911615372, -0.5341912508010864, 0.5907777547836304, 0.34852370619773865, -1.7797924280166626, -0.1353597342967987, -0.635822057723999, 0.3925251364707947, 0.6239932179450989, 0.7650871872901917, -0.7807206511497498, 0.6804819703102112, -0.6687141060829163, 0.36932283639907837, ...
func (q *SimpleQueue) searchMaxExtID(ctx context.Context, source string, dt time.Time) (extID int64, ok bool, err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return extID, false, GenerateError(10027000) } for i := len(q.Blocks) - 1; i >= 0; i-- { blocks = append(blocks, q.Blo...
[ -0.1704394519329071, -0.17845004796981812, 1.1233855485916138, -0.15280944108963013, -1.4876976013183594, -0.3154403865337372, -0.9289210438728333, -0.19049373269081116, 0.05776899680495262, 0.3217397928237915, -0.36149343848228455, 0.6499530076980591, -0.714730441570282, 0.693061172962188...
func (q *SimpleQueue) searchExtID(ctx context.Context, source string, extID int64, dt int64) (id int64, ok bool, err *mft.Error) { blocks := make([]*SimpleQueueBlock, 0) if !q.mx.RTryLock(ctx) { return id, false, GenerateError(10028000) } for i := len(q.Blocks) - 1; i >= 0; i-- { blocks = append(blocks, q.Blo...
[ 0.027213750407099724, -0.28600355982780457, 1.0648040771484375, -0.4717576801776886, -1.5088934898376465, -0.19352014362812042, -0.8245216608047485, -0.5117976665496826, -0.3149142861366272, 0.5639049410820007, -0.31875309348106384, 0.7378471493721008, -0.9403946399688721, 0.55895555019378...
func (q *SimpleQueue) AddUnique(ctx context.Context, user cn.CapUser, message []byte, externalID int64, externalDt int64, source string, segment int64, saveMode cn.SaveMode) (id int64, err *mft.Error) { if externalID == 0 { return id, GenerateError(10029000) } if !q.mxExt.TryLock(ctx, source) { return id, Gen...
[ -0.8706133365631104, 0.31732451915740967, 0.9332779049873352, -0.11780054122209549, -0.5063816905021667, -0.05664396658539772, -0.0888298824429512, 0.3569261431694031, -0.157661572098732, 0.1880226731300354, -0.2683766484260559, 0.5916006565093994, -0.7951017022132874, -0.20492683351039886...
func (q *SimpleQueue) SaveSubscribers(ctx context.Context, user cn.CapUser) (err *mft.Error) { if q.SubscriberStorage == nil { return nil } if !q.Subscribers.mxFileSave.TryLock(ctx) { return GenerateError(10031000) } defer q.Subscribers.mxFileSave.Unlock() if !q.Subscribers.mx.RTryLock(ctx) { return Genera...
[ -0.5583187341690063, -0.6499202847480774, 0.6376871466636658, 0.027521850541234016, -0.2230377346277237, -0.2788245677947998, -0.6200182437896729, -0.21113543212413788, -0.7170752286911011, 0.4295910596847534, -0.7437792420387268, 0.4229818284511566, -0.8661950826644897, 0.7485586404800415...
func (q *SimpleQueue) SubscriberSetLastRead(ctx context.Context, user cn.CapUser, subscriber string, id int64, saveMode cn.SaveMode) (err *mft.Error) { if !q.Subscribers.mx.TryLock(ctx) { return GenerateError(10032000) } if q.UseDefaultSaveModeForce { saveMode = q.DefaultSaveMode } else if saveMode == cn.Qu...
[ -0.15545876324176788, -0.9093326330184937, 0.8254944682121277, -0.8401027917861938, -0.22846870124340057, -0.6226590275764465, -0.37599650025367737, -0.6752283573150635, 0.12582525610923767, 0.19811929762363434, -0.20648574829101562, 0.07778634876012802, -0.6150680780410767, 0.014086469076...
func (q *SimpleQueue) SubscriberGetLastRead(ctx context.Context, user cn.CapUser, subscriber string) (id int64, err *mft.Error) { if !q.Subscribers.mx.RTryLock(ctx) { return 0, GenerateError(10033000) } defer q.Subscribers.mx.RUnlock() v, ok := q.Subscribers.SubscribersInfo[subscriber] if !ok { return 0, nil...
[ 0.8222852945327759, -0.41013455390930176, 0.8504094481468201, -0.5429369211196899, -0.6069149374961853, -0.19291701912879944, -1.0941028594970703, -0.6325993537902832, -0.08094674348831177, 0.07810772955417633, 0.5028378963470459, -0.0493377260863781, -1.3568518161773682, -0.24560648202896...
func (q *SimpleQueue) SubscriberAddReplicaMember(ctx context.Context, user cn.CapUser, subscriber string) (err *mft.Error) { if !q.Subscribers.mx.TryLock(ctx) { return GenerateError(10033100) } q.Subscribers.ReplicaSubscribers[subscriber] = struct{}{} q.Subscribers.mx.Unlock() err = q.SaveSubscribers(ctx, us...
[ 0.1382243037223816, 0.39188265800476074, 0.38645482063293457, -0.35748764872550964, -0.9671316742897034, 0.25435322523117065, -0.4250478148460388, -0.4567297101020813, 0.36966854333877563, 0.5545058250427246, -1.2975647449493408, 1.0262916088104248, -0.7942872047424316, 0.01653768867254257...
func (q *SimpleQueue) SubscriberRemoveReplicaMember(ctx context.Context, user cn.CapUser, subscriber string) (err *mft.Error) { if !q.Subscribers.mx.TryLock(ctx) { return GenerateError(10033200) } delete(q.Subscribers.ReplicaSubscribers, subscriber) q.Subscribers.mx.Unlock() err = q.SaveSubscribers(ctx, user...
[ 0.18627189099788666, 0.16476470232009888, 0.3916873037815094, -0.17530082166194916, -1.098541021347046, -0.18628080189228058, -0.3064004182815552, 0.31797125935554504, 0.17283391952514648, 1.163131833076477, -0.6910259127616882, 0.8813409805297852, -1.3620734214782715, -0.28937941789627075...
func (q *SimpleQueue) SubscriberGetReplicaCount(ctx context.Context, user cn.CapUser, id int64) (cnt int, err *mft.Error) { if !q.Subscribers.mx.RTryLock(ctx) { return 0, GenerateError(10033300) } defer q.Subscribers.mx.RUnlock() for k := range q.Subscribers.ReplicaSubscribers { v, ok := q.Subscribers.Subscri...
[ -0.0017406279221177101, 0.41103464365005493, 0.9675746560096741, -0.7857974171638489, -0.7078434824943542, -0.8306186199188232, 0.06360288709402084, 0.35177621245384216, -0.26179081201553345, 0.21707047522068024, -0.7901304364204407, 0.9973631501197815, -0.7093788385391235, -0.119286656379...
func DBInit() *gorm.DB { var errEnv error errEnv = godotenv.Load() if errEnv != nil { log.Fatalf("Error getting env, not comming through %v", errEnv) } else { fmt.Println("We are getting the env values") } // fmt.Println("host=" + os.Getenv("DB_HOST") + " port=" + os.Getenv("DB_PORT") + " user=" + os.Getenv("...
[ 0.14659851789474487, 0.09401735663414001, 1.0513191223144531, 0.44142335653305054, 0.15150828659534454, 0.8942610621452332, -0.22354358434677124, 0.2233104407787323, -1.2362325191497803, 0.21201905608177185, -0.1748867928981781, 0.6904014348983765, -0.7333715558052063, 0.612088680267334, ...
func (p *Page) parse() error { p.once.Do(func() { if p.root, p.err = html.Parse(p.body); p.err != nil { p.err = fmt.Errorf("ant: parse html %q - %w", p.URL, p.err) } p.close() }) return p.err }
[ -0.06603401154279709, 0.9221763610839844, 0.6186217665672302, 0.12238313257694244, 0.09223507344722748, 0.14716890454292297, -0.8288063406944275, -0.5994806885719299, -0.4528331160545349, -0.23389306664466858, 0.9971777200698853, -0.4807557761669159, -1.1127790212631226, 0.9714685678482056...
func (p *Page) Query(selector string) List { var ret List if err := p.parse(); err != nil { return ret } if s, err := selectors.Compile(selector); err == nil { ret = s.MatchAll(p.root) } return ret }
[ -0.15504826605319977, -0.5572443008422852, 0.5074356198310852, 0.7480570673942566, 0.28992825746536255, -0.48440760374069214, -1.4680697917938232, 0.9713917374610901, 1.163932204246521, 0.15007269382476807, 0.15238071978092194, -0.4761275351047516, -0.4076155126094818, 0.6431829333305359, ...
func (p *Page) Text(selector string) string { return p.Query(selector).Text() }
[ -0.7397450804710388, -0.12517386674880981, 0.10316956788301468, -0.25111299753189087, -0.3469090163707733, 0.044253166764974594, -0.5615374445915222, -0.44850656390190125, 0.9050701856613159, 1.1137714385986328, -0.014351419173181057, -0.6179092526435852, -0.26015836000442505, -0.934025704...
func (p *Page) URLs() URLs { return p.resolve(`a[href]`) }
[ 0.4426460862159729, 0.6980985999107361, 0.1983153223991394, -0.4060763716697693, 0.5093081593513489, -0.5949475169181824, -1.2804009914398193, 0.8717046976089478, 0.5137668251991272, -0.7644451856613159, 0.08716730028390884, -0.27879318594932556, -0.5221037864685059, -0.5359957218170166, ...
func (p *Page) Next(selector string) (URLs, error) { return p.resolve(selector), nil }
[ -1.0147336721420288, 0.48519933223724365, 0.15044589340686798, 0.8289100527763367, -0.06796228885650635, -0.46874895691871643, -1.406312346458435, 0.2948542535305023, 0.6082520484924316, -0.2569683790206909, -0.6378627419471741, -0.4289294183254242, -0.12344993650913239, 0.4299760460853576...
func (p *Page) Scan(dst interface{}) error { if err := p.parse(); err != nil { return err } return scanner.Scan(dst, p.root, scan.Options{}) }
[ -0.6916006207466125, 0.23394477367401123, 0.418551504611969, 0.5866122245788574, -0.9101563692092896, 0.18443408608436584, -0.178219273686409, 0.10278712213039398, -0.2273077368736267, -0.2089330106973648, 0.0682162195444107, 0.09561572968959808, 0.14769743382930756, 0.5463134050369263, ...
func (p *Page) resolve(selector string) URLs { var anchors = p.Query(selector) var ret = make(URLs, 0, len(anchors)) for _, a := range anchors { if href, ok := scan.Attr(a, "href"); ok { u, err := url.Parse(href) if err != nil { continue } if !u.IsAbs() { u = p.URL.ResolveReference(u) } ...
[ -0.7340028285980225, 0.4981997013092041, 0.8437939882278442, 0.005573203321546316, 0.6270544528961182, -0.5902056097984314, -0.749488353729248, 0.16335812211036682, -0.29828783869743347, 0.12090590596199036, 0.12551501393318176, -0.7593129277229309, -0.3037010729312897, 0.791665256023407, ...
func (p *Page) close() error { io.Copy(ioutil.Discard, p.body) return p.body.Close() }
[ 0.19975364208221436, 0.12233030796051025, 0.4556010663509369, -0.3575712740421295, -0.44405698776245117, 1.2602910995483398, -1.0495436191558838, -0.5619814991950989, -0.06397555023431778, 0.19511723518371582, 0.48226165771484375, -0.09693780541419983, -1.5656237602233887, 0.51287013292312...
func (image *Image) Resize(dimensions *Dimensions, dest string) { fmt.Println("[Resize] ", image.Filename, dimensions) cmd := exec.Command("convert", image.Filename, "-auto-orient", "-resize", dimensions.String+">", "-quality", "80", "-strip", "-depth", "8", dest) fmt.Println("[Resize] execute:", cmd.Args) out, er...
[ -0.8804089426994324, 0.5974231958389282, 0.9292120337486267, -0.18791821599006653, 0.1262199878692627, 0.26038047671318054, -0.49298426508903503, 0.011024798266589642, -1.0946173667907715, 0.2439769208431244, 0.6335112452507019, 0.8369722962379456, 0.6391814947128296, 0.20853598415851593, ...
func (image *Image) Fill(dimensions *Dimensions, dest string) { fmt.Println("[Fill] ", image.Filename, dimensions) cmd := exec.Command("convert", image.Filename, "-auto-orient", "-resize", dimensions.String+"^", "-gravity", "center", "-extent", dimensions.String, "-quality", "80", "-strip", "-depth", "8", dest) fmt...
[ -0.22041089832782745, 0.5910207033157349, 0.8640333414077759, -0.7110022902488708, 0.14345817267894745, 0.8239451050758362, -0.5853996276855469, -0.390681654214859, -0.9165732860565186, 0.3806022107601166, 0.43130701780319214, 1.0624566078186035, 0.8893868327140808, 0.9144778251647949, -...
func (image *Image) Identify() { if image.Dimensions != nil { return } image.Extension = filepath.Ext(image.OriginalFilename) image.MimeType = mime.TypeByExtension(image.Extension) // determine the size of the file file, err := os.Open(image.Filename) if err != nil { fmt.Println("[Identify] error:", err) ...
[ -0.22624963521957397, -0.677269458770752, 0.9255479574203491, 0.8514063954353333, 0.4230267107486725, 0.07930903881788254, 0.07026831060647964, 0.29841113090515137, 0.10011903196573257, 0.46604958176612854, 0.01103400718420744, 0.8283757567405701, -0.49136868119239807, 1.1042083501815796, ...
func (image *Image) Optimize() { cmd := exec.Command("jpegoptim", image.Filename) out, err := cmd.CombinedOutput() fmt.Println("[Optimize]", string(out[:])) if err != nil { fmt.Println("[Optimize] jpegoptim error:", err) } }
[ -0.7726196646690369, 0.6387025713920593, 0.6054002046585083, 0.5564751625061035, 0.8382329940795898, -0.7393585443496704, 0.8040965795516968, -0.34407877922058105, -0.8642392754554749, 0.7228192090988159, 0.009185794740915298, 0.692541241645813, -0.6958976984024048, 0.4632278084754944, 0...
func Route(mux *http.ServeMux) { mux.HandleFunc("/studyplan/create", createStudyPlan) mux.HandleFunc("/subject/create", createSubject) mux.HandleFunc("/career/create", createCareer) mux.HandleFunc("/teacher/create", createTeacher) mux.HandleFunc("/student/create", createStudent) mux.HandleFunc("/studyplan/getal...
[ -0.5842497944831848, 0.281607061624527, 0.8332439661026001, 0.6272647976875305, -0.41767430305480957, 0.12948636710643768, 0.353643536567688, -0.23654745519161224, 0.11920838803052902, 0.15607009828090668, -0.08106854557991028, 0.32176509499549866, 0.4559724032878876, 0.20499898493289948, ...
func defaultConfig() *config { return &config{ Permission: 0777, } }
[ 1.3227192163467407, 1.1727521419525146, 0.3125685751438141, 1.0228708982467651, -0.3379439413547516, 0.1365506500005722, -0.13434769213199615, 1.057979702949524, -0.036415036767721176, -0.383529394865036, -0.06918616592884064, -0.3149201571941376, -0.36069434881210327, 0.3282340168952942, ...
func readTodoList(p string) [][]string { f, err := os.Open(p) crashIf(err) defer f.Close() log.Println("Reading", p, "…") defer log.Println(p, "read!") l, err := csv.NewReader(f).ReadAll() crashIf(err) return l }
[ -0.3407919108867645, -0.20762290060520172, 0.6730139851570129, -0.168281689286232, -0.29940876364707947, 0.7718209028244019, -0.5330646634101868, 0.06576979905366898, 0.2933499813079834, 0.4910384714603424, -0.025730889290571213, 0.03545767441391945, -0.1286700814962387, -0.076652698218822...
func (c *Controller) Login(user model.User) (model.AuthToken, error) { existingUser := c.service.GetExistingUser(user.Username) if existingUser.Username == "" { return model.AuthToken{}, errors.New("No user found with the inputted username") } isValid := checkPasswordHash(user.Password, existingUser.Password) if...
[ -0.09728656709194183, -0.1998470276594162, 0.5048394799232483, 0.8561368584632874, -1.29707670211792, 0.5383808612823486, 0.49028950929641724, 0.7640798091888428, 0.05280188471078873, -0.6366293430328369, -0.49212971329689026, 0.49007540941238403, 0.12639367580413818, 0.06212093308568001, ...
func PoolMaxStreams(n int) client.Option { return func(o *client.Options) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, poolMaxStreams{}, n) } }
[ 0.34883445501327515, 0.412691593170166, 0.3790775239467621, -0.5042216181755066, -0.3439162075519562, -0.23538026213645935, 0.11801276355981827, -1.1258128881454468, 1.2241908311843872, -0.15161965787410736, -0.7104365229606628, 0.8025383353233337, -1.2597683668136597, 0.08920810371637344,...
func PoolMaxIdle(d int) client.Option { return func(o *client.Options) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, poolMaxIdle{}, d) } }
[ 0.1949271857738495, 0.3643760085105896, 0.5178218483924866, -0.6407873034477234, 0.011364811100065708, 0.6291846632957458, -0.2022772878408432, -0.9027196764945984, 1.364147424697876, -0.28415900468826294, -0.28466707468032837, 1.2174785137176514, -0.7387281656265259, -0.801487922668457, ...
func Codec(contentType string, c encoding.Codec) client.Option { return func(o *client.Options) { codecs := make(map[string]encoding.Codec) if o.Context == nil { o.Context = context.Background() } if v := o.Context.Value(codecsKey{}); v != nil { codecs = v.(map[string]encoding.Codec) } codecs[content...
[ 0.8694983720779419, -0.23860011994838715, 0.43881145119667053, -1.0754814147949219, -0.3112557828426361, 0.22536134719848633, 0.46534475684165955, -0.555205225944519, 0.5978262424468994, -0.44769182801246643, 0.49471548199653625, 1.150611162185669, 0.40544918179512024, -0.37519708275794983...
func AuthTLS(t *tls.Config) client.Option { return func(o *client.Options) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, tlsAuth{}, t) } }
[ 0.41815465688705444, 0.15742728114128113, 0.4771578013896942, -0.3176060914993286, -0.595781683921814, 0.27265769243240356, 0.04262666031718254, -0.3772321343421936, 0.9294836521148682, 0.3895481824874878, -0.058985184878110886, 0.7515507936477661, 0.059213653206825256, -0.3430554866790771...
func MaxRecvMsgSize(s int) client.Option { return func(o *client.Options) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, maxRecvMsgSizeKey{}, s) } }
[ 0.7382656335830688, 0.8299305438995361, 0.4636950194835663, -0.19898611307144165, -0.24925179779529572, -0.514539361000061, -0.3320717513561249, 0.09550376981496811, 0.7451657652854919, 0.623765230178833, 0.35760706663131714, 1.0249748229980469, -0.7137917876243591, 0.5767936706542969, -...
func MaxSendMsgSize(s int) client.Option { return func(o *client.Options) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, maxSendMsgSizeKey{}, s) } }
[ 0.2437538504600525, 0.6751669049263, 0.6471366286277771, -0.23900803923606873, -0.7655497789382935, -0.374116450548172, -0.2786042094230652, -0.21994207799434662, 1.0120620727539062, 0.4475559592247009, -0.1654704511165619, 0.6255137324333191, -0.8347355723381042, 1.2074053287506104, -1....
func DialOptions(opts ...grpc.DialOption) client.CallOption { return func(o *client.CallOptions) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, grpcDialOptions{}, opts) } }
[ 0.36126065254211426, 0.436737596988678, 0.6286742091178894, 0.3328950107097626, 0.2334553301334381, 0.567879319190979, -0.06361143290996552, -0.6028381586074829, 1.5061050653457642, -0.03438487648963928, 0.03250692039728165, 0.6036957502365112, -0.85448157787323, -0.29619497060775757, -0...
func CallOptions(opts ...grpc.CallOption) client.CallOption { return func(o *client.CallOptions) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, grpcCallOptions{}, opts) } }
[ 0.5358740091323853, 0.4669893980026245, 0.7325000762939453, 0.3480829894542694, -0.08410317450761795, 0.7255704998970032, -0.40381965041160583, -0.9316710829734802, 1.1632170677185059, 0.12090884149074554, 0.13353443145751953, 0.5488685965538025, -1.1565808057785034, -0.010245436802506447,...
func New(store dapp.Store) *Protocol { return &Protocol{store: store} }
[ 0.013182257302105427, -0.15469729900360107, -0.28720730543136597, -0.08420978486537933, -1.6127631664276123, -0.10918285697698593, -0.7461174130439758, 0.11897555738687515, 0.7370187044143677, -0.019286978989839554, -0.43236014246940613, 0.2782629728317261, 0.3075128197669983, -0.726419389...
func (kv *KVServer) Get(args *GetArgs, reply *GetReply) { //DPrintf("[GET Request get]From Client %d (Request %d) To Server %d",args.ClientId,args.RequestId, kv.me) if kv.killed() { reply.Err = ErrWrongLeader return } _, ifLeader := kv.rf.GetState() if !ifLeader { reply.Err = ErrWrongLeader //DPrintf("[GE...
[ -0.6636430025100708, 0.2417575567960739, 1.0841306447982788, 0.18514959514141083, 0.4484582543373108, 0.05209507793188095, -0.1436554491519928, -0.11591406911611557, -0.5247759819030762, 0.8874136805534363, 0.6217105984687805, 0.6846871376037598, -0.5680668354034424, 0.2803124785423279, ...
func (kv *KVServer) Kill() { atomic.StoreInt32(&kv.dead, 1) kv.rf.Kill() // Your code here, if desired. }
[ -0.980171799659729, -0.308401495218277, 0.5643930435180664, 2.00580096244812, 0.04361317679286003, 0.7515636682510376, -0.45025065541267395, 0.2655787467956543, -0.05385712534189224, 0.18028749525547028, -0.26055073738098145, 0.0663442462682724, -0.3750743865966797, 0.3821752369403839, 0...
func StartKVServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persister, maxraftstate int) *KVServer { DPrintf("[InitKVServer---]Server %d",me) // call labgob.Register on structures you want // Go's RPC library to marshall/unmarshall. labgob.Register(Op{}) kv := new(KVServer) kv.me = me kv.maxraftstat...
[ 0.20983314514160156, -0.3206421434879303, 0.6266406178474426, 0.5419716835021973, -0.3045872747898102, 0.333118200302124, -0.07269323617219925, -0.01600588671863079, 0.5311093330383301, -0.3640759587287903, 0.031043972820043564, 0.14711032807826996, -0.4756765067577362, 0.5495014786720276,...
func (r *ReconcileLinstorController) reconcileLinstorControllerDatabaseBackup(ctx context.Context, controllerResource *piraeusv1.LinstorController) error { log := r.log.WithValues( "name", controllerResource.Name, "namespace", controllerResource.Namespace, "spec", fmt.Sprintf("%+v", controllerResource.Spec), ) ...
[ 0.05887793377041817, -0.6828775405883789, 0.9399420022964478, -0.576690137386322, 0.5013498663902283, -0.002283034846186638, 0.1892411708831787, 0.10994631797075272, -0.14331412315368652, 0.560721218585968, 0.3624451458454132, -0.4980296194553375, -0.7372471690177917, -0.0712408721446991, ...
func collectLinstorDatabase(ctx context.Context, dynClient dynamic.Interface, crds []*unstructured.Unstructured, log logr.Logger) (*bytes.Buffer, error) { buffer := &bytes.Buffer{} compressionWriter, err := gzip.NewWriterLevel(buffer, gzip.BestCompression) if err != nil { return nil, fmt.Errorf("failed to create ...
[ 0.0669340044260025, -0.5753337144851685, 0.6211236715316772, -0.4322969615459442, 0.4373912513256073, -0.1498710960149765, 0.004410121589899063, 0.052073538303375244, 0.2332821488380432, 0.26619473099708557, 0.46219316124916077, 0.161650612950325, -0.2791946530342102, 0.9395062327384949, ...
func getLinstorCRDs(ctx context.Context, dynClient dynamic.Interface) ([]*unstructured.Unstructured, error) { res := schema.GroupVersionResource{Group: "apiextensions.k8s.io", Resource: "customresourcedefinitions", Version: "v1"} crds, err := dynClient.Resource(res).List(ctx, metav1.ListOptions{}) if err != nil { ...
[ 0.0476013645529747, -0.25306540727615356, 0.29444649815559387, -1.1400622129440308, -0.04121894761919975, -0.006347703281790018, -1.1166167259216309, -0.05128542333841324, -0.037155695259571075, 0.13664646446704865, 0.1607331931591034, 1.4055944681167603, -1.1594101190567017, 0.23122397065...
func getResourcesForCrd(ctx context.Context, dynClient dynamic.Interface, crd *unstructured.Unstructured, log logr.Logger) ([]byte, error) { versions := getList(crd.Object, "spec", "versions") if len(versions) == 0 { log.V(INFO).Info("crd has no version, skipping", "crd", crd.GetName()) return nil, nil } grou...
[ -0.49128425121307373, -0.09572156518697739, 0.4042651951313019, -0.6636623740196228, -0.22883430123329163, -0.5255054831504822, -0.247978076338768, -0.4640668034553528, -0.22206486761569977, 0.7888349294662476, 0.009415987879037857, 0.29563015699386597, -0.22388505935668945, 0.579733192920...
func getBackupMetadata(controllerResource *piraeusv1.LinstorController, previousVersion string) *metav1.ObjectMeta { id := previousVersion + "-" + controllerResource.Spec.ControllerImage sum := sha256.Sum256([]byte(id)) digest := hex.EncodeToString(sum[:]) backupName := fmt.Sprintf("linstor-backup-%s", digest)[:63...
[ -0.10642271488904953, -0.8594294786453247, 0.8646389245986938, -0.5059381723403931, -0.22066685557365417, 0.394431471824646, -0.5769953727722168, -0.3378017246723175, 0.35650327801704407, 1.1663471460342407, -0.7817425727844238, 0.19661179184913635, 0.2565760314464569, -0.7309805154800415,...
func ToCleanedK8sResourceYAML(obj Resource) ([]byte, error) { raw, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) if err != nil { return nil, fmt.Errorf("failed to convert object to unstructured object: %w", err) } // No need to store the status delete(raw, "status") metadata := map[string]in...
[ -0.34224480390548706, -0.5260704159736633, 0.8567405343055725, -0.8093007206916809, -0.529046893119812, -0.14363695681095123, -0.4575738310813904, -0.8727022409439087, 0.6605959534645081, 0.7653038501739502, -0.6510242819786072, 0.8497802019119263, 0.8043524026870728, 0.496572881937027, ...
func getPreviousDeployment(ctx context.Context, clientset kubernetes.Interface, controllerResource *piraeusv1.LinstorController, log logr.Logger) (string, error) { log = log.WithValues( "name", controllerResource.Name, "namespace", controllerResource.Namespace, ) meta := getObjectMeta(controllerResource, "%s-co...
[ -0.08712053298950195, -0.40340977907180786, 0.9083949327468872, -1.1717827320098877, -0.2557353079319, -0.24800534546375275, 0.5535896420478821, -0.5645519495010376, 0.7138106226921082, 0.5351120829582214, 0.5143904089927673, 0.25013798475265503, 0.0665699914097786, 0.8176649808883667, 0...
func stopDeployment(ctx context.Context, clientset kubernetes.Interface, controllerResource *piraeusv1.LinstorController, log logr.Logger) error { meta := getObjectMeta(controllerResource, "%s-controller") _, err := clientset.AppsV1().Deployments(meta.Namespace).UpdateScale(ctx, meta.Name, &autoscalingv1.Scale{ Ob...
[ -0.6027615666389465, -0.9531101584434509, 0.7672128677368164, -1.4408271312713623, 0.2879156470298767, -0.15854696929454803, 0.17852939665317535, -0.5000020861625671, -0.5268333554267883, 0.7260298728942871, -0.04879895597696304, 0.07212889939546585, 0.16128696501255035, 0.0820389464497566...
func New(dir, parent string) (vcs *VCS, err error) { // Clean and double-check that dir is in (a subdirectory of) srcRoot. dir = filepath.Clean(dir) srcRoot := filepath.Clean(parent) if len(dir) <= len(srcRoot) || dir[len(srcRoot)] != filepath.Separator { return nil, fmt.Errorf( "directory %q is outside source...
[ -0.26728349924087524, 0.01167595200240612, 0.4391079843044281, -0.05886128172278404, -0.7524640560150146, -1.0800764560699463, 0.009356863796710968, -1.189874529838562, -0.033921610563993454, 0.14660987257957458, 0.4925040006637573, 0.18585826456546783, 0.5595903396606445, 0.60286241769790...
func (v *VCS) CommitHash() (string, error) { if v.commit == "" { return "", fmt.Errorf("%s is not yet supported", v.name) } args := strings.Split(v.commit, " ") cmd := exec.Command(v.cmd, args...) cmd.Dir = v.Root output, err := cmd.Output() if err != nil { return "", err } return strings.Trim(string(outpu...
[ 0.5771459341049194, -0.31211262941360474, 0.9382579326629639, 0.790956437587738, -0.4131610691547394, 0.5463032126426697, 0.164654940366745, -0.3129131495952606, -0.32669001817703247, 0.7126395106315613, 0.48145440220832825, 0.5347418785095215, -0.9431672692298889, -0.026751812547445297, ...
func (v *VCS) Checkout(hash string) error { if v.checkout == "" { return fmt.Errorf("%s is not yet supported", v.name) } current, err := v.CommitHash() if err != nil { return err } if current == hash { return nil } args := strings.Split(v.checkout, " ") args = append(args, hash) return execute(v.Root, v...
[ 0.8643109798431396, 0.4142122268676758, 0.5890871286392212, 0.8669538497924805, -0.1225789338350296, -0.4548231065273285, -0.5402161478996277, 0.36499887704849243, 0.21106228232383728, 0.8682299852371216, 0.43140923976898193, 0.3193064332008362, -0.9994629621505737, 0.24646197259426117, ...
func (v *VCS) Fetch() error { if v.fetch == "" { return fmt.Errorf("%s is not yet supported", v.name) } args := strings.Split(v.fetch, " ") return execute(v.Root, v.cmd, args...) }
[ 0.4100324511528015, -0.15792779624462128, 0.29788172245025635, 0.43677252531051636, -0.2357017993927002, -0.39776596426963806, -1.2783440351486206, -0.5860844850540161, 0.014282825402915478, 0.050243303179740906, 0.20828045904636383, 0.6135849356651306, 0.20559218525886536, 0.6755297780036...
func (v *VCS) Latest() error { if v.pull == "" { return fmt.Errorf("%s is not yet supported", v.name) } if v.cmd == "git" { err := execute(v.Root, "git", "checkout", "master") if err != nil { return err } } args := strings.Split(v.pull, " ") return execute(v.Root, v.cmd, args...) }
[ -0.44113919138908386, 0.04892750456929207, 0.35509583353996277, -0.2880066931247711, 0.33459457755088806, -0.7882881164550781, -0.7089100480079651, 0.15143129229545593, -0.4213114082813263, 0.06467785686254501, -0.06701759994029999, -0.1320660561323166, -0.15005312860012054, -0.17803637683...
func execute(cwd, command string, args ...string) error { cmd := exec.Command(command, args...) if cwd != "" { cmd.Dir = cwd } errpipe, err := cmd.StderrPipe() if err != nil { return err } err = cmd.Start() if err != nil { return err } errout, err := ioutil.ReadAll(errpipe) if err != nil { return err...
[ -0.06751290708780289, -0.07419197261333466, 1.0774614810943604, 0.2385021448135376, 0.4029128849506378, 0.2789158225059509, -0.36912187933921814, 0.7003692984580994, -0.6429657340049744, 0.6941627264022827, 0.3961038887500763, -0.14328740537166595, -0.06285252422094345, 0.11025498062372208...
func New(c *config.Config) *DAL { opts := &pg.Options{ Addr: c.PostgresHost + ":" + c.PostgresPort, User: c.PostgresUser, Password: c.PostgresPass, Database: c.PostgresDatabase, MaxRetries: 10, MinRetryBackoff: time.Second, MaxRetryBackoff: time.Second * 10, } ...
[ 0.09343617409467697, 0.06440138816833496, 0.4698426127433777, -0.3320249319076538, -0.2692393362522125, 0.516321063041687, -0.6838591694831848, 0.3053196370601654, -0.31320661306381226, 0.2567531168460846, 0.26144564151763916, 1.0315191745758057, -0.0532010979950428, -0.3133067190647125, ...
func (dal *DAL) Ping() error { i := 0 _, err := dal.db.QueryOne(pg.Scan(&i), "SELECT 1") return err }
[ -0.7390231490135193, 1.5301344394683838, 0.4192471504211426, 0.730625569820404, 0.7427380681037903, 0.22279474139213562, -0.000987866660580039, 0.508832573890686, -0.2998668849468231, 0.698981761932373, 0.6010113954544067, -0.46906840801239014, -0.1692420095205307, -0.30964335799217224, ...
func (dal *DAL) Close() error { database, ok := dal.db.(*pg.DB) if !ok { return errors.New("dal.db not of type *pg.DB") } return database.Close() }
[ -0.36465105414390564, 1.1007882356643677, 0.4749865233898163, 0.29355597496032715, -0.796285092830658, 1.2985395193099976, -0.38157787919044495, -0.79531329870224, 0.02849310263991356, -0.011916963383555412, 1.040655493736267, 0.23392698168754578, -0.5192237496376038, 0.5875534415245056, ...
func recordLabelsForMetric(metricName string, promLabels map[string]string, observedMetricLabels map[string]model.LabelSet) map[string]model.LabelSet { if _, ok := observedMetricLabels[metricName]; !ok { observedMetricLabels[metricName] = make(model.LabelSet) } for label := range promLabels { if _, ok := observe...
[ -0.24397093057632446, 0.5210047364234924, 0.4370865821838379, -0.4564385712146759, -0.08608274906873703, 0.3446672260761261, -0.5864259004592896, -1.237512230873108, -1.4156219959259033, 0.9709593653678894, 0.9174902439117432, 0.22719740867614746, -0.2676234245300293, 0.2166234701871872, ...
func EnsureLabelConsistencyForMetrics(metrics []*PrometheusMetric, observedMetricLabels map[string]model.LabelSet) []*PrometheusMetric { for _, prometheusMetric := range metrics { for observedLabel := range observedMetricLabels[*prometheusMetric.Name] { if _, ok := prometheusMetric.Labels[observedLabel]; !ok { ...
[ -0.1544649600982666, -0.3121521770954132, 0.5078877806663513, -0.7040274739265442, 1.0906283855438232, 1.5041260719299316, -0.5926180481910706, -0.6395261883735657, -0.7112104892730713, 1.1584789752960205, 1.104284405708313, -0.07001573592424393, -0.8160055875778198, 0.12731099128723145, ...
func (m Service) GetCollection() string { return ServiceCollectionName }
[ -0.2283685803413391, -0.16814477741718292, 0.493446946144104, 0.07900817692279816, -0.26125797629356384, 0.38935673236846924, 0.32830360531806946, -1.1178693771362305, -0.3698699474334717, -0.23938901722431183, 0.9234781861305237, 0.422273725271225, 0.28661802411079407, 1.5009881258010864,...