text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (a *Client) V2ResetHostValidation(ctx context.Context, params *V2ResetHostValidationParams) (*V2ResetHostValidationOK, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2ResetHostValidation", Method: "PATCH", PathPattern: "/v2/infra-envs/{infra_en...
[ -0.8227925896644592, -0.41911888122558594, 0.5221446752548218, -0.3178374469280243, -0.7805553674697876, 0.07033884525299072, 0.4881693124771118, 0.2974226176738739, -0.8989839553833008, 1.3197879791259766, -0.5682904720306396, 1.0732864141464233, -0.50821453332901, -0.08924923837184906, ...
func (a *Client) V2SetIgnoredValidations(ctx context.Context, params *V2SetIgnoredValidationsParams) (*V2SetIgnoredValidationsCreated, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2SetIgnoredValidations", Method: "PUT", PathPattern: "/v2/clusters/...
[ -1.1775436401367188, -0.35330915451049805, 0.5562958717346191, -0.294112890958786, -0.29666781425476074, 0.5999491214752197, 0.3944242298603058, -0.7834113240242004, -0.16380245983600616, 0.059131406247615814, -1.0181636810302734, 1.0890765190124512, -0.8159748315811157, 0.2427739351987838...
func (a *Client) V2UpdateClusterInstallConfig(ctx context.Context, params *V2UpdateClusterInstallConfigParams) (*V2UpdateClusterInstallConfigCreated, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateClusterInstallConfig", Method: "PATCH", PathPattern:...
[ -0.6805945634841919, -0.8429163694381714, 0.7618361711502075, -0.15208953619003296, -1.0408775806427002, -0.013119323179125786, 0.455904483795166, 1.2685942649841309, -0.5691913962364197, 1.3031091690063477, -0.6255471706390381, 0.721404492855072, -1.0523574352264404, -0.16461783647537231,...
func (a *Client) V2UpdateClusterLogsProgress(ctx context.Context, params *V2UpdateClusterLogsProgressParams) (*V2UpdateClusterLogsProgressNoContent, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateClusterLogsProgress", Method: "PUT", PathPattern: ...
[ -0.8543460965156555, -1.1150072813034058, 0.5744463801383972, -0.43636736273765564, -1.3091052770614624, -0.22933396697044373, 0.4417451024055481, -0.33013662695884705, -0.5588529109954834, 1.0674303770065308, -0.702809751033783, 0.6830970644950867, -1.4174623489379883, -0.5536579489707947...
func (a *Client) V2UpdateHost(ctx context.Context, params *V2UpdateHostParams) (*V2UpdateHostCreated, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateHost", Method: "PATCH", PathPattern: "/v2/infra-envs/{infra_env_id}/hosts/{host_id}", Produ...
[ -1.3491371870040894, -1.106191873550415, 0.7770549058914185, -0.1217743456363678, -0.9998440742492676, 0.31525611877441406, -0.3273279070854187, -0.2349148988723755, -0.9924837350845337, 0.5417712330818176, -0.27315327525138855, 1.5062729120254517, -0.4734039008617401, -0.1762198507785797,...
func (a *Client) V2UpdateHostIgnition(ctx context.Context, params *V2UpdateHostIgnitionParams) (*V2UpdateHostIgnitionCreated, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateHostIgnition", Method: "PATCH", PathPattern: "/v2/infra-envs/{infra_e...
[ -1.5192809104919434, -1.5698232650756836, 0.8204067349433899, 0.031799908727407455, -1.018875241279602, 0.22362810373306274, 0.4039049744606018, 1.3372803926467896, -0.574411153793335, 0.9910670518875122, -0.9514205455780029, 0.8615490198135376, -0.8624135851860046, -0.6053261756896973, ...
func (a *Client) V2UpdateHostInstallProgress(ctx context.Context, params *V2UpdateHostInstallProgressParams) (*V2UpdateHostInstallProgressOK, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateHostInstallProgress", Method: "PUT", PathPattern: "/v...
[ -0.8286460638046265, -0.7445866465568542, 0.834004819393158, 0.003217320656403899, -1.5088520050048828, 0.3352234661579132, 0.13819658756256104, 0.5489547252655029, -1.0110843181610107, 1.0337226390838623, -0.2903306484222412, 0.2598783075809479, -1.0650957822799683, 0.3175792694091797, ...
func (a *Client) V2UpdateHostInstallerArgs(ctx context.Context, params *V2UpdateHostInstallerArgsParams) (*V2UpdateHostInstallerArgsCreated, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateHostInstallerArgs", Method: "PATCH", PathPattern: "/v2...
[ -1.4889711141586304, -0.9341267943382263, 0.8200228810310364, -0.10678646713495255, -0.6761722564697266, 0.11663243174552917, 0.4303184747695923, 0.8847769498825073, -1.3553495407104492, 1.3705315589904785, -0.6712945103645325, 0.32854390144348145, -1.0213805437088013, 0.6533388495445251, ...
func (a *Client) V2UpdateHostLogsProgress(ctx context.Context, params *V2UpdateHostLogsProgressParams) (*V2UpdateHostLogsProgressNoContent, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateHostLogsProgress", Method: "PUT", PathPattern: "/v2/inf...
[ -0.8392898440361023, -1.1289037466049194, 0.6952539682388306, -0.3891066610813141, -1.2597782611846924, -0.0024962567258626223, 0.0735405683517456, -0.2813919484615326, -1.1838908195495605, 0.8445137143135071, -0.7678207755088806, 0.6754118800163269, -0.8647136092185974, -0.131700381636619...
func (a *Client) V2UploadClusterIngressCert(ctx context.Context, params *V2UploadClusterIngressCertParams) (*V2UploadClusterIngressCertCreated, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UploadClusterIngressCert", Method: "POST", PathPattern: "...
[ 0.13945519924163818, -0.008730441331863403, 0.8175567388534546, -0.11168551445007324, -0.2594003677368164, 0.13219033181667328, -0.06300864368677139, -0.6198391914367676, -0.6827031970024109, 1.0513279438018799, -0.5872440338134766, 0.6894912719726562, -1.419516921043396, -0.19003847241401...
func NewUserRepository(db *pg.DB) User { return &userRepository{ db: db, } }
[ -0.4879448711872101, -0.21049244701862335, 0.03141576424241066, 0.20977453887462616, -1.4260374307632446, -0.33914971351623535, -0.2231941968202591, -0.027443764731287956, 0.28585395216941833, -0.2725968062877655, -0.6568788290023804, -0.23707044124603271, 0.5521509647369385, 0.87612503767...
func NewAPI(s *session.Session, server *server.Server) *API { api := API{ Session: s, Server: server, db: server.Db, IPPort: s.GetAPIIPPort(), Version: Version, Prefix: "/api/" + Version, } api.Routes() api.setupSignal() return &api }
[ -0.37267956137657166, -1.1258957386016846, 0.2810285687446594, 0.8370240926742554, -0.8351678252220154, -0.06949121505022049, 0.025651630014181137, 0.35236436128616333, -0.05132763460278511, 0.39900314807891846, -0.8947890400886536, -0.2185191959142685, 0.24660077691078186, -0.343596220016...
func (api *API) Start() { // timeout before forcing shutdown wait := time.Second * 3 // this is from the mux documentation srv := &http.Server{ Addr: api.IPPort, // Good practice to set timeouts to avoid Slowloris attacks. WriteTimeout: time.Second * 15, ReadTimeout: time.Second * 15, IdleTimeout: time...
[ -0.6126375198364258, -0.15615315735340118, 0.8117456436157227, 0.032590124756097794, 0.08568887412548065, -0.24418078362941742, -0.06497914344072342, 0.17555561661720276, -0.42366862297058105, 0.3340131640434265, -0.14720356464385986, 0.6702545881271362, -0.45626330375671387, 0.25514003634...
func (api *API) Shutdown() { c <- os.Interrupt }
[ -0.7067819237709045, -0.3671175241470337, 0.37105825543403625, -0.28787121176719666, 0.7481462359428406, 0.9426537752151489, 0.5537155866622925, 0.3478373885154724, -0.11645817756652832, -0.12019974738359451, 0.1544480323791504, 0.4041733145713806, -1.3982715606689453, -0.3121579885482788,...
func (api *API) RunModules(w http.ResponseWriter, r *http.Request) { var inputs []communication.Input var res Result err := json.NewDecoder(r.Body).Decode(&inputs) if err != nil { log.Debugf("Could not decode provided json : %+v", err) sendDefaultValue(w, CodeCouldNotDecodeJSON) return } log.Debugf("JSON ...
[ -1.9276037216186523, -0.46126589179039, 0.7493305802345276, -0.05730573460459709, 0.6346303820610046, -0.11917688697576523, 0.13290183246135712, -1.1527111530303955, -0.03973730653524399, 0.6758118867874146, 0.057563722133636475, 0.158372163772583, -0.683377742767334, 0.9142012596130371, ...
func (api *API) GetIndex(w http.ResponseWriter, r *http.Request) { info := Info{Port: api.Session.Config.API.Port, Versions: Version} d := Metadata{Info: info} res := CodeToResult[CodeOK] res.Data = d res.Message = "Documentation available at https://github.com/netm4ul/netm4ul" w.WriteHeader(res.HTTPCode) json...
[ -0.6855220794677734, -0.04297195374965668, 0.47047191858291626, -0.20383402705192566, 0.6668435335159302, -0.3341498374938965, 0.08144428580999374, 0.4865981936454773, -0.20111846923828125, 0.09440456330776215, -0.3165179491043091, 0.8057371973991394, -0.3794650733470917, -0.04178505390882...
func (api *API) GetRoutesByIP(w http.ResponseWriter, r *http.Request) { //TODO sendDefaultValue(w, CodeNotImplementedYet) }
[ -0.29733505845069885, 0.3021993935108185, 0.6817612648010254, 1.4124706983566284, 0.8612682223320007, -0.9555301070213318, 0.5218494534492493, -0.7825267314910889, 0.13653980195522308, 0.0821007713675499, 0.36804723739624023, -0.77195143699646, -0.10080428421497345, 0.2546102702617645, -...
func NewInboundPacket(id int) (encoding.Codable, error) { typePtr, ok := inboundTypes[id] if !ok { return new(UnknownPacket), nil } typ := reflect.TypeOf(typePtr).Elem() value := reflect.New(typ) return value.Interface().(encoding.Codable), nil }
[ -0.7492730021476746, -0.5390991568565369, 0.4527782201766968, -0.14353138208389282, -1.124534010887146, -0.31274083256721497, -0.6742991209030151, -0.7953934073448181, -0.07350753247737885, -0.4257502257823944, -0.4553455114364624, 1.25315523147583, -1.1470954418182373, 0.5836995244026184,...
func NewMySQLClusterTestJig(mysqlClient mysqlclientset.Interface, kubeClient clientset.Interface, name string) *MySQLClusterTestJig { id := string(uuid.NewUUID()) return &MySQLClusterTestJig{ ID: id, Name: name, Labels: map[string]string{ "testID": id, "testName": name, }, MySQLClient: mysqlClien...
[ 0.650158703327179, -0.9557867646217346, 0.21091197431087494, -0.839407742023468, -1.0454936027526855, -0.5818591713905334, -0.03763893246650696, 0.66407710313797, -0.26452475786209106, 0.37751421332359314, -0.1483689695596695, 0.2793505787849426, -1.383393406867981, -0.07774883508682251, ...
func (j *MySQLClusterTestJig) newMySQLClusterTemplate(namespace string, replicas int32) *v1.MySQLCluster { return &v1.MySQLCluster{ ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, Name: j.Name, Labels: j.Labels, }, Spec: v1.MySQLClusterSpec{ Replicas: replicas, }, } }
[ 0.15579071640968323, -0.7901697754859924, 0.2090446501970291, -0.5343667268753052, -1.1181559562683105, -0.7608462572097778, -0.29461076855659485, 0.5879050493240356, 0.08286801725625992, 0.2123681902885437, -1.3246759176254272, 0.5686273574829102, -0.6590145230293274, 0.14330270886421204,...
func (j *MySQLClusterTestJig) CreateMySQLClusterOrFail(namespace string, replicas int32, tweak func(cluster *v1.MySQLCluster)) *v1.MySQLCluster { cluster := j.newMySQLClusterTemplate(namespace, replicas) if tweak != nil { tweak(cluster) } name := types.NamespacedName{Namespace: namespace, Name: j.Name} By(fmt.S...
[ -0.010790146887302399, 0.3160349130630493, 0.3323729634284973, -0.8984676003456116, -0.47641295194625854, -0.6008926630020142, -0.10935400426387787, -0.6021628379821777, 0.5344907641410828, -0.1834522932767868, -0.4656470715999603, 0.15137438476085663, -0.5007405281066895, 0.28637027740478...
func (j *MySQLClusterTestJig) CreateAndAwaitMySQLClusterOrFail(namespace string, replicas int32, tweak func(cluster *v1.MySQLCluster), timeout time.Duration) *v1.MySQLCluster { cluster := j.CreateMySQLClusterOrFail(namespace, replicas, tweak) cluster = j.WaitForClusterReadyOrFail(namespace, cluster.Name, timeout) j....
[ -0.38478702306747437, 0.316022127866745, 0.27380630373954773, -0.45932736992836, -0.0009643753292039037, -0.47500115633010864, 0.04999319463968277, -0.38022544980049133, 0.40637925267219543, -0.5016916394233704, -0.3299168348312378, 0.28439074754714966, -0.3821672201156616, 0.3839176595211...
func (j *MySQLClusterTestJig) WaitForClusterReadyOrFail(namespace, name string, timeout time.Duration) *v1.MySQLCluster { Logf("Waiting up to %v for MySQLCluster \"%s/%s\" to be ready", timeout, namespace, name) cluster := j.waitForConditionOrFail(namespace, name, timeout, "have all nodes ready", func(cluster *v1.MyS...
[ -0.6875467300415039, -0.05797574669122696, 0.3466612696647644, -0.751867413520813, -0.7676894664764404, -0.6900531053543091, -0.4786149561405182, 0.005094689317047596, -0.01789047382771969, -0.021975547075271606, -0.2777320444583893, -0.017990900203585625, -0.030734384432435036, -0.0155513...
func (j *MySQLClusterTestJig) SanityCheckMySQLCluster(cluster *v1.MySQLCluster) { name := types.NamespacedName{Namespace: cluster.Namespace, Name: cluster.Name} ss, err := j.KubeClient.AppsV1beta1().StatefulSets(cluster.Namespace).Get(cluster.Name, metav1.GetOptions{}) if err != nil { Failf("Failed to get Stateful...
[ -0.3618943393230438, -0.20645159482955933, 0.7679551243782043, -0.1296786516904831, -0.17930148541927338, -0.3281303346157074, -0.3142198324203491, 0.02328057587146759, 0.22143886983394623, -0.3091144859790802, 0.05228446051478386, 0.9339463114738464, -0.294758677482605, 1.2934234142303467...
func ExecuteSQL(cluster *v1.MySQLCluster, member, sql string) (string, error) { cmd := fmt.Sprintf("mysql -h %s.%s -u root -p$MYSQL_ROOT_PASSWORD -e '%s'", member, cluster.Name, sql) return RunKubectl(fmt.Sprintf("--namespace=%v", cluster.Namespace), "exec", member, "-c", "mysql", "--", "/bin/sh", "-c", cmd) }
[ 0.43822354078292847, -0.09071886539459229, 0.7009170055389404, 0.7164254784584045, -0.7214289903640747, -0.0029272085521370173, -1.312842845916748, -0.27650848031044006, -0.2714664340019226, 0.552691638469696, 0.2527928948402405, 0.6238724589347839, -0.1777513325214386, -0.560429573059082,...
func ReadSQLTest(cluster *v1.MySQLCluster, member string) (string, error) { By("SELECT v FROM foo WHERE k=\"foo\"") output, err := ExecuteSQL(cluster, member, strings.Join([]string{ fmt.Sprintf("use %s;", TestDBName), `SELECT v FROM foo WHERE k="foo";`, }, " ")) if err != nil { return "", errors.Wrap(err, "ex...
[ 0.8586306571960449, -0.007353146560490131, 0.721369206905365, -0.3374037742614746, -0.7584669589996338, -0.5938583016395569, -0.742792010307312, -1.0763494968414307, -0.12906168401241302, 0.12977324426174164, 0.8092353343963623, 0.3668767213821411, -1.0096536874771118, -0.9251645803451538,...
func WriteSQLTest(cluster *v1.MySQLCluster, member string) (string, error) { By("Creating a database and table, writing to that table, and writing a uuid") id := uuid.NewUUID() if _, err := ExecuteSQL(cluster, member, strings.Join([]string{ fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s;", TestDBName), fmt.Sprint...
[ 0.05452443286776543, -0.09440473467111588, 0.6611145734786987, -0.2181878387928009, -0.028540095314383507, -0.39074140787124634, 0.02816728875041008, -0.5085415244102478, -0.04331196844577789, 0.13927629590034485, -0.3829328715801239, -0.10874750465154648, -1.100766897201538, -0.1377251446...
func AwaitPodReadyOrDie(cs clientset.Interface, ns, name string, timeout time.Duration) { nsName := types.NamespacedName{Namespace: ns, Name: name} Logf("Waiting up to %v for a Pod %q to be ready", timeout, nsName) if err := wait.PollImmediate(Poll, timeout, func() (bool, error) { pod, err := cs.CoreV1().Pods(ns)...
[ -0.9844552278518677, 0.06600765883922577, 0.5623449683189392, -0.8298217058181763, -0.16984178125858307, -0.3495023548603058, -1.145717740058899, -0.974881112575531, -0.34508252143859863, 1.2272701263427734, -0.7229747176170349, -0.17913925647735596, 0.40166085958480835, -0.592913866043090...
func GetReadyPrimaryPodName(cs clientset.Interface, namespace, clusterName string) string { return getReadyClusterMemberMatchingSelector(cs, namespace, labeler.PrimarySelector(clusterName)) }
[ -0.5176618099212646, -0.4177054166793823, 0.6219214797019958, -0.4113121032714844, -0.33320707082748413, -0.38754841685295105, -0.4291776716709137, -0.4555836617946625, 0.6228347420692444, 0.34395813941955566, -0.0708552896976471, 0.27829211950302124, -0.265137642621994, -0.458641827106475...
func GetReadySecondaryPodName(cs clientset.Interface, namespace, clusterName string) string { return getReadyClusterMemberMatchingSelector(cs, namespace, labeler.SecondarySelector(clusterName)) }
[ -0.6149396300315857, -0.4215955138206482, 0.6133264303207397, -0.07520706206560135, -0.029021969065070152, -0.5484410524368286, -0.13510240614414215, -0.9984900951385498, -0.16335393488407135, 0.8638417720794678, -1.0054419040679932, 0.8186503648757935, 0.3478265404701233, -0.0232738498598...
func allUsers(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var users []User db.Scopes(Paginate(r)).Find(&users) err := json.NewEncoder(w).Encode(users) log.ErrorHandler(err) log.AccessHandler(r, 200) return }
[ -1.129595398902893, -0.919482409954071, 0.7453880310058594, 0.20851193368434906, -0.568596363067627, -0.19833992421627045, -0.45061156153678894, -0.17935185134410858, 0.23960565030574799, 0.8066765069961548, 0.45131757855415344, 0.6680081486701965, 0.2758634686470032, 1.0979636907577515, ...
func getUser(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var user User params := mux.Vars(r) userID := params["id"] db.Find(&user, "id = ?", userID) err := json.NewEncoder(w).Encode(user) log.ErrorHandler(err) log.AccessHandler(r, 200) return }
[ -0.9760158061981201, -0.6493974328041077, 0.7866322994232178, 1.1684317588806152, -0.3141119182109833, -0.1215938851237297, 0.38589388132095337, -0.7926153540611267, -0.23330675065517426, 0.13356569409370422, -0.4050864279270172, 0.6361546516418457, -0.13017189502716064, 1.0399394035339355...
func postUser(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var user User err := json.NewDecoder(r.Body).Decode(&user) log.ErrorHandler(err) var ( email = strings.ToLower(user.Email) alias = user.Alias userName = user.UserName password ...
[ -0.7533109784126282, -0.4451356530189514, 0.9170932769775391, 0.17051203548908234, -0.28455525636672974, 0.5597363114356995, 0.4194198250770569, -0.13315792381763458, 0.05002806335687637, -0.10171962529420853, -0.8194329142570496, -0.24930420517921448, -0.02762809954583645, 0.6343703866004...
func verifyEmail(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var ( data otp user User ) err := json.NewDecoder(r.Body).Decode(&data) log.ErrorHandler(err) // Gets the user and checks if the mail is already verified db.Find(&user, "email = ?", strings.ToLower(...
[ -0.23337508738040924, 0.7109575867652893, 0.5961931943893433, 0.4468347728252411, 0.7107935547828674, 0.41017961502075195, -0.5751063823699951, -0.14195029437541962, 0.7546791434288025, 0.4575777053833008, -0.501556396484375, 1.055126428604126, -0.04766291379928589, 0.22928038239479065, ...
func requestOTP(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var ( data otpRequest storedOTP string user User ) err := json.NewDecoder(r.Body).Decode(&data) db.Find(&user, "email = ?", data.Email) key := "new_user_otp_" + data.Email storedOTP, err...
[ -0.5345066785812378, 0.333597868680954, 0.7532013654708862, 0.2187315821647644, -0.010587720200419426, 0.25623536109924316, -0.44403785467147827, -0.8518677353858948, 0.7329590916633606, 0.15485753118991852, -0.214106485247612, 0.42158904671669006, -0.6338175535202026, -0.14744578301906586...
func resetPasswordRequest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var body otpRequest err := json.NewDecoder(r.Body).Decode(&body) log.ErrorHandler(err) // Verify email emailStatus := emailValidator(body.Email) if !emailStatus { w.WriteHeader(http.StatusBa...
[ -1.1051990985870361, 0.6194483637809753, 0.9126408696174622, -0.5165309906005859, 0.286228209733963, -0.05642094835639, -0.3751796782016754, -0.5400015115737915, -0.27585259079933167, 1.250356674194336, -0.22742792963981628, 0.9643999338150024, -0.2149452120065689, -0.23272879421710968, ...
func resetPassword(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") // take email, token and new password body := struct { Email string `json:"email"` OTP string `json:"otp"` Password string `json:"password"` }{} err := json.NewDecoder(r.Body).Decode(&bod...
[ -0.3103736639022827, 0.37364041805267334, 0.9543747305870056, 0.11347781121730804, 0.6490530371665955, 0.5577970743179321, -0.10629113018512726, -0.07090548425912857, -0.39962124824523926, 0.9859283566474915, -0.9344967603683472, 0.0935250073671341, -0.07102163136005402, -0.301839619874954...
func New(s *session.Session) *S3 { return &S3{ s3Manager: s3manager.NewUploader(s), s3Client: s3.New(s), } }
[ 0.48200327157974243, -0.9848354458808899, 0.16103363037109375, -0.6112385988235474, -0.8721525073051453, 0.1300196647644043, -0.5016778707504272, -0.23430201411247253, 1.0734645128250122, -0.5251944661140442, -0.3919883966445923, 0.7237427234649658, 0.866531252861023, -0.05345747619867325,...
func (s *S3) Upload(bucket, key string, data io.Reader) (string, error) { return s.upload(bucket, key, data) }
[ -0.28339847922325134, 0.17038868367671967, 0.3397892415523529, -0.7117951512336731, -1.0715664625167847, -0.056967105716466904, -1.1602591276168823, -0.4980635344982147, -0.4595591127872467, 0.3273618221282959, -0.0721505656838417, -0.18313205242156982, -0.4169800281524658, -1.149635434150...
func (s *S3) EmptyBucket(bucket string) error { var listResp *s3.ListObjectVersionsOutput var err error bucketExists, err := s.bucketExists(bucket) if err != nil { return fmt.Errorf("unable to determine the existence of bucket %s: %w", bucket, err) } if !bucketExists { return nil } listParams := &s3.List...
[ -0.05739319697022438, -0.6551344394683838, 0.7816267013549805, -0.22399060428142548, 0.4421699345111847, 0.4072636067867279, 0.4013013243675232, -0.3722805380821228, 0.9406555891036987, 0.42724770307540894, -0.6371305584907532, 0.48568686842918396, -0.005096510984003544, 0.0844166800379753...
func ParseURL(url string) (bucket string, key string, err error) { if strings.HasPrefix(url, s3URIPrefix) { return parseS3URI(url) } return parseHTTPURI(url) }
[ -0.6480693221092224, -0.12163273990154266, 0.6279699206352234, 0.6163331270217896, -0.5792240500450134, -0.010432363487780094, -0.3174777925014496, 0.4047856628894806, 0.5756466388702393, 0.06809201836585999, -0.2484106719493866, -0.1665966510772705, 0.16133688390254974, -0.047189578413963...
func ParseARN(arn string) (bucket, key string, err error) { parsedARN, err := awsarn.Parse(arn) if err != nil { return "", "", fmt.Errorf("invalid S3 ARN: %w", err) } parts := strings.SplitN(parsedARN.Resource, "/", 2) if len(parts) == 1 { return parts[0], "", nil } return parts[0], parts[1], nil }
[ -0.9593791365623474, -1.4723694324493408, 0.7208859324455261, -0.13798175752162933, -0.7921211123466492, -0.23771637678146362, -0.544601559638977, -0.027837635949254036, 0.009334362111985683, -0.09653256833553314, -0.33817973732948303, 0.7616053223609924, 0.5269011855125427, 0.470336765050...
func Location(bucket, key string) string { return fmt.Sprintf("s3://%s/%s", bucket, key) }
[ -0.16110491752624512, -1.5138846635818481, 0.3624242842197418, -0.5619290471076965, -0.4731728136539459, 1.0473459959030151, -0.07772836089134216, 0.3273738920688629, -0.42528799176216125, 1.2195504903793335, 0.23551900684833527, 0.5334766507148743, 0.5807299613952637, -1.1855790615081787,...
func FormatARN(partition, location string) string { return fmt.Sprintf("arn:%s:s3:::%s", partition, location) }
[ 0.30223220586776733, -2.281883716583252, 0.6031938195228577, -0.07133202999830246, -0.4375433325767517, -0.0019090640125796199, -0.6869383454322815, 1.1650358438491821, 0.20494595170021057, -0.023688362911343575, 0.8063443303108215, 1.5276870727539062, 1.0145788192749023, -0.29674032330513...
func (s *S3) BucketTree(bucket string) (string, error) { outputs, err := s.listObjects(bucket, "/") if err != nil || outputs == nil { return "", err } var contents []*s3.Object var prefixes []*s3.CommonPrefix for _, output := range outputs { contents = append(contents, output.Contents...) prefixes = append(...
[ -0.039339058101177216, 0.13977593183517456, 0.7530911564826965, -0.8524132370948792, -1.1971224546432495, 0.411844938993454, 0.041291121393442154, -0.9149510264396667, 0.3285263776779175, 0.039196860045194626, 0.16652651131153107, -0.25210097432136536, -0.06709758937358856, 0.2214710712432...
func (s *S3) BucketSizeAndCount(bucket string) (string, int, error) { outputs, err := s.listObjects(bucket, "") if err != nil || outputs == nil { return "", 0, err } var size int64 var count int for _, output := range outputs { for _, object := range output.Contents { size += aws.Int64Value(object.Size) ...
[ -0.015139885246753693, -1.0610108375549316, 0.8171259760856628, -0.6880400776863098, -0.7966201305389404, -0.3704999089241028, 0.7171424031257629, 0.1358284205198288, 0.14838671684265137, 0.14126577973365784, -0.7678673267364502, -0.5596651434898376, 0.5463809967041016, 0.3805265724658966,...
func parseS3URI(uri string) (bucket, key string, err error) { parsed := strings.SplitN(strings.TrimPrefix(uri, s3URIPrefix), "/", 2) bucket = parsed[0] if bucket == "" { return "", "", fmt.Errorf("cannot parse S3 URI %s into bucket name and key", uri) } if len(parsed) == 2 { key = parsed[1] } return }
[ -0.8919852375984192, -0.4738352596759796, 0.627248227596283, 0.14248797297477722, -0.4555807411670685, 0.08717691898345947, -0.4337943196296692, -0.014737705700099468, 0.09697146713733673, 0.05458678677678108, -0.6378534436225891, 0.08134366571903229, -0.523970901966095, -0.932991683483123...
func parseHTTPURI(url string) (bucket, key string, err error) { parsedURL := strings.SplitN(strings.TrimPrefix(url, "https://"), "/", 2) // go through the host backwards and find the first piece that // starts with 's3' - the rest of the host (to the left of 's3') // is the bucket name. this is to support both URL...
[ -0.5485634803771973, -0.6464155912399292, 0.9926710724830627, -0.01321397628635168, -0.4979616701602936, 0.013494032435119152, -0.059733495116233826, 0.06286151707172394, -0.5545034408569336, 0.4055177867412567, -0.7165384292602539, 0.12487080693244934, -0.4551307260990143, -0.078330367803...
func NewPaymentRequestReviewedProcessor(db *pop.Connection, logger Logger, fetcher services.PaymentRequestReviewedFetcher, generator services.GHCPaymentRequestInvoiceGenerator, runSendToSyncada bool, gexSender services.GexSender, sftpSender services.SyncadaSFTPSender) services.PaymentRequestReviewedProcessor { ...
[ -1.0897833108901978, -0.5459268689155579, 0.2731272578239441, -1.2114155292510986, -1.616403579711914, 0.5221588015556335, -1.4039607048034668, -0.06045251712203026, 0.360627144575119, -0.4803623557090759, 0.7913548946380615, 1.0595368146896362, -0.19350899755954742, 0.9781516194343567, ...
func InitNewPaymentRequestReviewedProcessor(db *pop.Connection, logger Logger, sendToSyncada bool, icnSequencer sequence.Sequencer) (services.PaymentRequestReviewedProcessor, error) { reviewedPaymentRequestFetcher := NewPaymentRequestReviewedFetcher(db) generator := invoice.NewGHCPaymentRequestInvoiceGenerator(db, ic...
[ -0.7422780990600586, -0.23161037266254425, 0.549339234828949, -0.6302425265312195, -1.1764229536056519, 0.009236686863005161, -0.9246655702590942, 0.05166760832071304, 0.23157274723052979, -0.23613117635250092, 0.3717770576477051, 0.8560953140258789, -0.014151629991829395, 0.84004855155944...
func isNil(a *interface{}) bool { //defer func() { recover() }() //return *a == nil || reflect.ValueOf(*a).IsNil() return *a == nil }
[ -0.4800318479537964, -0.4465178847312927, 0.47275033593177795, 0.2774185836315155, -0.4909493923187256, 0.11812770366668701, 0.38745975494384766, -0.42907607555389404, 1.379056453704834, 0.056091196835041046, -0.7092519998550415, 0.37525880336761475, -0.10501728951931, 0.8073469996452332, ...
func StructToMap(a interface{}) (IObject, error) { b, err := json.Marshal(a) if err != nil { return nil, TypeConvertError{} } var f interface{} err = json.Unmarshal(b, &f) if res, ok := f.(map[string]interface{}); ok { return NewObject(res) } return nil, TypeConvertError{} }
[ -1.0354747772216797, -0.8060601949691772, 0.8998228907585144, -0.4882482588291168, -1.1763992309570312, -0.2971019446849823, 0.1662258505821228, -0.8211738467216492, 0.7335103154182434, 0.4814543128013611, -0.7581095695495605, -0.21168561279773712, 0.1099376529455185, -0.9943740963935852, ...
func Jwt() gin.HandlerFunc { return func(c *gin.Context) { authHeader := c.Request.Header["Authorization"] // Validate that Authorization header is present if authHeader == nil { e := errors.UnauthorizedError(1002, "Missing Authorization header") c.AbortWithStatusJSON(e.HttpStatus, e) return } jwt...
[ 0.1683473140001297, -0.28873974084854126, 0.8606953620910645, 0.37800467014312744, -0.7156991958618164, -0.11191196739673615, 0.10648391395807266, -0.43685367703437805, -0.18766407668590546, -0.11875065416097641, 0.08333525061607361, 0.487493634223938, 0.7441114783287048, -0.91403329372406...
func IsEmpty(s string) bool { return len(s) == 0 }
[ -0.6908341646194458, -0.5676676034927368, 0.027497833594679832, -0.19087523221969604, 0.5372388958930969, 0.09752440452575684, -0.29466527700424194, 0.2960720658302307, 0.5096344947814941, 0.17598751187324524, -0.3799281120300293, 0.6176115274429321, -0.055447254329919815, -0.8180444240570...
func Left(s string, n int) string { if n < 1 { return "" } runes := []rune(s) if n >= len(runes) { return s } return string(runes[:n]) }
[ 1.2817867994308472, 0.5930801033973694, 0.0891028419137001, -0.345782071352005, -0.3376343846321106, 0.15407584607601166, -0.7127813696861267, -1.132495641708374, 0.7528091073036194, 0.2958293557167053, 0.4900648593902588, 0.4266357719898224, -0.6833727955818176, -0.04869621619582176, 1....
func Right(s string, n int) string { runes := []rune(s) if n < 1 { return "" } if n >= len(runes) { return s } return string(runes[len(runes)-n:]) }
[ 0.6407461166381836, 1.1325916051864624, 0.44162383675575256, 0.3691326081752777, -0.7109202146530151, -0.00009820126433623955, -1.1906167268753052, -0.9306709170341492, -0.04744711145758629, 0.39429882168769836, 0.8360061049461365, 1.0070797204971313, -0.4454828202724457, 0.116073995828628...
func Mid(s string, start, length int) string { if start < 0 { start = 0 } if start > len(s) { return "" } if length < 1 { return "" } runes := []rune(s) if start > len(runes) { return "" } if start+length > len(runes) { return string(runes[start:]) } return string(runes[start : start+length]) }
[ 0.3732036054134369, -0.3050163686275482, 0.42692339420318604, -0.31568214297294617, -1.3549582958221436, -0.5302594304084778, -0.9232216477394104, -1.0219639539718628, 0.7139274477958679, 0.24743258953094482, 0.9438364505767822, 0.963587760925293, -1.2795833349227905, -0.7553332448005676, ...
func Len(s string) int { if s == "" { return 0 } return utf8.RuneCountInString(s) }
[ 0.6505865454673767, 0.3581593334674835, 0.024203641340136528, -0.4648111164569855, -0.2895299792289734, -0.6399222016334534, 1.1149110794067383, 1.3836671113967896, 0.4503549039363861, -0.4888159930706024, 0.046120330691337585, 0.2856031358242035, 0.2407693862915039, -0.35874924063682556, ...
func Space(count int) string { return strings.Repeat(" ", count) }
[ 0.3723987936973572, 0.7711016535758972, 0.24395814538002014, -0.23649974167346954, 0.1654551476240158, 0.870138943195343, -0.09994005411863327, -0.8652154803276062, 0.5129022002220154, -0.33364337682724, 0.07488137483596802, 0.3998432159423828, 0.1183706745505333, 0.07612601667642593, -0...
func CIt(text string, body func(context.Context), timeout time.Duration) { ginkgo.It(text, contextify(body, timeout), timeout.Seconds()) }
[ 1.0893839597702026, -0.016679828986525536, 0.3236406743526459, -0.7358124256134033, -0.31830430030822754, 0.2440258264541626, -0.6671199798583984, 0.13376688957214355, -0.7889385223388672, 1.210158348083496, 0.047575004398822784, 0.7568151950836182, -0.27795693278312683, -0.263044148683548...
func FCIt(text string, body func(context.Context), timeout time.Duration) { ginkgo.FIt(text, contextify(body, timeout), timeout.Seconds()) }
[ 0.5633413791656494, 0.6379015445709229, 0.30763986706733704, -0.036514535546302795, -0.5219579935073853, 0.0297117717564106, -0.4489247798919678, 0.179997056722641, -0.9063900113105774, 0.12343410402536392, 0.0011041085235774517, 0.7771146893501282, -0.27490487694740295, -0.102686159312725...
func CAfterSuite(body func(context.Context), timeout time.Duration) { ginkgo.AfterSuite(contextify(body, timeout), timeout.Seconds()) }
[ 0.3931940495967865, -0.08120030909776688, 0.3801622986793518, 0.22320032119750977, -0.777836799621582, 0.16649745404720306, 0.04300730675458908, 0.021451454609632492, -0.24516193568706512, 0.28007060289382935, -0.2111092507839203, 0.6742711067199707, 0.2718295454978943, 0.07506029307842255...
func CAfterEach(body func(context.Context), timeout time.Duration) { ginkgo.AfterEach(contextify(body, timeout), timeout.Seconds()) }
[ 0.9901604652404785, 0.29229581356048584, 0.33315640687942505, -0.09934791922569275, 0.029977714642882347, -0.11845829337835312, 0.005117669701576233, -0.12605923414230347, -0.5212247371673584, 0.3274169862270355, -0.33489617705345154, 1.1034029722213745, 0.21911834180355072, 0.013773908838...
func CBeforeSuite(body func(context.Context), timeout time.Duration) { ginkgo.BeforeSuite(contextify(body, timeout), timeout.Seconds()) }
[ 0.6018462777137756, 0.4902285635471344, 0.4422091841697693, -0.04489781707525253, -0.011361842043697834, -0.2865469753742218, 0.04284394532442093, -0.3643191158771515, 0.0930912047624588, 1.0886186361312866, 0.12266699969768524, 1.5317573547363281, 0.25956419110298157, 0.27680760622024536,...
func CBeforeEach(body func(ctx context.Context), timeout time.Duration) { ginkgo.BeforeEach(contextify(body, timeout), timeout.Seconds()) }
[ 0.9434201121330261, 0.4399743974208832, 0.3833041191101074, -0.2785305082798004, 0.3707194924354553, 0.10727573186159134, 0.18496055901050568, -0.5537054538726807, -0.3475543260574341, 1.0896551609039307, -0.14211344718933105, 1.4225436449050903, 0.32711660861968994, 0.8300950527191162, ...
func CJustBeforeEach(body func(ctx context.Context), timeout time.Duration) { ginkgo.JustBeforeEach(contextify(body, timeout), timeout.Seconds()) }
[ 1.2164820432662964, 0.15591919422149658, 0.4399486184120178, -0.33835265040397644, -0.6248341798782349, 0.4125409424304962, 0.5405901670455933, -0.1445392370223999, 0.05234985798597336, 1.167847990989685, 0.04887329787015915, 0.6123535633087158, 0.31633567810058594, 0.8257903456687927, -...
func (db *Database) AddOrIgnoreSighting(name string, ip net.IP, serverID int64) { db.mutex.Lock() defer db.mutex.Unlock() _, err := db.Exec("insert or ignore into `sightings` (`combination`, `server`) values (?, ?)", db.getCombinationID(name, ip), serverID) if err != nil { log.Fatalln("error inserting new sighti...
[ -0.9150382280349731, 0.2482881098985672, 0.7364389300346375, -0.09012935310602188, 0.032923318445682526, 0.5638893246650696, 0.014629283919930458, 0.5388380289077759, 0.3904763460159302, 0.28984835743904114, 0.14730803668498993, -0.7367892265319824, -0.9975925087928772, 0.5696645975112915,...
func InitGraph() { graph.Rooms = make(map[string]Room) // graph.steps = make(map[int]string) }
[ -0.7652204036712646, 0.11238351464271545, 0.3583433926105499, 0.5491114258766174, -0.8621360659599304, 0.39282655715942383, 0.030428757891058922, 0.804960310459137, -0.5713893175125122, 0.44708251953125, -1.3577958345413208, 0.23296402394771576, -0.13916721940040588, 0.5940690040588379, ...
func SendData(rw http.ResponseWriter, req *http.Request) { json.NewEncoder(rw).Encode(graph) }
[ -0.3643668591976166, -0.4705919325351715, 0.38356009125709534, 0.29923567175865173, -0.10536674410104752, 0.7207986116409302, -0.0023520910181105137, -0.45894476771354675, -0.23574919998645782, 0.41683438420295715, -0.46230122447013855, 0.8846549391746521, 0.11184490472078323, 0.2358973175...
func (p *Pagination) AddScope(scope scope.Scope) { p.scopes = append(p.scopes, scope) }
[ -1.0913212299346924, 0.16728372871875763, 0.6537328958511353, 0.1385759860277176, 0.2742857336997986, -0.3107336759567261, -1.0980368852615356, 0.35102176666259766, 1.060071587562561, -0.016832932829856873, 0.6855505704879761, 0.002259159693494439, -0.38435232639312744, 0.7257590889930725,...
func (p *Pagination) Limit() (res int) { return p.limit }
[ -0.25888657569885254, 0.04271939396858215, 0.5988574028015137, 0.2561846971511841, 0.561427116394043, -0.43195629119873047, 0.6951767802238464, 0.4835992753505707, 0.5997029542922974, -0.463094025850296, 0.12136125564575195, -0.35530146956443787, -0.7950758934020996, -0.8100619316101074, ...
func (p *Pagination) Order() string { return p.order }
[ -0.444804847240448, -0.6311783790588379, 0.0015867383917793632, 0.32739347219467163, 0.15794260799884796, 0.5598903298377991, -0.7460831999778748, 0.3043306767940521, 0.20242755115032196, -0.45220720767974854, 0.35092446208000183, -0.45643946528434753, 0.35025399923324585, 0.11915843188762...
func (p *Pagination) Offset() (res int) { return p.offset }
[ -0.3955574929714203, -0.14977669715881348, 0.4879531264305115, -0.02106785774230957, -0.1783733367919922, 0.5166537165641785, 1.0938059091567993, 1.1290771961212158, 0.35707366466522217, -0.29257670044898987, 0.07367582619190216, -0.2672717273235321, -0.3667569160461426, -0.162956878542900...
func (p *Pagination) QueryMap() (res map[string][]string) { return p.queryMap }
[ -0.5568701028823853, -0.3212016224861145, 0.24879887700080872, 0.10927491635084152, 0.4439440071582794, 0.13211171329021454, 0.6661338806152344, 0.12936095893383026, 0.5850214958190918, -0.5364351868629456, 0.5604305267333984, -0.6604326963424683, -0.07739105820655823, -0.6379591226577759,...
func (p *Pagination) Scopes() []scope.Scope { return p.scopes }
[ -0.7660987973213196, -0.6958106756210327, 0.24135243892669678, 0.360836923122406, -0.006789576727896929, -0.2183050513267517, -0.4732860326766968, 0.048593394458293915, 1.3103888034820557, 0.2794254422187805, 0.464031845331192, 0.7895830869674683, -0.3928661346435547, 0.14293339848518372, ...
func (p *Pagination) MetaScopes() []scope.Scope { return p.metaScopes }
[ -0.7267447710037231, -0.5853332281112671, 0.2368248999118805, 0.26102909445762634, -0.23163820803165436, -0.10806013643741608, -0.26822468638420105, -0.11470621824264526, 1.3697785139083862, 0.7133226990699768, 0.3441217839717865, 0.49005091190338135, -0.5135801434516907, 0.254356801509857...
func NewPaginationConfig(limit int, offset int, order string, scopes ...scope.Scope) PaginationConfig { paginationConfig := Pagination{ limit: limit, offset: offset, order: order, queryMap: nil, scopes: make([]scope.Scope, 0), metaScopes: make([]scope.Scope, 0), } if len(scopes) > 0 ...
[ -0.13053908944129944, -0.10878629237413406, 0.640110969543457, -0.22257746756076813, -1.1202120780944824, -0.9600803852081299, -0.6521151065826416, 0.7247841358184814, 0.6655938029289246, 1.197728157043457, -0.38000065088272095, 0.39590904116630554, 0.5525841116905212, 1.1287938356399536, ...
func NewRequestPaginationConfig(conditions map[string][]string, filterable map[string]string) PaginationConfig { paginationConfig := Pagination{ limit: buildLimit(conditions), offset: buildOffset(conditions), order: buildOrder(conditions), queryMap: conditions, scopes: buildScope(conditio...
[ -0.7704982161521912, -0.1875629723072052, 0.6804822683334351, 0.4802737236022949, -0.9715510606765747, -0.7053701281547546, -0.2840052545070648, 0.5838218927383423, 0.13763315975666046, 0.4361405074596405, 0.18980668485164642, 0.46680936217308044, -0.050702355802059174, 0.9539558291435242,...
func NewDefaultPaginationConfig() PaginationConfig { return NewPaginationConfig(20, 0, "") }
[ 0.10922589898109436, -0.012134022079408169, 0.4345874786376953, 0.42631110548973083, -0.4986533522605896, -1.1456093788146973, 0.07097488641738892, 0.9828008413314819, 0.0307569969445467, 0.029884539544582367, -1.2493621110916138, -0.7465137243270874, -0.02441716194152832, 1.78736996650695...
func buildLimit(conditions map[string][]string) int { res := 20 if len(conditions["limit"]) > 0 { res, _ = strconv.Atoi(conditions["limit"][0]) if res > 300 { res = 300 } } return res }
[ -0.6825119256973267, -0.35275357961654663, 0.37410956621170044, -0.5462605953216553, 0.2014508694410324, -0.3236859142780304, -0.1842474788427353, 0.9230727553367615, -0.05305592343211174, 0.3595484495162964, 0.05537237599492073, 0.3854447901248932, -0.576677680015564, -0.42772161960601807...
func buildOffset(conditions map[string][]string) int { res := 0 if len(conditions["offset"]) > 0 { res, _ = strconv.Atoi(conditions["offset"][0]) } return res }
[ -1.2183563709259033, -0.5950462222099304, 0.4968348443508148, -0.6367111802101135, -0.5587362051010132, -0.05565529689192772, 0.5940485596656799, 1.4249670505523682, -0.4547220468521118, 0.2970031797885895, 0.6540002822875977, 0.2764137387275696, -0.41399770975112915, -0.050404585897922516...
func buildOrder(conditions map[string][]string) string { var orders string if len(conditions["sort"]) > 0 { orders = strings.Join(conditions["sort"], ",") return orders } return "id desc" }
[ -0.5521042346954346, -0.5818197131156921, 0.4929943382740021, 0.4190751314163208, -0.09026914089918137, -0.04836298152804375, -1.109649658203125, 0.5383877158164978, -0.535370945930481, 0.5263476967811584, 0.7946738600730896, -0.49482113122940063, -0.21088871359825134, 0.6513506770133972, ...
func buildScope(conditions map[string][]string, filterable map[string]string) []scope.Scope { scopes := make([]scope.Scope, 0) for name, value := range filterable { if len(conditions[name]) > 0 { switch value { case IdType: scopes = append(scopes, scope.WhereInScope(name, conditions[name])) case Strin...
[ -1.4208102226257324, -0.29737475514411926, 0.9693088531494141, 0.3221147358417511, -0.5367447733879089, -1.184836983680725, -0.20225508511066437, 0.005292625166475773, -0.23677954077720642, 1.2130126953125, 0.6023855805397034, -0.07617191225290298, -0.13322468101978302, -0.0001729011710267...
func OverrideKey(conditions map[string][]string, original string, replaceBy string) { if targetValue, ok := conditions[original]; ok { delete(conditions, original) conditions[replaceBy] = targetValue } }
[ -0.8109323978424072, -0.15893064439296722, 0.43356215953826904, 0.06863056868314743, 0.09186815470457077, -1.1100190877914429, 0.37260958552360535, 1.7226892709732056, -0.45750585198402405, 0.7312762141227722, 0.4921286702156067, 0.639039933681488, -0.7480958700180054, -0.06322114169597626...
func (c *Container) ID() string { return c.name }
[ 0.5477715134620667, -0.9132825136184692, 0.33160609006881714, 0.41005751490592957, -0.03333384916186333, 0.8090733885765076, 0.03990957513451576, -0.662883996963501, 1.2005009651184082, -0.279990553855896, -0.5036265254020691, -0.232108935713768, 0.2292071282863617, 1.068776249885559, 0....
func (c *Container) Name() string { return c.name }
[ -0.2526346445083618, -0.4924018085002899, 0.1825120449066162, 0.21467463672161102, -0.5641679167747498, -0.534043550491333, 0.4751802384853363, -0.7657890319824219, -0.36009153723716736, 0.6478301882743835, -0.3450177311897278, -0.28951892256736755, 0.41135185956954956, 0.8041989803314209,...
func (c *Container) Bucket() *storage.BucketHandle { return c.client.Bucket(c.name) }
[ 0.787763237953186, 0.2474869340658188, 0.20741435885429382, 0.7857156991958618, 0.26192420721054077, 0.7086796164512634, 0.6903185248374939, -1.0016381740570068, -0.11551100760698318, -1.2023568153381348, 0.5312358140945435, 0.8982810378074646, 0.7495582103729248, -0.6376839280128479, 1....
func (c *Container) Item(id string) (stow.Item, error) { item, err := c.Bucket().Object(id).Attrs(c.ctx) if err != nil { if err == storage.ErrObjectNotExist { return nil, stow.ErrNotFound } return nil, err } return c.convertToStowItem(item) }
[ -0.5936759114265442, -0.45587867498397827, 0.3852950632572174, 0.5295700430870056, -0.17359855771064758, 0.8432216644287109, 0.5458011627197266, -0.7807663679122925, 0.5075344443321228, 0.25512805581092834, -0.23311670124530792, 0.3241581916809082, 0.0017707205843180418, -0.452095597982406...
func (c *Container) Items(prefix string, cursor string, count int) ([]stow.Item, string, error) { query := &storage.Query{Prefix: prefix} call := c.Bucket().Objects(c.ctx, query) p := iterator.NewPager(call, count, cursor) var results []*storage.ObjectAttrs nextPageToken, err := p.NextPage(&results) if err != ni...
[ -1.039731740951538, -0.32359957695007324, 0.32227781414985657, -0.19159525632858276, -0.16092126071453094, -0.19975687563419342, -0.3496648371219635, -0.10413245111703873, -0.0372224822640419, 0.7021909356117249, -0.26227158308029175, -0.14047397673130035, 0.20258116722106934, 0.0050575360...
func (c *Container) RemoveItem(id string) error { return c.Bucket().Object(id).Delete(c.ctx) }
[ -0.4860535264015198, -0.17724518477916718, 0.19645802676677704, 0.16758699715137482, 0.13841503858566284, 0.5771034955978394, -0.025298865512013435, -0.3162744343280792, 0.3433109223842621, -0.28127768635749817, -0.5127410888671875, -0.29916369915008545, 0.18630613386631012, -0.56768614053...
func (c *Container) Put(name string, r io.Reader, size int64, metadata map[string]interface{}) (stow.Item, error) { obj := c.Bucket().Object(name) mdPrepped, err := prepMetadata(metadata) if err != nil { return nil, err } w := obj.NewWriter(c.ctx) w.ObjectAttrs.Metadata = merge(w.ObjectAttrs.Metadata, mdPrepp...
[ -0.2988581955432892, 0.28950217366218567, 0.8192209601402283, -0.6062905192375183, -0.4537084996700287, 0.5738404989242554, 0.4227103888988495, -0.36462435126304626, -0.6545056104660034, 0.8305497765541077, -0.4830968677997589, 0.19313944876194, -0.4181312024593353, -0.7118527889251709, ...
func (rf *Raft) GetState() (int, bool) { var term int var isleader bool // Your code here (2A). rf.mu.Lock() term = rf.currentTerm isleader = (rf.state == StateLeader) rf.mu.Unlock() return term, isleader }
[ -0.12681899964809418, -0.3617098033428192, 0.648865282535553, 0.8197613954544067, -0.3077540695667267, -0.8925767540931702, 0.3359745442867279, -0.20286373794078827, 0.22436939179897308, 0.03766380622982979, -0.7998101115226746, 1.022460699081421, -1.0236973762512207, 0.578018069267273, ...
func (rf *Raft) persist() { // Your code here (2C). // Example: // w := new(bytes.Buffer) // e := gob.NewEncoder(w) // e.Encode(rf.xxx) // e.Encode(rf.yyy) // data := w.Bytes() // rf.persister.SaveRaftState(data) buf := new(bytes.Buffer) encoder := gob.NewEncoder(buf) // rf.mu.Lock() encoder.En...
[ 0.0599265918135643, -0.04178280383348465, 0.7553330063819885, 0.048957813531160355, 0.6060971021652222, 0.265913724899292, 0.5709092617034912, -0.2826913595199585, 0.18341834843158722, -0.17782951891422272, -1.1801934242248535, -0.1639038473367691, -1.0388336181640625, 0.3541520833969116, ...
func (rf *Raft) readPersist(data []byte) { // Your code here (2C). // Example: // r := bytes.NewBuffer(data) // d := gob.NewDecoder(r) // d.Decode(&rf.xxx) // d.Decode(&rf.yyy) if data == nil || len(data) < 1 { // bootstrap without any state? return } buf := bytes.NewBuffer(data) decoder := gob....
[ -0.3027767837047577, -0.31855762004852295, 0.7578341364860535, 0.8176129460334778, 0.2141696810722351, -0.2891194522380829, 0.007130410987883806, 0.5634130835533142, 0.3075656294822693, -0.3828335106372833, 0.0022540322970598936, -0.050226401537656784, -0.6695746183395386, 0.03565723448991...
func compareLog(lastTermA int, lastIndexA int, lastTermB int, lastIndexB int) bool { if lastTermA != lastTermB { return lastTermA < lastTermB } return lastIndexA < lastIndexB }
[ 0.8878602981567383, -0.9746199250221252, 0.7446771264076233, -0.40406927466392517, 0.05510463938117027, -0.07169687002897263, 0.1728844791650772, -0.7515727281570435, -0.4332295358181, 0.5754091739654541, 0.4011012315750122, 0.16866080462932587, -0.8292518854141235, -0.3964640498161316, ...
func (rf *Raft) sendRequestVote(server int, args *RequestVoteArgs, reply *RequestVoteReply) bool { ok := rf.peers[server].Call("Raft.RequestVote", args, reply) return ok }
[ -1.7217257022857666, 0.6659510135650635, 0.8312348127365112, 0.7307031750679016, 0.17303933203220367, 0.21706810593605042, -0.9719288349151611, -0.5586418509483337, -0.4343738853931427, 0.06299328804016113, -0.05966845154762268, 0.571821928024292, -1.641867995262146, 0.05286068469285965, ...
func (rf *Raft) Start(command interface{}) (int, int, bool) { rf.mu.Lock() defer rf.mu.Unlock() if rf.state != StateLeader { return nilIndex, nilIndex, false } // Your code here (2B). logLen := len(rf.log) index := logLen term := rf.currentTerm isLeader := true thisEntry := LogEntry{rf.curre...
[ -0.15713495016098022, -0.08255288004875183, 0.6002534627914429, -0.0863451361656189, 0.022532597184181213, -0.12671510875225067, 0.797589123249054, 0.10405351966619492, -0.1983967125415802, 0.2315029501914978, -1.3364771604537964, 0.9204577207565308, -0.759734570980072, 0.02453747950494289...
func (rf *Raft) Kill() { // Your code here, if desired. rf.print("is killed") // TODO: exit go routines if killed rf.isKilled = true }
[ 0.5071719288825989, -0.1894388347864151, 0.45192891359329224, 1.6949208974838257, 0.8739844560623169, 0.6799518465995789, 0.7204599380493164, 0.454052597284317, 0.21455581486225128, 0.24877899885177612, -0.8078358173370361, 1.391157865524292, -0.6317356824874878, -0.010097946971654892, -...
func Make(peers []*labrpc.ClientEnd, me int, persister *Persister, applyCh chan ApplyMsg) *Raft { rf := &Raft{} rf.peers = peers rf.persister = persister rf.me = me // Your initialization code here (2A, 2B, 2C). rf.state = StateFollower rf.commitIndex = 0 rf.votedFor = nilIndex rf.lastApplied = 0 ...
[ -0.012038754299283028, -0.0006317157531157136, 1.0145509243011475, 0.36473217606544495, -0.09781806170940399, -0.07045742124319077, 0.21565046906471252, -0.2288065403699875, -0.08374673128128052, -0.6208613514900208, 0.0662110447883606, 0.7201465964317322, -0.18698909878730774, 0.559175729...
func NewWriter(w io.Writer) *Writer { return &Writer{ w: bufio.NewWriter(w), LineEnding: "\n", //set default line ending } }
[ 0.5369189977645874, -0.0642586275935173, 0.021568698808550835, 0.7013124227523804, -0.02543584629893303, -0.5556539297103882, -0.22715026140213013, -0.21161209046840668, -0.13117752969264984, -0.3837629556655884, -0.1529221534729004, -0.8285646438598633, 0.39956068992614746, 0.070984974503...