text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (o *StorageHitachiPortAllOf) SetTcpMtu(v int64) {
o.TcpMtu = &v
} | [
-0.7602434754371643,
0.512275755405426,
-0.0859365314245224,
-1.2169922590255737,
0.450746089220047,
-0.6251795887947083,
-0.3255663812160492,
-0.5080669522285461,
0.0675879418849945,
-0.27395254373550415,
0.23738081753253937,
-0.12661752104759216,
-0.6380106210708618,
-0.12088193744421005... |
func (o *StorageHitachiPortAllOf) GetArray() StorageHitachiArrayRelationship {
if o == nil || o.Array == nil {
var ret StorageHitachiArrayRelationship
return ret
}
return *o.Array
} | [
0.48970985412597656,
0.30839619040489197,
0.3742167055606842,
1.1498252153396606,
1.0249568223953247,
-0.43405112624168396,
0.40592697262763977,
-0.6122252345085144,
1.0748846530914307,
-0.7914687395095825,
0.2354041337966919,
-0.5513784289360046,
-0.7199524641036987,
0.6116178631782532,
... |
func (o *StorageHitachiPortAllOf) GetArrayOk() (*StorageHitachiArrayRelationship, bool) {
if o == nil || o.Array == nil {
return nil, false
}
return o.Array, true
} | [
0.30322787165641785,
-0.5741021633148193,
0.3960403501987457,
0.6702916622161865,
0.5624509453773499,
0.008582878857851028,
-0.03729058429598808,
0.44256076216697693,
0.07033449411392212,
0.7013357877731323,
-0.5972888469696045,
0.2411830574274063,
0.05078788101673126,
0.5631461143493652,
... |
func (o *StorageHitachiPortAllOf) HasArray() bool {
if o != nil && o.Array != nil {
return true
}
return false
} | [
0.4208037257194519,
-0.21394512057304382,
0.23430216312408447,
0.4729728400707245,
0.8135941028594971,
-0.30659520626068115,
-0.29175621271133423,
0.28503432869911194,
0.26662173867225647,
-1.0834505558013916,
-0.14931419491767883,
-0.7301832437515259,
-0.4920966923236847,
0.92345875501632... |
func (o *StorageHitachiPortAllOf) SetArray(v StorageHitachiArrayRelationship) {
o.Array = &v
} | [
0.36768874526023865,
0.30079030990600586,
-0.06891857087612152,
0.36896780133247375,
0.7456173896789551,
-0.5321980714797974,
-0.8155326247215271,
-0.944564938545227,
0.47551676630973816,
-0.28184106945991516,
0.4959210753440857,
0.5568313598632812,
-0.19762256741523743,
-0.198334351181983... |
func (o *StorageHitachiPortAllOf) GetRegisteredDevice() AssetDeviceRegistrationRelationship {
if o == nil || o.RegisteredDevice == nil {
var ret AssetDeviceRegistrationRelationship
return ret
}
return *o.RegisteredDevice
} | [
-0.11939755082130432,
1.6527628898620605,
0.17887337505817413,
0.8764201402664185,
0.6861632466316223,
-0.8042780160903931,
1.0018459558486938,
-0.14965806901454926,
0.7920238971710205,
-1.0068899393081665,
0.11519654840230942,
-0.29495248198509216,
-0.6984885334968567,
0.7926062345504761,... |
func (o *StorageHitachiPortAllOf) GetRegisteredDeviceOk() (*AssetDeviceRegistrationRelationship, bool) {
if o == nil || o.RegisteredDevice == nil {
return nil, false
}
return o.RegisteredDevice, true
} | [
-0.5886748433113098,
1.0796318054199219,
0.24945801496505737,
0.7635132670402527,
0.13295213878154755,
-0.03905915841460228,
1.518058180809021,
0.5203723311424255,
0.4238711893558502,
0.5401740074157715,
-0.3760071396827698,
-0.13395899534225464,
0.17953240871429443,
1.0282371044158936,
... |
func (o *StorageHitachiPortAllOf) HasRegisteredDevice() bool {
if o != nil && o.RegisteredDevice != nil {
return true
}
return false
} | [
-0.037742529064416885,
1.7622462511062622,
0.13378721475601196,
0.46733275055885315,
1.184068202972412,
-0.8124323487281799,
0.7216193079948425,
0.8158984780311584,
0.19244098663330078,
-0.9880045056343079,
-0.33976033329963684,
-0.5137773752212524,
0.2036808282136917,
1.3780118227005005,
... |
func (o *StorageHitachiPortAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {
o.RegisteredDevice = &v
} | [
0.017982741817831993,
1.492634892463684,
0.002735089510679245,
0.16039709746837616,
0.44752606749534607,
-0.50041264295578,
0.6007968783378601,
-0.4928290545940399,
0.2454928159713745,
-0.599551796913147,
0.37647444009780884,
0.7048446536064148,
0.051508497446775436,
0.23121796548366547,
... |
func NewPutAccountAppsAppIDDevicesDeviceTokenParams() *PutAccountAppsAppIDDevicesDeviceTokenParams {
var ()
return &PutAccountAppsAppIDDevicesDeviceTokenParams{
timeout: cr.DefaultTimeout,
}
} | [
0.10091761499643326,
0.19406981766223907,
-0.012732782401144505,
0.12298551946878433,
-0.8780245780944824,
-0.20441778004169464,
0.3647803068161011,
0.09079653769731522,
0.18210358917713165,
0.33319324254989624,
0.12387751042842865,
0.19235146045684814,
0.4087958335876465,
-0.5229962468147... |
func NewPutAccountAppsAppIDDevicesDeviceTokenParamsWithTimeout(timeout time.Duration) *PutAccountAppsAppIDDevicesDeviceTokenParams {
var ()
return &PutAccountAppsAppIDDevicesDeviceTokenParams{
timeout: timeout,
}
} | [
0.7422384023666382,
0.1373380720615387,
0.210290789604187,
0.06775659322738647,
-1.0544188022613525,
0.30233335494995117,
-0.18230405449867249,
0.07934825867414474,
0.24872742593288422,
1.166027545928955,
0.30747780203819275,
0.47605767846107483,
0.280429869890213,
-0.3671875596046448,
0... |
func (o *PutAccountAppsAppIDDevicesDeviceTokenParams) WithAuthorization(Authorization string) *PutAccountAppsAppIDDevicesDeviceTokenParams {
o.Authorization = Authorization
return o
} | [
-0.43496814370155334,
0.8222536444664001,
0.003089605364948511,
0.09895826876163483,
-0.7444641590118408,
-0.8676515221595764,
0.5986818671226501,
-0.3000677824020386,
0.9449533224105835,
0.7548292279243469,
0.32853999733924866,
-0.08098943531513214,
1.050824522972107,
-0.20592696964740753... |
func (o *PutAccountAppsAppIDDevicesDeviceTokenParams) WithAppID(AppID string) *PutAccountAppsAppIDDevicesDeviceTokenParams {
o.AppID = AppID
return o
} | [
0.525870680809021,
0.07790413498878479,
0.1182689443230629,
-0.472136914730072,
-0.748343825340271,
0.2437826246023178,
-0.17997922003269196,
-0.8205527663230896,
1.302762746810913,
1.0206137895584106,
0.5816850066184998,
-0.3372935652732849,
0.9231209754943848,
0.25651198625564575,
0.22... |
func (o *PutAccountAppsAppIDDevicesDeviceTokenParams) WithData(Data *models_secure.AccountsDeviceUpsertBody) *PutAccountAppsAppIDDevicesDeviceTokenParams {
o.Data = Data
return o
} | [
-0.13503925502300262,
0.3560478091239929,
0.010792787186801434,
-0.6906341314315796,
-0.5484386682510376,
0.4013231098651886,
0.28771063685417175,
-0.4745635986328125,
0.4764295220375061,
-0.15688155591487885,
0.5269498825073242,
-0.2163022756576538,
1.1329028606414795,
-0.2057311087846756... |
func (o *PutAccountAppsAppIDDevicesDeviceTokenParams) WithDeviceToken(DeviceToken string) *PutAccountAppsAppIDDevicesDeviceTokenParams {
o.DeviceToken = DeviceToken
return o
} | [
-0.2824895977973938,
0.32578280568122864,
0.08758598566055298,
-0.6370697617530823,
-0.7866076827049255,
-0.01162803266197443,
0.6792588233947754,
-0.09045995771884918,
0.984760582447052,
0.05286373943090439,
-0.169315367937088,
0.15440592169761658,
0.9137028455734253,
-0.2189941108226776,... |
func (o *PutAccountAppsAppIDDevicesDeviceTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// header param Authorization
if err := r.SetHeaderParam("Authorization", o.Authorization); err != nil {
return err
}
// path param app_id
if err... | [
-0.9016568064689636,
0.18733762204647064,
0.6587008237838745,
-0.6610320806503296,
0.4035029411315918,
-0.19528760015964508,
0.6390895247459412,
-0.6009924411773682,
-0.12481142580509186,
0.22907231748104095,
0.3005998432636261,
0.011796113103628159,
0.10217232257127762,
0.0811338275671005... |
func parse(eventType, prefix string) (string, string, string, error) {
if !strings.HasPrefix(eventType, prefix) {
return "", "", "", errors.New(fmt.Sprintf("failed to parse event-type [%s], prefix not found [%s]", eventType, prefix))
}
// remove the event-type prefix
eventTypeWithoutPrefix := strings.ReplaceAll(... | [
0.2791324257850647,
-0.7401453256607056,
0.9048956036567688,
-0.09968306124210358,
-0.6308489441871643,
-0.33551621437072754,
-0.39292117953300476,
0.11364235728979111,
-0.3962709307670593,
0.9195826053619385,
-0.5478087067604065,
0.11756054311990738,
-0.10942960530519485,
-0.1589916050434... |
func Default(ctx *cli.Context) {
if ctx.Command.Name == "help" {
args := []string{"akamai"}
args = append(args, ctx.Args().Slice()...)
args = append(args, "--"+cli.BashCompletionFlag.Names()[0])
if err := ctx.App.RunContext(ctx.Context, args); err != nil {
fmt.Fprintln(ctx.App.ErrWriter, err.Error())
}
... | [
0.5290731191635132,
0.12641692161560059,
0.9861983060836792,
0.3450084328651428,
0.27561867237091064,
0.12447305023670197,
0.24650992453098297,
-0.14500939846038818,
-0.6044398546218872,
0.08909309655427933,
0.06279519200325012,
0.5293715596199036,
0.24300631880760193,
1.0787420272827148,
... |
func NewConfig(file string) Config {
f, err := os.Open(file)
if err != nil {
log.Fatal(err)
}
var cfg Config
decoder := yaml.NewDecoder(f)
err = decoder.Decode(&cfg)
if err != nil {
log.Fatal(err)
}
return cfg
} | [
0.7994561791419983,
-1.0299382209777832,
0.5216265320777893,
-0.03620697930455208,
-0.9358134865760803,
0.10141854733228683,
-0.22549329698085785,
1.7929906845092773,
-0.9803169965744019,
0.3066976070404053,
-0.4899071455001831,
0.12449877709150314,
0.3866015076637268,
0.5067997574806213,
... |
func (_m *Notifier) Alert(message string) {
_m.Called(message)
} | [
-0.0599568672478199,
0.4621932804584503,
0.18255138397216797,
0.23594702780246735,
-0.006272539030760527,
0.013288510963320732,
1.156397819519043,
0.25328874588012695,
-0.729762852191925,
0.5597248077392578,
0.37908968329429626,
0.7491536736488342,
0.23893101513385773,
0.7997034192085266,
... |
func (_m *Notifier) Info(message string) {
_m.Called(message)
} | [
-0.15150359272956848,
0.30130916833877563,
0.24393802881240845,
0.6979711651802063,
0.11560780555009842,
0.03891098499298096,
0.9592527747154236,
-0.0009080508607439697,
-1.3723340034484863,
0.4992434084415436,
-0.24628838896751404,
0.3895096778869629,
0.5617172718048096,
1.122678518295288... |
func (_m *Notifier) Status(message string) {
_m.Called(message)
} | [
-0.749424159526825,
-0.18694546818733215,
0.05298139899969101,
0.4447707235813141,
-0.17467382550239563,
0.21201403439044952,
0.7321709394454956,
1.0868749618530273,
-0.4363346993923187,
0.26117637753486633,
-0.4563647508621216,
0.9106378555297852,
0.11394637078046799,
1.225374698638916,
... |
func Check(err error) {
if err != nil {
panic(err)
}
} | [
0.9076279997825623,
0.3895120620727539,
-0.00933310016989708,
1.6255722045898438,
-0.009953747503459454,
0.42037415504455566,
-0.4049481749534607,
0.15466098487377167,
0.46837079524993896,
0.12247966974973679,
0.17285889387130737,
0.4687558114528656,
0.4242030084133148,
1.6115363836288452,... |
func main() {
db, err := sql.Open("sqlite3", "./foo.db")
checkErr(err)
createStr := `CREATE TABLE IF NOT EXISTS userinfo (
uid INTEGER PRIMARY KEY AUTOINCREMENT,
username VARCHAR(64) NULL,
department_name VARCHAR(64) NULL,
created DATE NULL
);`
stmt, err := db.Prepare(createStr)... | [
-0.022126618772745132,
-0.14761784672737122,
0.9858007431030273,
0.1342545747756958,
-0.38603124022483826,
0.9089046120643616,
0.4414549767971039,
-0.3806767463684082,
-0.04801541194319725,
-0.5050083994865417,
-0.09856805950403214,
-0.3393319249153137,
-0.39826279878616333,
0.428699165582... |
func Convolve(src, dst []float64, kernel []float64, border Border) {
width := len(kernel)
halfWidth := width / 2
for i := range dst {
k := i - halfWidth
var sum float64
if k >= 0 && k <= len(src)-width {
for j, x := range kernel {
sum += src[k+j] * x
}
} else {
for j, x := range kernel {
sum... | [
0.8655468821525574,
0.9706544876098633,
0.9077794551849365,
0.6162400841712952,
-0.3124106526374817,
-0.383991539478302,
-0.4779956638813019,
0.1001984104514122,
-0.2533416152000427,
0.6720295548439026,
-0.46819964051246643,
0.4853956401348114,
0.19277627766132355,
0.4905743896961212,
-0... |
func BoxFilter(src, dst []float64, width int, border Border) {
// TODO optimize
alpha := 1.0 / float64(width)
kernel := make([]float64, width)
for i := range kernel {
kernel[i] = alpha
}
Convolve(src, dst, kernel, border)
} | [
0.197293221950531,
1.0410138368606567,
0.6051866412162781,
0.5216271281242371,
-0.6206195950508118,
-0.19798263907432556,
-0.800064742565155,
-0.009216669015586376,
0.035504527390003204,
0.2712310552597046,
-0.3912123739719391,
0.4803406000137329,
0.2817012667655945,
1.4119830131530762,
... |
func GaussianKernel(dst []float64, sigma float64) {
var sum float64
scale := -1.0 / (2 * sigma * sigma)
for i := range dst {
x := float64(i - (len(dst)-1)/2)
t := math.Exp(x * x * scale)
dst[i] = t
sum += t
}
alpha := 1 / sum
for i := range dst {
dst[i] *= alpha
}
} | [
-0.7933995723724365,
0.11231586337089539,
0.5343297123908997,
0.4700680375099182,
-0.9849233627319336,
0.1688293218612671,
0.3144287168979645,
0.6657363772392273,
-0.2929658591747284,
1.4045097827911377,
-0.43760940432548523,
0.6695166230201721,
0.4788236916065216,
0.4031013548374176,
-0... |
func GaussianFilter(src, dst []float64, width int, sigma float64, border Border) {
if width <= 0 {
width = 1 + 2*int(math.Floor(sigma*4+0.5))
}
kernel := make([]float64, width)
GaussianKernel(kernel, sigma)
Convolve(src, dst, kernel, border)
} | [
-0.19048093259334564,
0.5991467833518982,
0.5060091614723206,
0.7867763638496399,
-0.6749995350837708,
0.18171046674251556,
-0.14909711480140686,
0.08645301312208176,
0.20685000717639923,
0.3900209367275238,
0.010423672385513783,
0.9408876299858093,
-0.04806831106543541,
0.6575633883476257... |
func Gradient(src, dst []float64) {
n := len(src)
if n == 0 {
return
}
if n == 1 {
dst[0] = 0
return
}
dst[0] = src[1] - src[0]
for i := 1; i < n-1; i++ {
dst[i] = 0.5 * (src[i+1] - src[i-1])
}
dst[n-1] = src[n-1] - src[n-2]
} | [
-1.0730817317962646,
1.1414331197738647,
0.6661727428436279,
0.02643839456140995,
-0.17423702776432037,
0.13848920166492462,
0.5911299586296082,
0.43450745940208435,
-0.6766048669815063,
1.0190730094909668,
-0.8692911267280579,
0.7139115929603577,
-0.47510287165641785,
0.3143106698989868,
... |
func (g Coords) Distance() float64 {
// * removed returned variable
return math.Sqrt(math.Pow(g.X2-g.X1, 2) + math.Pow(g.Y2-g.Y1, 2))
} | [
0.03139163926243782,
-0.429495245218277,
0.29962730407714844,
0.3490895628929138,
-0.5128514170646667,
0.9801362752914429,
0.41349226236343384,
-0.22787515819072723,
0.022395243868231773,
0.45374348759651184,
-0.18142974376678467,
-0.056200060993433,
-0.3693886995315552,
-0.226369336247444... |
func (m BooksModel) Insert(books *Books) error {
query := `INSERT INTO books (title, year, pages)
VALUES ($1, $2, $3)
RETURNING id, created_at, version`
args := []interface{}{books.Title, books.Year, books.Pages}
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
return... | [
-1.2253674268722534,
0.551112949848175,
0.3704342246055603,
0.6576700210571289,
0.15282781422138214,
0.7196438312530518,
-0.30968645215034485,
-0.026064714416861534,
-1.021254301071167,
0.6044426560401917,
-0.4996420443058014,
-1.1976726055145264,
-1.3060938119888306,
0.19016101956367493,
... |
func (m BooksModel) Get(id int64) (*Books, error) {
if id < 1 {
return nil, ErrRecordNotFound
}
query := `SELECT id, created_at, title, year, pages, version
FROM comics
WHERE id = $1`
var books Books
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
err := m.DB.Que... | [
-0.7625800967216492,
0.009044141508638859,
0.5314655900001526,
0.006365477107465267,
0.5068826675415039,
-0.10134810209274292,
-0.7638888955116272,
-0.3947468101978302,
-0.5827105045318604,
-0.1939517855644226,
0.45056673884391785,
-0.053085219115018845,
-0.35668569803237915,
0.19717033207... |
func (m BooksModel) Update(books *Books) error {
query := `UPDATE books
SET title = $1, year = $2, pages = $3, version = version + 1
WHERE id = $4 AND version = $5
RETURNING version`
args := []interface{}{
books.Title,
books.Year,
books.Pages,
books.ID,
books.Version,
}
ctx, cancel := context.Wi... | [
-1.2024452686309814,
-0.2333778291940689,
0.4553774297237396,
0.819161057472229,
-0.2092360407114029,
0.5832871794700623,
-0.4817790985107422,
-0.4549282491207123,
-0.4930814206600189,
0.9387149810791016,
0.2750459611415863,
-0.9143400192260742,
-1.1309186220169067,
0.4269600212574005,
-... |
func (m BooksModel) Delete(id int64) error {
if id < 1 {
return ErrRecordNotFound
}
query := `DELETE FROM books
WHERE id = $1`
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
result, err := m.DB.ExecContext(ctx, query, id)
if err != nil {
return err
}
rowsAffecte... | [
-0.23019151389598846,
0.5538802146911621,
0.5706809163093567,
1.0019118785858154,
0.2501175105571747,
0.45728281140327454,
0.5234771370887756,
0.03093690797686577,
-0.5678120255470276,
0.6491413712501526,
0.5420640707015991,
-0.5900921821594238,
-1.1468030214309692,
0.3350031077861786,
-... |
func (d *Config) CreateCourse(course *models.Courses) error {
return d.db.Insert(course)
} | [
-0.6995009183883667,
0.6750333309173584,
0.0984959602355957,
0.04993150010704994,
1.680635690689087,
1.3112530708312988,
-0.5271331071853638,
0.25419923663139343,
-0.3381841480731964,
0.8350435495376587,
0.08224958926439285,
-1.6987096071243286,
-0.8318868279457092,
0.9247729182243347,
0... |
func (d *Config) CreateEnrollment(courseId, studentEmail string) error {
res, err := d.db.
Query(&models.Enrollments{},
"INSERT INTO Enrollments(course_id, student_id) "+
"SELECT ?0, student.id "+
"FROM Users AS student "+
"WHERE student.email = ?1", courseId, studentEmail)
if res == nil {
return ... | [
-0.4226185381412506,
0.7922295928001404,
0.3963981568813324,
-0.30821630358695984,
0.5019468665122986,
0.9951559901237488,
0.33861207962036133,
-0.15337781608104706,
-0.2957415282726288,
0.9799904823303223,
-0.44917091727256775,
-0.4848650097846985,
-0.5176811218261719,
0.34494760632514954... |
func (d *Config) GetCourse(courseId string) (*models.GetCourseModel, error) {
getCourseModel := &models.GetCourseModel{}
res, err := d.db.
Query(getCourseModel,
"SELECT c.id, u.name as teacher_name, c.title, c.description " +
"FROM courses AS c, users AS u " +
"WHERE c.id = ? " +
"AND u.id = c.teacher_id... | [
-0.6593518257141113,
0.2545274794101715,
0.6356372237205505,
0.2452305555343628,
1.1157281398773193,
0.2983704209327698,
-0.046027421951293945,
-0.19307130575180054,
-0.08918499946594238,
0.6093584299087524,
0.3779805302619934,
-0.033046163618564606,
-0.5403444170951843,
0.5680701732635498... |
func (d *Config) GetTaughtCourses(userId string) (*[]models.Courses, error) {
taughtCourses := &[]models.Courses{}
return taughtCourses, d.db.Model(taughtCourses).
Where("teacher_id = ?", userId).
Select()
} | [
-0.35573747754096985,
0.02347482368350029,
0.3279004991054535,
-0.0835685059428215,
0.2065841108560562,
0.21455958485603333,
0.7864189743995667,
-1.0080832242965698,
-0.3797958195209503,
0.13059484958648682,
-0.729396402835846,
1.1266400814056396,
0.2576315701007843,
1.0640902519226074,
... |
func (d *Config) GetEnrolledCourses(userId string) (*[]models.Courses, error) {
enrolledCourses := &[]models.Courses{}
res, err := d.db.
Query(enrolledCourses,
"SELECT * "+
"FROM courses AS course "+
"WHERE course.id IN "+
"(SELECT course_id "+
"FROM enrollments AS enrollment "+
"WHERE enroll... | [
-0.4993192255496979,
0.3617197871208191,
0.4723987281322479,
0.09329606592655182,
-0.1811884492635727,
0.20938938856124878,
-0.02729809284210205,
-0.3769548535346985,
0.334014356136322,
0.052236877381801605,
-0.40432584285736084,
1.3503732681274414,
-0.3908853232860565,
1.2850801944732666,... |
func NewWorker(workerEvent chan *WorkerStatus, maxResponsePipeBufferSize int, command string, args ...string) *Worker {
return &Worker{
commandName: command,
args: args,
workerEvent: workerEvent,
maxResponsePipeBufferSize: maxResponsePipeBufferSize,
}
} | [
0.4907187521457672,
-0.5666724443435669,
0.49216726422309875,
-0.21447327733039856,
-0.2963476777076721,
0.370417058467865,
-0.1643749475479126,
-0.11496834456920624,
0.36205822229385376,
-0.7936546802520752,
-0.6456402540206909,
0.11737612634897232,
-0.21195416152477264,
0.382267087697982... |
func (w *Worker) GetPID() int {
if w.cmd != nil && w.cmd.Process != nil {
return w.cmd.Process.Pid
}
return -1
} | [
0.6675364375114441,
-0.589634895324707,
0.7741334438323975,
1.0294101238250732,
0.4131917357444763,
0.2803618907928467,
0.6922801733016968,
0.11705373227596283,
0.5539547801017761,
-0.8464246988296509,
0.7279667258262634,
-0.07160908728837967,
-1.130902886390686,
0.8633886575698853,
1.03... |
func (w *Worker) Start() {
w.commandsPipe = NewCommandPipe()
w.responsesPipe = NewResponsePipe(w.maxResponsePipeBufferSize)
var err error
w.cmd = exec.Command(w.commandName, w.args...)
w.responsesPipe.Register(w.cmd)
w.commandsPipe.Register(w.cmd)
ch := w.responsesPipe.Channel()
go func() {
for {
select ... | [
0.1731528341770172,
-0.8841149210929871,
0.9498801231384277,
-0.15588787198066711,
0.30623090267181396,
0.05055801570415497,
0.8303322792053223,
0.14443956315517426,
-0.300234854221344,
-0.5398225784301758,
-0.538016676902771,
0.27787870168685913,
0.43753156065940857,
0.7229399681091309,
... |
func (w *Worker) Stop() {
w.cmd.Process.Kill()
w.commandsPipe.reader.Close()
w.commandsPipe.writer.Close()
w.responsesPipe.reader.Close()
w.responsesPipe.writer.Close()
} | [
-0.29318150877952576,
-1.4346179962158203,
0.36861512064933777,
-0.36911138892173767,
0.9333524107933044,
0.395928293466568,
0.8749395608901978,
-0.29439759254455566,
-1.0788254737854004,
-0.38662847876548767,
-0.11458516865968704,
-0.5652983784675598,
-0.20548488199710846,
0.3428830206394... |
func (w *Worker) Call(taskID string, fn string, args interface{}) {
log.Print(">>>> SENDING CALL ", taskID)
js, err := json.Marshal(workerCall{
Fn: fn,
Args: args,
TaskID: taskID,
})
if err != nil {
// TODO
log.Print("ERROR: ", err)
}
w.taskID = taskID
w.commandsPipe.SendBytes(js)
} | [
-0.3176743686199188,
0.556636393070221,
0.6234978437423706,
-0.13266174495220184,
-0.24049685895442963,
0.3913581073284149,
-0.8009750843048096,
-0.49522265791893005,
-0.455886572599411,
0.4694015085697174,
-0.11141497641801834,
0.620344340801239,
0.3630288243293762,
0.5778436064720154,
... |
func (w *Worker) Reload() {
w.cmd.Process.Signal(syscall.SIGHUP)
} | [
0.19998283684253693,
0.09853783994913101,
0.46794334053993225,
0.5462601184844971,
0.9142301082611084,
1.1521451473236084,
0.5539442896842957,
-0.054341644048690796,
-0.4516657590866089,
-0.35095274448394775,
-0.5827696323394775,
-0.06075306236743927,
0.03638087585568428,
-0.02853520959615... |
func NewHealth() *Health {
const vertexShader = `
#version 410
in vec4 coord;
out vec2 tcoord;
void main(void) {
gl_Position = vec4(coord.xy, 0, 1);
tcoord = coord.zw;
}
`
const fragmentShader = `
#version 410
in vec2 tcoord;
uniform sampler2D tex;
out vec4 frag_color;
void main(void) ... | [
0.9615639448165894,
-0.9459154605865479,
0.911519467830658,
-0.2550305128097534,
-1.1013892889022827,
0.46308135986328125,
0.4354822635650635,
-0.3749280869960785,
0.10565058887004852,
-0.291420042514801,
-0.17350617051124573,
0.060027383267879486,
0.34841081500053406,
-0.1004534363746643,... |
func (h *Health) Draw(player *common.Player, w *glfw.Window) {
if player.HotbarOn {
width, height := FramebufferSize(w)
h.textureUniform = 0
h.computeGeometry(player, width, height)
gl.UseProgram(h.program)
gl.Uniform1i(h.textureUniform, h.textureUnit)
gl.BindVertexArray(h.drawableVAO)
gl.DrawArrays(gl.T... | [
0.289922297000885,
0.17183536291122437,
0.6423399448394775,
0.1170530691742897,
-0.0625942274928093,
1.2761375904083252,
0.5308480858802795,
-0.1298968642950058,
0.6834486722946167,
-0.4871117174625397,
0.044456128031015396,
0.01583200879395008,
0.06403513252735138,
1.1329028606414795,
-... |
func Advanced(t string, p []string) Result {
startTime := time.Now()
occurrences := make(map[int][]int)
ac, f := BuildExtendedAc(p)
current := 0
for pos := 0; pos < len(t); pos++ {
if GetTransition(current, t[pos], ac) != -1 {
current = GetTransition(current, t[pos], ac)
} else {
current = 0
}
_, ok ... | [
0.4053226113319397,
-0.3523761034011841,
0.9171552062034607,
-1.2892905473709106,
-1.002059817314148,
-0.6254742741584778,
0.18662786483764648,
0.3744398057460785,
-0.8801256418228149,
0.657156765460968,
0.38530784845352173,
0.045317307114601135,
0.10022307932376862,
0.4810296893119812,
... |
func BuildExtendedAc(p []string) (acToReturn map[int]map[uint8]int, f map[int][]int) {
acTrie, stateIsTerminal, f := ConstructTrie(p)
s := make([]int, len(stateIsTerminal)) //supply function
i := 0 //root of acTrie
acToReturn = acTrie
s[i] = -1
for current := 1; current < len(state... | [
-0.2825527489185333,
-0.1468404233455658,
0.6951198577880859,
-0.39724332094192505,
-0.5497118234634399,
-0.2810814082622528,
1.336343765258789,
1.1101206541061401,
0.624153196811676,
0.5203931927680969,
0.12743207812309265,
0.6323481202125549,
0.29596757888793945,
-0.28613805770874023,
... |
func NewClient(cc *gchttp.ClockifyHTTPClient) *TagClient {
tc := &TagClient{
cc: cc,
}
tc.endpoint = cc.URL
return tc
} | [
0.3978410065174103,
-0.18625058233737946,
-0.007190475706011057,
-0.5963543653488159,
0.3464329242706299,
0.4231182038784027,
-0.2669509947299957,
-0.6464670896530151,
-0.6903185248374939,
0.5671584606170654,
-0.7584426999092102,
0.4439678490161896,
-0.3131830096244812,
-0.1266616135835647... |
func (m *BootstrapMode) MarshalYAML() (interface{}, error) {
return m.String(), nil
} | [
0.5934968590736389,
-0.17858406901359558,
0.4183765649795532,
0.27491042017936707,
0.19503822922706604,
0.08538110554218292,
0.1346539407968521,
0.7476848363876343,
0.2351376861333847,
0.39417049288749695,
-0.11666887998580933,
0.33751511573791504,
0.23293018341064453,
0.014338573440909386... |
func (m *BootstrapMode) UnmarshalYAML(unmarshal func(interface{}) error) error {
var str string
if err := unmarshal(&str); err != nil {
return err
}
// If unspecified, use default mode.
if str == "" {
*m = DefaultBootstrapMode
return nil
}
for _, valid := range validBootstrapModes {
if str == valid.Str... | [
-0.14141260087490082,
0.35940486192703247,
0.6390386819839478,
0.0828772708773613,
-0.08429557085037231,
-1.1309716701507568,
0.08464077860116959,
0.5196595788002014,
-0.2374923974275589,
0.9537744522094727,
0.2243829071521759,
0.10850734263658524,
0.15163932740688324,
-0.2711556553840637,... |
func (m BootstrapMode) String() string {
switch m {
case DefaultBootstrapMode:
return "default"
case PreferPeersBootstrapMode:
return "prefer_peers"
case ExcludeCommitLogBootstrapMode:
return "exclude_commitlog"
}
return "unknown"
} | [
-0.5568010807037354,
-0.7411338686943054,
0.3256036937236786,
-0.031226299703121185,
-0.09972982853651047,
0.4548882842063904,
-0.753756582736969,
-0.8805660605430603,
-1.0126856565475464,
0.9580516815185547,
-0.11233054101467133,
0.43950313329696655,
-0.6822534203529358,
-0.23391385376453... |
func (bsc BootstrapConfiguration) VerifyOrDefault() BootstrapVerifyConfiguration {
if bsc.Verify == nil {
return BootstrapVerifyConfiguration{}
}
return *bsc.Verify
} | [
1.073486328125,
0.29971200227737427,
0.36742478609085083,
1.367449164390564,
0.7314975261688232,
-0.9673004150390625,
-0.13107441365718842,
-0.13737991452217102,
0.747826874256134,
-0.3242877721786499,
-1.0044171810150146,
-0.2695656418800354,
-1.02025306224823,
1.2054531574249268,
-0.87... |
func (c BootstrapVerifyConfiguration) VerifyIndexSegmentsOrDefault() bool {
if c.VerifyIndexSegments == nil {
return false
}
return *c.VerifyIndexSegments
} | [
-0.19696161150932312,
0.05071549490094185,
0.3366731107234955,
1.061952829360962,
1.2784451246261597,
-0.6861644387245178,
0.06095586717128754,
-0.6595685482025146,
0.9246309995651245,
-0.3276631534099579,
-1.0720670223236084,
-0.6781730055809021,
-1.634833812713623,
0.35499975085258484,
... |
func (m BootstrapMigrationConfiguration) NewOptions() migration.Options {
opts := migration.NewOptions().SetTargetMigrationVersion(m.TargetMigrationVersion)
if m.Concurrency > 0 {
opts = opts.SetConcurrency(m.Concurrency)
}
return opts
} | [
-0.4161715805530548,
-0.29928910732269287,
0.31224942207336426,
-0.1126008853316307,
0.621677815914154,
-1.162880778312683,
0.0428948700428009,
-0.10271012037992477,
0.227131187915802,
0.7608609795570374,
-0.09185931086540222,
-0.6165106296539307,
-0.6048312187194824,
0.7102863192558289,
... |
func (bsc BootstrapConfiguration) New(
rsOpts result.Options,
opts storage.Options,
topoMapProvider topology.MapProvider,
origin topology.Host,
adminClient client.AdminClient,
) (bootstrap.ProcessProvider, error) {
idxOpts := opts.IndexOptions()
compactor, err := compaction.NewCompactor(idxOpts.MetadataArrayPool... | [
-0.6154955625534058,
-0.26673823595046997,
0.6962267160415649,
0.3373042047023773,
0.02861102484166622,
-1.0564240217208862,
0.05472104251384735,
-0.5203040242195129,
0.007946060039103031,
0.21159590780735016,
0.03868575394153595,
0.16436342895030975,
0.051484134048223495,
0.37789469957351... |
func (c *connection) Channel() (amqpChannel, error) {
ch, err := c.conn.Channel()
if err != nil {
return nil, err
}
if err := ch.Confirm(wait); err != nil {
return nil, err
}
return &channel{ch}, nil
} | [
0.24730943143367767,
0.06066489219665527,
0.11143098026514053,
0.2442682385444641,
0.0926479697227478,
0.5402041077613831,
-0.19645148515701294,
-0.37428927421569824,
-0.018186897039413452,
-0.13945025205612183,
0.8640161752700806,
1.340360403060913,
-0.34041258692741394,
-0.02424539253115... |
func (ch *channel) QueueDeclareAndBind(queueName, exchangeName string) error {
q, err := ch.ch.QueueDeclare(queueName,
false, // durable
false, // delete when unused
false, // exclusive
wait,
nil) // args
if err != nil {
return err
}
return ch.ch.QueueBind(q.Name, q.Name, exchangeName, wait, nil)
} | [
0.5647827386856079,
-1.3054494857788086,
1.0525288581848145,
-0.32885512709617615,
-0.09435679018497467,
0.4770752489566803,
-0.9399830102920532,
0.3635399341583252,
0.9353108406066895,
-0.18783298134803772,
0.46297502517700195,
0.7625284194946289,
-0.006031245458871126,
1.2559491395950317... |
func (vs *ViewServer) cullDead() string {
mostRecentPing := ""
for key, element := range vs.servers {
if age := time.Since(element); age > (DeadPings * PingInterval){
if key == vs.thisView.Primary{
vs.mustReplacePrimary = true
} else if key == vs.thisView.Backup {
vs.mustReplaceBackup = true
}
d... | [
-1.0327885150909424,
-0.20010052621364594,
0.834835410118103,
-0.9053754210472107,
-0.6130418181419373,
1.0481010675430298,
0.389667809009552,
-0.09549473971128464,
1.054088830947876,
0.07016239315271378,
1.003341555595398,
0.5497152805328369,
-0.1756751537322998,
0.6651539206504822,
-0.... |
func (vs *ViewServer) replaceServers(replacement_canidate string) {
if vs.canChangeView {
//double replacement only viable if it's the first view, otherwise it's irrecoverable
if vs.mustReplacePrimary && vs.mustReplaceBackup {
if vs.thisView.Viewnum == 0 {
if replacement_canidate != "" {
vs.thisView.Pr... | [
-0.7230798602104187,
-0.08704081177711487,
0.76207435131073,
-0.31355446577072144,
-0.397066205739975,
-0.24556058645248413,
0.49638810753822327,
0.9438626170158386,
0.9658754467964172,
-0.44819018244743347,
-0.42557790875434875,
0.5731927156448364,
-0.6968119144439697,
0.9476247429847717,... |
func (vs *ViewServer) Ping(args *PingArgs, reply *PingReply) error {
vs.mu.Lock()
vs.servers[args.Me] = time.Now()
//check if I require a view update (servers might report themselves as restarted, or come back from the dead intact well after the timeout period if primary lost connection before it acked)
if args.Me ... | [
-0.7506797313690186,
-0.35868752002716064,
0.6369200348854065,
-0.4827018678188324,
0.2281891405582428,
0.2557997703552246,
0.22030091285705566,
0.09656929224729538,
0.9984405040740967,
-0.09599673002958298,
0.4860576093196869,
0.44815683364868164,
-0.6509724259376526,
0.31187087297439575,... |
func (vs *ViewServer) Get(args *GetArgs, reply *GetReply) error {
vs.mu.Lock()
reply.View = vs.thisView
vs.mu.Unlock()
return nil
} | [
-0.4570116698741913,
0.0580199658870697,
0.3810727894306183,
-0.9690350890159607,
0.6498081684112549,
-0.7475610971450806,
-0.3667890131473541,
-0.4514557123184204,
0.5859643220901489,
-0.8205037117004395,
0.026229646056890488,
1.9624183177947998,
-1.101596474647522,
-0.47446268796920776,
... |
func (vs *ViewServer) tick() {
vs.mu.Lock()
//want to cull regardless of replacement needs every PingInterval
replacementCanidate := vs.cullDead()
if vs.mustReplaceBackup || vs.mustReplacePrimary{
vs.replaceServers(replacementCanidate)
}
vs.mu.Unlock()
} | [
-0.8078928589820862,
0.4049806594848633,
0.3269050121307373,
-0.3206774592399597,
0.2897597849369049,
0.5842077732086182,
0.5700768232345581,
0.024146949872374535,
0.8514868021011353,
0.06408638507127762,
-0.0169647466391325,
0.9673445224761963,
-0.3415509760379791,
0.39261773228645325,
... |
func (vs *ViewServer) Kill() {
atomic.StoreInt32(&vs.dead, 1)
vs.l.Close()
} | [
-0.6877331733703613,
-0.12819311022758484,
0.2870924770832062,
0.39292484521865845,
-0.14158697426319122,
1.3447784185409546,
0.1284388303756714,
-0.07551854103803635,
0.3048435151576996,
0.0804714635014534,
-0.408967524766922,
0.40995872020721436,
-0.1346651315689087,
0.40582287311553955,... |
func (vs *ViewServer) isdead() bool {
return atomic.LoadInt32(&vs.dead) != 0
} | [
-1.1499907970428467,
-0.19141294062137604,
0.7717615962028503,
0.18599845468997955,
0.09548209607601166,
0.9902724623680115,
-0.05822598561644554,
-0.4376930594444275,
1.2890639305114746,
-0.5642879605293274,
-0.2876235246658325,
0.7121292352676392,
-0.7674870491027832,
0.4747336804866791,... |
func (vs *ViewServer) GetRPCCount() int32 {
return atomic.LoadInt32(&vs.rpccount)
} | [
0.5164125561714172,
0.6910303831100464,
0.7065533995628357,
-0.6385364532470703,
0.5589120388031006,
-0.2709119915962219,
0.812584638595581,
-0.29590779542922974,
0.3560660779476166,
-0.5466600060462952,
-0.28104737401008606,
0.7899793982505798,
-1.0968945026397705,
0.23249535262584686,
... |
func NewGetAccountsListOK() *GetAccountsListOK {
return &GetAccountsListOK{}
} | [
0.8958780765533447,
-0.08966585993766785,
0.32206350564956665,
0.6189010143280029,
-0.44348299503326416,
-1.0284435749053955,
0.46332430839538574,
0.27924126386642456,
0.19211263954639435,
-0.6520150303840637,
-0.3820905387401581,
0.6000455617904663,
0.6800515055656433,
-0.5431264638900757... |
func (o *GetAccountsListOK) WithXTotalCount(xTotalCount int64) *GetAccountsListOK {
o.XTotalCount = xTotalCount
return o
} | [
1.0329500436782837,
-0.019767209887504578,
0.3941630721092224,
-0.4671373665332794,
-0.7693421840667725,
-0.5545267462730408,
0.008024195209145546,
-0.2733187675476074,
0.7072827816009521,
0.4617103636264801,
-0.42825421690940857,
-0.476408451795578,
1.0350836515426636,
-0.6778445243835449... |
func (o *GetAccountsListOK) SetXTotalCount(xTotalCount int64) {
o.XTotalCount = xTotalCount
} | [
0.4086211621761322,
0.23448710143566132,
0.30387023091316223,
-0.9350169897079468,
-0.6006069183349609,
-0.21813833713531494,
0.3204878270626068,
-0.4801298975944519,
0.18996663391590118,
0.5608788132667542,
-0.5641592144966125,
-0.39935776591300964,
0.5797144770622253,
-0.8084631562232971... |
func (o *GetAccountsListOK) WithPayload(payload []*models.AccountsRow) *GetAccountsListOK {
o.Payload = payload
return o
} | [
1.2265936136245728,
0.4058997929096222,
0.10160581767559052,
0.19446095824241638,
-0.4924095571041107,
-1.0076593160629272,
0.41232550144195557,
-0.448834627866745,
1.064284324645996,
-0.4756186306476593,
0.48355501890182495,
-0.08660884201526642,
1.1693778038024902,
-0.32265788316726685,
... |
func (o *GetAccountsListOK) SetPayload(payload []*models.AccountsRow) {
o.Payload = payload
} | [
0.6157712936401367,
0.8697437047958374,
0.08800284564495087,
0.25439751148223877,
-0.1405172049999237,
-0.4639977216720581,
0.2554241716861725,
-0.5070305466651917,
0.6255815625190735,
-0.2893601953983307,
0.25010189414024353,
-0.001122280489653349,
0.6915562152862549,
0.03602800518274307,... |
func (o *GetAccountsListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
// response header X-Total-Count
xTotalCount := swag.FormatInt64(o.XTotalCount)
if xTotalCount != "" {
rw.Header().Set("X-Total-Count", xTotalCount)
}
rw.WriteHeader(200)
payload := o.Payload
if payload == nil {
... | [
-0.3556784689426422,
0.1423899233341217,
0.4199448227882385,
0.3915800452232361,
0.32723507285118103,
-1.033837080001831,
0.7990482449531555,
-0.38592034578323364,
0.6502583622932434,
0.28122007846832275,
0.32742640376091003,
-0.6692113876342773,
0.25706422328948975,
-0.27272069454193115,
... |
func NewGetAccountsListBadRequest() *GetAccountsListBadRequest {
return &GetAccountsListBadRequest{}
} | [
-0.8148804903030396,
-0.3565792739391327,
0.4284203350543976,
0.8555716872215271,
0.01289973221719265,
-0.5475325584411621,
-0.8910766839981079,
0.47570252418518066,
0.3685162365436554,
-0.5911906361579895,
-0.4638562500476837,
0.07147088646888733,
-0.5830570459365845,
0.2908865511417389,
... |
func (o *GetAccountsListBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(400)
} | [
-0.4246463477611542,
-1.014035940170288,
0.45989882946014404,
0.29917997121810913,
1.0720584392547607,
-0.5646155476570129,
-0.3513222336769104,
-0.5686904191970825,
0.8702327013015747,
-0.19331063330173492,
0.48823079466819763,
0.21785207092761993,
-0.7041134834289551,
0.24567729234695435... |
func NewGetAccountsListNotFound() *GetAccountsListNotFound {
return &GetAccountsListNotFound{}
} | [
-0.18625041842460632,
-0.9129911661148071,
-0.005283433943986893,
-0.03991289064288139,
0.4216771423816681,
0.31672701239585876,
0.33305680751800537,
0.7853801250457764,
0.6293820142745972,
-0.5710769891738892,
-0.553652286529541,
0.19646087288856506,
-0.3647836446762085,
0.083806984126567... |
func (o *GetAccountsListNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(404)
} | [
-0.5241091251373291,
-0.9993096590042114,
0.1407512128353119,
0.0018822172423824668,
1.458061933517456,
-0.27342620491981506,
0.6339867115020752,
-0.24503518640995026,
0.6766523718833923,
0.14252643287181854,
0.06309422105550766,
-0.052467748522758484,
-0.5166733264923096,
0.18310098350048... |
func NewClient(c *lib.RelayerConfig) *Client {
clt := &Client{}
clt.Reload(c)
clt.requestChan = make(chan *lib.Request, requestBufferSize)
clt.setReady(true)
go clt.requestListener(clt.requestChan)
lib.Debugf("Client %s for target %s ready", clt.config.Listen, clt.config.Host())
return clt
} | [
0.0898829847574234,
-0.5000642538070679,
0.3744148313999176,
-0.691963255405426,
-0.021272847428917885,
0.11534422636032104,
0.24339987337589264,
-0.5414066910743713,
-0.37771284580230713,
-0.6461980938911438,
-0.13288576900959015,
0.9402604699134827,
-0.08566255122423172,
-0.2254289388656... |
func (clt *Client) Reload(c *lib.RelayerConfig) {
clt.Lock()
defer clt.Unlock()
if clt.isReady() {
clt.flush(true)
}
clt.config = c
clt.mode = clt.config.Type()
} | [
-0.3717080354690552,
0.2778249979019165,
0.2818858027458191,
-0.9757186770439148,
-0.08611111342906952,
0.6887544989585876,
0.6942904591560364,
-0.22176849842071533,
-0.5905046463012695,
0.4882740080356598,
-0.852511465549469,
0.48978203535079956,
-0.664498507976532,
-0.3709608316421509,
... |
func (clt *Client) requestListener(ch chan *lib.Request) {
defer lib.Debugf("Finished Redis client")
defer func() {
clt.setReady(false)
}()
timer := time.NewTimer(maxIdle)
defer func() {
// Clean timer gracefully
if !timer.Stop() {
select {
case <-timer.C:
default:
}
}
}()
clt.connect()
fo... | [
-1.0295206308364868,
-0.9091785550117493,
0.8490989208221436,
-0.43519386649131775,
0.5332557559013367,
0.18910959362983704,
-0.02955579198896885,
-0.607720136642456,
0.17913854122161865,
0.049603212624788284,
-0.03424070030450821,
-0.6944050192832947,
-0.37230077385902405,
0.5691753625869... |
func (clt *Client) redisListener(buf io.ReadWriter, queue chan *lib.Request) {
lib.Debugf("Net listener started")
defer clt.close() // Will force to close net connection
reader := redis.NewRespReader(buf)
for req := range queue {
r := reader.Read()
if req == nil {
continue
}
if r.Err != nil && r.IsType... | [
-0.1871766597032547,
-1.4245418310165405,
0.6595966815948486,
-0.815062403678894,
0.22306028008460999,
0.5469271540641785,
-0.28608283400535583,
-0.2465459257364273,
-0.06806402653455734,
0.3419629633426666,
-0.1102629080414772,
-0.8412693738937378,
0.1026705726981163,
1.096890926361084,
... |
func (clt *Client) Exit() {
clt.Lock()
defer clt.Unlock()
clt.setReady(false)
if clt.requestChan != nil {
// Closing the request channel triggers all disconnections
close(clt.requestChan)
clt.requestChan = nil
}
} | [
-0.8495824933052063,
0.17540253698825836,
0.29493796825408936,
-0.9813688397407532,
0.5715827345848083,
0.3498574495315552,
-0.014227433130145073,
-0.3933452069759369,
-0.014067163690924644,
-0.13670359551906586,
-0.47004422545433044,
0.14861366152763367,
-1.026490330696106,
0.688071131706... |
func (clt *Client) IsValid() bool {
return clt.isReady() && clt.isConnected()
} | [
-0.3147776424884796,
-0.7856235504150391,
0.41797444224357605,
-0.19203436374664307,
-0.052299436181783676,
1.2063159942626953,
-0.39547663927078247,
0.20390737056732178,
0.34640824794769287,
0.08324003219604492,
-0.151482492685318,
0.5813456773757935,
-0.40825575590133667,
0.0629107877612... |
func (clt *Client) send(req interface{}) (e error) {
r := req.(*lib.Request)
defer func() {
r := recover() // To avoid panic due to closed channels
if r != nil {
log.Printf("sendRequest: Recovered from error %s, channel length %d", e, len(clt.requestChan))
e = r.(error)
}
}()
if clt.requestChan == nil ... | [
-0.9886842966079712,
0.29722702503204346,
1.0404757261276245,
-0.009285380132496357,
0.2945263087749481,
0.06620687991380692,
-0.4302706718444824,
-1.0895143747329712,
-0.23707345128059387,
0.44555777311325073,
0.0885908305644989,
0.3907565474510193,
-0.3091639280319214,
0.5639244318008423... |
func (a *AmazonEC2) MigrateToMultiAZ(cluster *kubermaticv1.Cluster, clusterUpdater provider.ClusterUpdater) error {
// If not even the role name is set, then the cluster is not fully
// initialized and we don't need to worry about this migration just yet.
if cluster.Spec.Cloud.AWS.RoleName == "" {
return nil
}
... | [
-0.600726306438446,
-0.3961987793445587,
0.8247867226600647,
0.45263543725013733,
0.3784550726413727,
-0.33428680896759033,
0.07527964562177658,
-0.2797321677207947,
0.9185197353363037,
0.9226589798927307,
-0.2903197109699249,
0.16007955372333527,
0.06985339522361755,
0.5279638767242432,
... |
func (a *AmazonEC2) AddICMPRulesIfRequired(cluster *kubermaticv1.Cluster) error {
if cluster.Spec.Cloud.AWS.SecurityGroupID == "" {
klog.Infof("Not adding ICMP allow rules for cluster %q as it has no securityGroupID set",
cluster.Name)
return nil
}
client, err := a.getClientSet(cluster.Spec.Cloud)
if err !=... | [
-0.38650843501091003,
-0.5173161029815674,
0.5651758909225464,
-0.6788197755813599,
0.6374877095222473,
0.20510932803153992,
0.24376316368579865,
-0.06130019947886467,
-0.09252014011144638,
1.0231750011444092,
0.4716198742389679,
-0.20558978617191315,
-1.0726362466812134,
0.719773113727569... |
func NewCloudProvider(dc *kubermaticv1.Datacenter, secretKeyGetter provider.SecretKeySelectorValueFunc) (*AmazonEC2, error) {
if dc.Spec.AWS == nil {
return nil, errors.New("datacenter is not an AWS datacenter")
}
return &AmazonEC2{
dc: dc.Spec.AWS,
secretKeySelector: secretKeyGetter,
}, nil
} | [
0.22825105488300323,
0.6721490025520325,
0.2138635665178299,
0.21483439207077026,
-1.1573530435562134,
-0.04034244641661644,
-0.8371983170509338,
-0.7259132266044617,
0.40460437536239624,
0.8126371502876282,
-0.5150963664054871,
0.5726417899131775,
0.4458555579185486,
0.8032400608062744,
... |
func createSecurityGroup(client ec2iface.EC2API, vpcID, clusterName string) (string, error) {
var securityGroupID string
newSecurityGroupName := resourceNamePrefix + clusterName
csgOut, err := client.CreateSecurityGroup(&ec2.CreateSecurityGroupInput{
VpcId: &vpcID,
GroupName: aws.String(newSecurityGroup... | [
0.2512487769126892,
0.49401307106018066,
0.4979860782623291,
-0.12071651965379715,
0.09645078331232071,
-0.3327777087688446,
-0.34120282530784607,
-0.5366542339324951,
-0.4502071142196655,
0.2531474828720093,
0.26386013627052307,
0.3472653925418854,
-0.31323567032814026,
0.2553170025348663... |
func GetCredentialsForCluster(cloud kubermaticv1.CloudSpec, secretKeySelector provider.SecretKeySelectorValueFunc) (accessKeyID, secretAccessKey string, err error) {
accessKeyID = cloud.AWS.AccessKeyID
secretAccessKey = cloud.AWS.SecretAccessKey
if accessKeyID == "" {
if cloud.AWS.CredentialsReference == nil {
... | [
0.30938494205474854,
-0.17725008726119995,
0.47927695512771606,
-0.12961246073246002,
0.4619361162185669,
-0.11088535934686661,
-0.15157029032707214,
0.3614223897457123,
-0.01737770065665245,
0.4148479998111725,
0.9487758874893188,
0.9477742910385132,
0.3567377030849457,
0.9635785222053528... |
func (a *AmazonEC2) ValidateCloudSpecUpdate(oldSpec kubermaticv1.CloudSpec, newSpec kubermaticv1.CloudSpec) error {
return nil
} | [
0.28593069314956665,
-0.968733012676239,
0.5145419836044312,
-0.1435917466878891,
-0.31631919741630554,
0.5994858741760254,
-0.5128716230392456,
-0.5218014717102051,
-1.2040863037109375,
0.5991945266723633,
0.22209060192108154,
0.1945834755897522,
0.7342361807823181,
0.39317837357521057,
... |
func GetSubnets(accessKeyID, secretAccessKey, region, vpcID string) ([]*ec2.Subnet, error) {
client, err := GetClientSet(accessKeyID, secretAccessKey, region)
if err != nil {
return nil, err
}
filters := []*ec2.Filter{
{Name: aws.String("vpc-id"), Values: []*string{aws.String(vpcID)}},
}
subnetsInput := &ec2... | [
0.4511537551879883,
0.27305126190185547,
0.46761369705200195,
-0.07697807252407074,
0.7657517194747925,
-0.3160746395587921,
-1.4366296529769897,
-0.3285302221775055,
0.569446325302124,
0.22199423611164093,
-0.4308081865310669,
1.7529032230377197,
-0.35333430767059326,
0.1476854830980301,
... |
func GetVPCS(accessKeyID, secretAccessKey, region string) ([]*ec2.Vpc, error) {
client, err := GetClientSet(accessKeyID, secretAccessKey, region)
if err != nil {
return nil, err
}
vpcOut, err := client.EC2.DescribeVpcs(&ec2.DescribeVpcsInput{})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsEr... | [
-0.24588821828365326,
-0.2796878218650818,
0.39735332131385803,
-0.7350909113883972,
0.09504781663417816,
-0.371578186750412,
-1.6105862855911255,
-1.166455626487732,
0.677622377872467,
0.5815427303314209,
0.5705724954605103,
1.0910309553146362,
-0.5833547115325928,
-0.5179250240325928,
... |
func main() | [
0.7420899868011475,
-0.09570430219173431,
0.21793518960475922,
1.6047182083129883,
0.4610096514225006,
0.8911306262016296,
1.7090253829956055,
0.8771101236343384,
-0.7287675142288208,
-0.38924655318260193,
-0.4360443651676178,
0.5888992547988892,
-0.36256250739097595,
-0.2506205141544342,
... |
func (d *Direct) Valid() error {
switch strings.ToUpper(d.Method) {
case GET, POST, PUT:
default:
return errInvalidMethod
}
return d.Web.Valid()
} | [
-0.7693505883216858,
-0.1424216479063034,
0.498516321182251,
0.31720617413520813,
-0.454513818025589,
1.3645588159561157,
0.6329523921012878,
-0.11924675107002258,
-0.079083651304245,
-0.6241939067840576,
0.9613462090492249,
1.0133329629898071,
0.06212976202368736,
0.31105658411979675,
0... |
func (d *Direct) DeParameterize(params []string) (err error) {
for i, p := range params {
d.Body = replaceParameter(d.Body, i+1, p)
}
if err = d.Web.DeParameterize(params); err != nil {
return err
}
if strings.Contains(d.Body, parameter) {
return errUnhandledParams
}
return
} | [
-0.6972615122795105,
0.8299597501754761,
0.7965819835662842,
-0.568209171295166,
0.8041857481002808,
0.25561487674713135,
0.05720329284667969,
-0.034802570939064026,
-0.5493804812431335,
0.5218904614448547,
0.23068867623806,
0.4134841561317444,
-1.2437981367111206,
1.1422137022018433,
-0... |
func (d *Direct) AddCredentials(creds map[string]string) {
d.credentials = make(map[string]string)
for key, value := range creds {
d.credentials[key] = value
}
} | [
-1.2287319898605347,
-0.16412827372550964,
0.14721736311912537,
-0.5448504686355591,
-0.015869446098804474,
1.273956537246704,
-0.6365929245948792,
0.43984630703926086,
-0.3277474641799927,
-0.21119548380374908,
0.02533520571887493,
0.17088180780410767,
0.4698687791824341,
0.70160466432571... |
func (d *Direct) Run() ([]byte, error) {
var bdy io.Reader
if d.Body != "" {
bdy = strings.NewReader(d.Body)
}
req, err := http.NewRequest(strings.ToUpper(d.Method), d.URL, bdy)
if err != nil {
return nil, err
}
// Set our User-Agent by default. Will be overridden with a user's custom User-Agent
// TODO: ... | [
-1.2079548835754395,
-0.2135578691959381,
0.8165154457092285,
-0.3998783230781555,
-0.13838648796081543,
0.23140965402126312,
-0.8079972267150879,
-0.3800763487815857,
-0.3905922472476959,
-0.3044217526912689,
-0.046652328222990036,
0.35490044951438904,
-0.5715700387954712,
0.3816221952438... |
func (p *PubSub) QueueDeclare(name string) (amqp.Queue, error) {
return p.Channel.QueueDeclare(
name, // name
true, // durable
false, // auto-delete
false, // exclusive
false, // noWait
nil, // arguments
)
} | [
0.519972026348114,
-0.23724883794784546,
0.9700688719749451,
0.5212720036506653,
-0.05694274231791496,
-0.21738387644290924,
-1.4220983982086182,
0.10483306646347046,
-0.009622467681765556,
-0.12469737976789474,
0.3492199778556824,
0.7546789646148682,
-0.8532105684280396,
0.886595487594604... |
func (p *PubSub) PublishJSON(routingKey string, data interface{}) error {
jsonblob, err := json.Marshal(data)
if err != nil {
return fmt.Errorf("Failed to create JSON message: %s", err)
}
return p.Publish(routingKey, "application/json", jsonblob)
} | [
-0.5294721722602844,
0.06681074947118759,
0.5156717300415039,
-0.21961840987205505,
-0.5347238183021545,
-0.15977177023887634,
-0.3841302692890167,
0.7067986726760864,
-0.337646484375,
0.9698130488395691,
-0.5366150736808777,
0.9483440518379211,
-0.4485114812850952,
0.8538264632225037,
0... |
func (p *PubSub) Publish(routingKey string, contentType string, body []byte) error {
log.Debugf("Sending message to %s: %s", routingKey, string(body))
err := p.Channel.Publish(
"", // default exchange
routingKey, // routing key (queue name)
true, // mandatory
false, // immediate
amqp.Pub... | [
-0.030582139268517494,
0.45820870995521545,
0.6039721965789795,
0.17541924118995667,
0.2044866681098938,
0.20297810435295105,
-0.8581040501594543,
0.31311115622520447,
-0.8009060025215149,
0.7324705719947815,
0.2840489447116852,
0.1621328592300415,
-1.3462185859680176,
0.4946177899837494,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.