text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func StopContainer(ip, containerName string) (string, error) {
log.Printf("Stopping container [%s] on VM [%s]", containerName, ip)
return ssh.InvokeCommand(ip, dockercli.StopContainer+containerName)
} | [
-0.8892067670822144,
0.04025064781308174,
0.48454993963241577,
-0.16063499450683594,
-0.054125599563121796,
0.1440109759569168,
-0.0926775112748146,
-0.3420441150665283,
-0.7387394309043884,
0.6282748579978943,
0.3404666483402252,
0.4537293016910553,
-0.5519768595695496,
-0.373289972543716... |
func ExecContainer(ip, volName, containerName string) (string, error) {
log.Printf("Attaching volume [%s] on VM [%s]\n", volName, ip)
out, err := ssh.InvokeCommand(ip, dockercli.RunContainer+" -d --rm -v "+volName+
":/vol1 --name "+containerName+dockercli.TestContainer)
if err != nil {
return out, err
}
return... | [
0.3598189353942871,
-0.4164031147956848,
0.8742382526397705,
0.17091311514377594,
0.02900606580078602,
-0.10083059966564178,
0.051585786044597626,
-0.335843950510025,
-0.25899744033813477,
0.42327219247817993,
0.7848169803619385,
0.7112448811531067,
-0.4970889687538147,
0.11378731578588486... |
func IsContainerExist(ip, containerName string) bool {
log.Printf("Checking container [%s] presence on VM [%s]", containerName, ip)
out, _ := ssh.InvokeCommand(ip, dockercli.QueryContainer+containerName)
if out != "" {
log.Printf("container [%s] is present", containerName)
return true
}
return false
} | [
-0.43655648827552795,
0.016257375478744507,
0.7864359617233276,
0.24013447761535645,
0.5359627604484558,
0.023835577070713043,
-1.0275022983551025,
0.3617022633552551,
-0.30160924792289734,
1.5906727313995361,
0.653181791305542,
-0.29994118213653564,
-0.7736358642578125,
0.5606903433799744... |
func StopAllContainers(ip string) (string, error) {
log.Printf("Stopping all containers on VM [%s]\n", ip)
return ssh.InvokeCommand(ip, dockercli.StopAllContainers)
} | [
-0.5757304430007935,
-0.09319792687892914,
0.6215629577636719,
0.5821719169616699,
-0.32250097393989563,
-0.21060116589069366,
-0.8090844750404358,
-0.245273619890213,
0.020420841872692108,
0.17022114992141724,
-0.4476880729198456,
0.4171218276023865,
-0.68119215965271,
0.5386035442352295,... |
func RemoveAllContainers(ip string) (string, error) {
log.Printf("Removing all containers on VM [%s]\n", ip)
return ssh.InvokeCommand(ip, dockercli.RemoveAllContainers)
} | [
-0.176616832613945,
0.16088739037513733,
0.8268097639083862,
1.0664830207824707,
-0.8014736771583557,
-0.7720130681991577,
-0.7101486921310425,
0.20919418334960938,
0.41054290533065796,
0.2639889121055603,
-0.4100690484046936,
0.13010093569755554,
-1.3480334281921387,
0.9129271507263184,
... |
func GetVolumeProperties(volumeName, hostName string) (string, error) {
log.Printf("Getting size, disk-format and attached-to-vm for volume [%s] from vm [%s] using docker cli \n", volumeName, hostName)
cmd := dockercli.InspectVolume + volumeName + " --format ' {{index .Status.capacity.size}} {{index .Status.diskforma... | [
0.09051129966974258,
-0.5186142921447754,
0.7606388330459595,
0.24133415520191193,
0.2718607485294342,
-0.5030290484428406,
-0.5951454639434814,
-0.019325368106365204,
-0.975917637348175,
0.3706201910972595,
0.3077673614025116,
0.8680757880210876,
-0.32839569449424744,
-0.42720863223075867... |
func WriteToContainer(ip, containerName, volPath, fileName, data string) (string, error) {
log.Printf("Writing data to file [%s] in container [%s] on VM [%s]\n", fileName, containerName, ip)
writeCmd := " /bin/sh -c 'echo \"" + data + "\" > " + volPath + "/" + fileName + "'"
fullCmd := dockercli.RunCmdInContainer +... | [
0.09981172531843185,
-0.33375638723373413,
0.5205414891242981,
0.1984470635652542,
1.0650908946990967,
0.3288370668888092,
0.006070898380130529,
-0.20247702300548553,
-1.0319342613220215,
0.2552493214607239,
0.5691079497337341,
0.5548384189605713,
0.029322117567062378,
-0.22818168997764587... |
func ReadFromContainer(ip, containerName, volPath, fileName string) (string, error) {
log.Printf("Reading from file [%s] in container [%s] on VM [%s]\n", fileName, containerName, ip)
readCmd := " /bin/sh -c 'cat " + volPath + "/" + fileName + "'"
fullCmd := dockercli.RunCmdInContainer + containerName + readCmd
lo... | [
0.8252943158149719,
-0.6136277318000793,
0.8241842985153198,
0.43234750628471375,
-0.08116062730550766,
0.5632931590080261,
-0.42440667748451233,
-0.5201308727264404,
-1.187217116355896,
0.11505256593227386,
1.5860435962677002,
0.3824269473552704,
0.10944827646017075,
-0.8155311942100525,
... |
func GetVolumeStatus(hostName, volumeName string) (map[string]string, error) {
formatStr1 := " --format '{{index .Status.access}} {{index .Status \"attach-as\"}} {{index .Status.capacity.allocated}} {{index .Status.capacity.size}} {{index .Status \"clone-from\"}}"
formatStr2 := " {{index .Status \"created by VM\"}} {... | [
-0.35571154952049255,
-0.6291791796684265,
0.8965410590171814,
-0.43309372663497925,
-0.025136055424809456,
-0.48891696333885193,
-0.9215317964553833,
-0.12091855704784393,
-0.7826740145683289,
0.7257072925567627,
-0.7174696326255798,
1.1809746026992798,
-0.12865275144577026,
-0.0590811781... |
func NewBoard() *Board {
m := make(map[string]*TeamStats)
a := make([]string, 0)
return &Board{m, a}
} | [
0.4841045141220093,
0.09886810183525085,
0.32462313771247864,
0.033189333975315094,
-0.7902342081069946,
0.15066057443618774,
-0.19419066607952118,
-0.46209973096847534,
-0.02847159095108509,
-0.8257691264152527,
0.5988191962242126,
0.03143694996833801,
0.14421725273132324,
0.0080726379528... |
func (b *Board) AddResult(g Game) {
b.addMatch(g.Team1, g.Team2)
switch g.Result {
case "draw":
b.draw(g.Team1, g.Team2)
case "win":
b.win(g.Team1, g.Team2)
case "loss":
b.loss(g.Team1, g.Team2)
}
b.calcPoints(g.Team1, g.Team2)
} | [
-0.06894240528345108,
0.9025294780731201,
0.7637986540794373,
0.2832261025905609,
0.16242429614067078,
0.05966933071613312,
0.357591837644577,
-0.8971637487411499,
0.06496143341064453,
-0.3716503083705902,
-0.3149987459182739,
-0.5463793277740479,
-0.07253109663724899,
-0.1963789165019989,... |
func (b *Board) WriteBoard(buffer io.Writer) {
b.sort()
const padding = 8
w := tabwriter.NewWriter(buffer, 0, 0, padding, ' ', 0)
fmt.Fprintln(w, "Team\t| MP | W | D | L | P")
for _, v := range b.OrderTeams {
fmt.Fprintf(w, "%s\t| %d | %d | %d | %d | %d\n", v, b.Teams[v].MP, b.Teams[v].W, b.Teams[v].D, ... | [
-0.14896804094314575,
0.4150351285934448,
0.7637223601341248,
-0.37697046995162964,
0.383348286151886,
0.687110960483551,
0.609693169593811,
-0.3066064417362213,
-0.9820401072502136,
-0.5703072547912598,
0.19602608680725098,
-0.05111844092607498,
0.08352931588888168,
0.45480877161026,
0.... |
func GetLogger(syslog string, logfile string, verbose bool, debug bool, customHandler log.Handler) (shared.Logger, error) {
Log := log.New()
var handlers []log.Handler
var syshandler log.Handler
// System specific handler
syshandler = getSystemHandler(syslog, debug)
if syshandler != nil {
handlers = append(h... | [
0.3369268774986267,
-0.3407866954803467,
0.5951465368270874,
0.48132941126823425,
-0.328704833984375,
-0.3501145541667938,
-0.6541821360588074,
0.5013103485107422,
-0.1431473195552826,
-0.3872601389884949,
-0.2107159048318863,
0.3881624937057495,
-0.2738957107067108,
1.0618315935134888,
... |
func NewWriter(addr string, format string) *LogWriter {
l := &LogWriter{Addr: addr, Format: format}
connected := make(chan struct{})
go func() {
l.connect()
close(connected)
}()
select {
case <-connected:
case <-time.After(100 * time.Millisecond):
}
return l
} | [
0.0364849828183651,
-0.3264145851135254,
0.4373985230922699,
0.12650464475154877,
-0.7403962016105652,
-0.32105523347854614,
-0.47797486186027527,
-0.12563854455947876,
0.106724813580513,
0.593223512172699,
0.5208719968795776,
0.3501446545124054,
-0.13725009560585022,
-0.17183633148670197,... |
func (l *LogWriter) connect() {
if l.connecting {
return
}
l.connecting = true
var err error
for l.conn == nil {
l.conn, err = net.Dial("tcp", l.Addr)
if err != nil {
time.Sleep(time.Second)
continue
}
err = l.sendMsg([]byte(fmt.Sprintf("!!cutelog!!format=%s", l.Format)))
if err != nil {
l.Clo... | [
-0.3928016722202301,
0.2216745764017105,
0.5821354389190674,
-0.16029682755470276,
0.15210190415382385,
0.14481721818447113,
-0.36456555128097534,
-0.6604602932929993,
-1.141557216644287,
0.5655730366706848,
0.2608858644962311,
-0.30077844858169556,
0.06156276911497116,
1.071960210800171,
... |
func (l *LogWriter) Write(msg []byte) (n int, err error) {
defer func() {
if v := recover(); v != nil {
errMsg := fmt.Sprintf("gocutelog.Write panicked with value: %v", v)
err = errors.New(errMsg)
}
}()
if l.conn == nil || l.connecting {
if l.connecting == false {
go l.connect()
}
return len(msg)... | [
-1.0076022148132324,
0.9846129417419434,
0.6590426564216614,
-0.2642076015472412,
0.5310340523719788,
-0.43168672919273376,
0.4868391454219818,
0.24642233550548553,
-0.23082314431667328,
0.34534549713134766,
-0.741995632648468,
-0.44234228134155273,
-1.275769591331482,
0.9907950758934021,
... |
func (l *LogWriter) Sync() (err error) {
return
} | [
-0.2199777066707611,
-0.808210015296936,
0.32126620411872864,
0.4103415012359619,
-0.6506491899490356,
-0.07494513690471649,
0.04377080872654915,
-0.4735744893550873,
-0.5702608823776245,
0.5975664854049683,
-0.009911066852509975,
0.9799148440361023,
-0.13691215217113495,
0.450259119272232... |
func (l *LogWriter) Close() (err error) {
if l.conn != nil {
err = l.conn.Close()
l.conn = nil
}
return
} | [
0.2157220095396042,
-0.30030983686447144,
0.5465603470802307,
-0.33951276540756226,
-0.09632730484008789,
-0.4188631474971771,
-0.19150105118751526,
0.3583182692527771,
-0.9396836161613464,
-0.4649451971054077,
0.4361546039581299,
-0.35628005862236023,
-1.3608392477035522,
0.84603404998779... |
func New(uncachedCfg, cachedCfg upspin.Config, cacheDir string, maxLogBytes int64, flushBlock func(upspin.Location)) (upspin.DirServer, error) {
clog, err := openLog(uncachedCfg, ospath.Join(cacheDir, "dircache"), maxLogBytes)
if err != nil {
return nil, err
}
return &server{
uncachedCfg: uncachedCfg,
cachedC... | [
-1.307299256324768,
-0.34623953700065613,
0.5221918225288391,
-0.19311745464801788,
-1.0741808414459229,
0.29833999276161194,
0.7009422779083252,
0.569430410861969,
0.3491831123828888,
-0.6773724555969238,
-0.02273043431341648,
0.27120131254196167,
0.43430855870246887,
0.5682837963104248,
... |
func (s *server) dirFor(path upspin.PathName) (upspin.DirServer, bool, error) {
if s.authority.Transport == upspin.Unassigned {
return nil, false, errors.Str("not yet configured")
}
dir, err := bind.DirServer(s.uncachedCfg, s.authority)
if err != nil {
return nil, false, err
}
return dir, s.clog.cacheable(pat... | [
-1.6136080026626587,
0.22265037894248962,
0.6565587520599365,
-0.3117861747741699,
-0.73684161901474,
0.48807084560394287,
0.4796028435230255,
-0.21164651215076447,
0.16886457800865173,
-0.623607873916626,
0.005272913724184036,
-0.003773478791117668,
-0.03293123096227646,
0.481869101524353... |
func (s *server) Put(entry *upspin.DirEntry) (*upspin.DirEntry, error) {
op := logf("Put %q", entry.Name)
name := path.Clean(entry.Name)
if name != entry.Name {
return nil, errors.E(entry.Name, errors.Invalid, "non-canonical name")
}
dir, cacheable, err := s.dirFor(name)
if err != nil {
op.log(err)
return ... | [
-1.1032226085662842,
0.27150169014930725,
0.8164235353469849,
-0.34853434562683105,
-0.5280125141143799,
-0.16237087547779083,
0.9573349356651306,
-0.3322851359844208,
0.1614571511745453,
0.2765613794326782,
0.26796868443489075,
0.8472887873649597,
-0.26397988200187683,
0.28915315866470337... |
func (s *server) can(name upspin.PathName, right access.Right) (bool, error) {
p, err := path.Parse(name)
if err != nil {
return false, err
}
var accessEntry *upspin.DirEntry
// Creating/Deleting a root is special, don't even bother with
// WhichAccess.
if p.NElem() > 0 {
// Talk to myself to determine whi... | [
-0.5965575575828552,
-0.3972717225551605,
1.0185232162475586,
0.06837759912014008,
-0.7978070974349976,
0.06315089017152786,
0.7156793475151062,
0.04439777135848999,
-0.4281046986579895,
-0.3984774351119995,
0.7019084095954895,
0.29083994030952454,
-0.14797267317771912,
0.5944218635559082,... |
func (s *server) canPut(name upspin.PathName, de *upspin.DirEntry) (bool, error) {
right := access.Write
// The lookup should return a de as long as we have some rights
// to the file. It may be incomplete but we don't care.
ode, lookupErr := s.Lookup(name)
if de.IsDir() {
// Directories can only be created.
... | [
-0.6771987080574036,
0.11962778866291046,
0.9183434247970581,
-0.03746148198843002,
-0.5258469581604004,
0.5706912279129028,
0.7243340611457825,
0.0008843564428389072,
-0.2826496660709381,
0.18306848406791687,
0.5258411169052124,
-0.23178063333034515,
0.02505921572446823,
0.253519833087921... |
func (s *server) readAndParseAccess(de *upspin.DirEntry) (*access.Access, error) {
// First look in cache.
pa, ok := s.accessFiles[de.Name]
if ok && pa.seq == de.Sequence {
return pa.a, nil
}
// Not found or out of date. Fetch one.
contents, err := clientutil.ReadAll(s.cachedCfg, de)
if err != nil {
return ... | [
-0.3540773093700409,
-0.7121425271034241,
0.9314522743225098,
-0.5144773721694946,
-1.1155353784561157,
-0.3444979786872864,
0.929668664932251,
-0.14914700388908386,
0.7112432718276978,
0.04664313793182373,
1.24253511428833,
0.2356458306312561,
0.2564893364906311,
-0.13571389019489288,
0... |
func (s *server) loadThroughCache(name upspin.PathName) ([]byte, error) {
de, err := s.Lookup(name)
if err != nil {
return nil, err
}
rv, err := clientutil.ReadAll(s.cachedCfg, de)
return rv, err
} | [
-0.6771439909934998,
0.2935231029987335,
0.6401991248130798,
-0.7918683290481567,
-1.2592171430587769,
-0.2932897210121155,
0.13641810417175293,
-0.7612907886505127,
0.026155831292271614,
0.6760300993919373,
-0.695794403553009,
-0.05558571219444275,
-1.0358097553253174,
0.609183669090271,
... |
func path(n, m int) int {
if n == 1 || m == 1 {
return 1
}
return path(n-1, m) + path(n, m-1)
} | [
-0.24806565046310425,
0.6387995481491089,
0.4463008642196655,
0.9574973583221436,
-0.6636666059494019,
0.6911383271217346,
1.0779920816421509,
-0.5879365801811218,
0.24087287485599518,
0.3495360016822815,
0.4115554988384247,
-0.15070664882659912,
-0.8987651467323303,
0.7666634917259216,
... |
func (response *BaseResponse) GetContentBytes() []byte {
return response.contentBytes
} | [
0.06390100717544556,
-0.7195725440979004,
0.5999758243560791,
0.571595311164856,
0.23812958598136902,
0.13621027767658234,
0.30395835638046265,
-1.201506495475769,
0.3703520596027374,
-0.13263581693172455,
-0.9767976999282837,
0.05382669344544411,
-1.70552659034729,
0.08180945366621017,
... |
func (response *BaseResponse) GetContentString() string {
return response.contentString
} | [
-0.08462158590555191,
-1.547485113143921,
0.44183650612831116,
0.154155433177948,
0.09401702135801315,
0.4008425176143646,
0.5647766590118408,
-1.7283867597579956,
0.002564260270446539,
-0.5431278347969055,
0.42397940158843994,
-1.1038124561309814,
-0.3490644693374634,
-0.5502318739891052,... |
func (r ToS) MarshalText() ([]byte, error) {
return []byte(_tosValueToName[r]), nil
} | [
-0.39950111508369446,
0.4089587926864624,
0.23278720676898956,
-0.18632522225379944,
-1.2829822301864624,
-0.6433061361312866,
-0.9677413702011108,
-0.7994245290756226,
1.2958301305770874,
0.9827227592468262,
-0.7630031108856201,
0.3459702432155609,
0.15696606040000916,
-0.706201434135437,... |
func (r *ToS) UnmarshalText(data []byte) error {
if v, ok := _tosNameToValue[string(data)]; ok {
*r = v
return nil
}
return fmt.Errorf("invalid ToS %q", string(data))
} | [
0.23384632170200348,
0.7770582437515259,
0.3711431324481964,
-1.1263116598129272,
-1.3527264595031738,
-0.8340007662773132,
-0.18383799493312836,
-0.1952042281627655,
0.6857332587242126,
0.5951552391052246,
-0.3745670020580292,
-0.23598234355449677,
-0.3789668083190918,
-0.7183670401573181... |
func Remove(pkgname string, p *confparse.IniParser) error {
testdb, testdir, err := getInstallConf(p)
if err != nil {
return err
}
db, err := backends.NewBolt(path.Join(testdir, testdb))
if err != nil {
return err
}
defer db.Close()
list, err := db.Get([]byte(pkgname))
if err != nil {
return err
}
e... | [
0.3215605616569519,
0.06058211624622345,
0.5122914910316467,
0.22516784071922302,
-0.11397141218185425,
-0.676365077495575,
0.1585531383752823,
1.8585008382797241,
0.034260716289281845,
0.7402496933937073,
-0.6291353702545166,
-0.5602244734764099,
-2.0213677883148193,
0.352849543094635,
... |
func NewPageRequest(page, perPage int64, spec *Spec) *PageRequest {
if page < 1 {
page = 1
}
// set limit to per page var
if perPage <= 0 || perPage > 100 {
perPage = 100
}
return &PageRequest{
Page: page,
PerPage: perPage,
Spec: spec,
}
} | [
-0.6190099716186523,
-0.49910983443260193,
0.762588620185852,
0.4462956488132477,
-1.4114413261413574,
-0.04144404083490372,
-0.4233004152774811,
0.11136629432439804,
0.22527824342250824,
0.3652822971343994,
1.3535269498825073,
0.40095916390419006,
-0.43953877687454224,
0.8217540979385376,... |
func (p PageRequest) Offset() int64 {
return p.PerPage * (p.Page - 1)
} | [
-0.6736150979995728,
-0.04970825836062431,
0.477470338344574,
0.29088765382766724,
-1.141223669052124,
1.5554577112197876,
-0.0936412662267685,
0.4855428636074066,
0.4387088716030121,
0.044063083827495575,
0.9915492534637451,
0.46596208214759827,
-0.42334768176078796,
0.6757791042327881,
... |
func NewPage(recs interface{}, pr *PageRequest, total int64) *Page {
meta := &PageMetadata{}
meta.PageRequest = pr
meta.Total = total
// again, check per page
if pr.PerPage <= 0 || pr.PerPage > 100 {
pr.PerPage = 100
}
meta.PageCount = int64(math.Ceil(float64(total) / float64(pr.PerPage)))
page := &Page{
P... | [
-0.027107156813144684,
-0.1778261661529541,
0.8188942074775696,
-0.45303720235824585,
-0.022754399105906487,
0.7446451187133789,
-0.08708969503641129,
-0.029424818232655525,
0.026728034019470215,
0.3380914628505707,
2.0375735759735107,
-0.3207598030567169,
-0.2932758629322052,
-0.502544105... |
func NewVuePage(page *Page) *VuePage {
p := &VuePage{}
var count int // harus pisan pake reflect?
switch reflect.TypeOf(page.Data).Kind() {
case reflect.Slice:
s := reflect.ValueOf(page.Data)
count = s.Len()
default:
count = 1
}
p.CurrentPage = page.Page
if page.PageCount > 0 {
p.LastPage = page.PageCo... | [
-0.22389720380306244,
-0.5200684666633606,
0.6275115013122559,
0.006703476421535015,
-0.9352188110351562,
0.33809995651245117,
-0.1345280110836029,
0.23154984414577484,
0.16831551492214203,
1.0478570461273193,
0.4213182330131531,
-0.2951628267765045,
-0.05354506894946098,
0.340558797121048... |
func NewPaginatePage(page *Page) *PaginatePage {
var count int // harus pisan pake reflect?
switch reflect.TypeOf(page.Data).Kind() {
case reflect.Slice:
s := reflect.ValueOf(page.Data)
count = s.Len()
default:
count = 1
}
p := &Paginate{
Total: page.Total,
Count: int64(count),
PerPage: ... | [
-0.3203556537628174,
-0.4795052707195282,
0.6902435421943665,
-0.019252413883805275,
-0.4253057837486267,
-0.376637727022171,
-0.1633380949497223,
0.10194364190101624,
0.04620111361145973,
1.0743334293365479,
0.3966735601425171,
-0.6958641409873962,
-0.2747243344783783,
0.5375038981437683,... |
func main() {
// Create new server and http request multiplexer.
mux := http.NewServeMux()
server := http.Server{Addr:":8080", Handler:mux}
// For hash and stats endpoints, direct request to respective handler function.
mux.HandleFunc("/hash", hashHandler)
mux.HandleFunc("/stats", statsHandler)
// For ... | [
-0.033855460584163666,
-0.1665167361497879,
0.9972153902053833,
1.1466115713119507,
0.5036177635192871,
0.6344671845436096,
0.5074084997177124,
-0.03477569669485092,
-0.4387294352054596,
-0.35402026772499084,
0.44600337743759155,
0.29619985818862915,
0.6578410863876343,
-0.3864730596542358... |
func (s IPV4) String() string {
return fmt.Sprintf("%v.%v.%v.%v", s[0], s[1], s[2], s[3])
} | [
-0.4354361593723297,
-1.09144926071167,
0.22311809659004211,
-0.49821141362190247,
-0.20497559010982513,
0.24616722762584686,
0.12588809430599213,
-0.7241204380989075,
-0.3125728964805603,
0.20328080654144287,
-0.33008065819740295,
0.41757798194885254,
-0.148429274559021,
-1.49375414848327... |
func (s IPV4) GoString() string {
return fmt.Sprintf("%v.%v.%v.%v", s[0], s[1], s[2], s[3])
} | [
-0.5851009488105774,
0.048386573791503906,
0.6778947114944458,
-0.7631163001060486,
0.14954157173633575,
0.22730684280395508,
-0.26279035210609436,
-0.34500065445899963,
-0.5130332112312317,
0.6969362497329712,
-0.37324151396751404,
-0.04513338580727577,
-0.4495898485183716,
-1.18605542182... |
func (a anything) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Any code you want in this func")
} | [
0.40328240394592285,
-0.27217212319374084,
0.49980980157852173,
0.714020848274231,
-0.24699272215366364,
0.1739843338727951,
0.4008917808532715,
-0.11079766601324081,
-0.3859710693359375,
-0.31998273730278015,
0.18013536930084229,
0.6141641139984131,
-0.7844458818435669,
0.1780055463314056... |
func (r *wsContext) AddTxRequest(wallet walletChan, addr string) {
r.Lock()
defer r.Unlock()
clist, ok := r.txNotifications[addr]
if !ok {
clist = list.New()
r.txNotifications[addr] = clist
}
clist.PushBack(wallet)
rc := r.connections[wallet]
rc.txRequests[addr] = struct{}{}
} | [
-0.48809394240379333,
0.3011552393436432,
0.4842616319656372,
-0.8635509014129639,
-0.31057989597320557,
-0.5593606233596802,
-0.7281435132026672,
-0.042352210730314255,
0.648669958114624,
0.514446496963501,
0.052342738956213,
0.1501375138759613,
-0.33500373363494873,
0.10192905366420746,
... |
func (r *wsContext) AddSpentRequest(wallet walletChan, op *btcwire.OutPoint) {
r.Lock()
defer r.Unlock()
clist, ok := r.spentNotifications[*op]
if !ok {
clist = list.New()
r.spentNotifications[*op] = clist
}
clist.PushBack(wallet)
rc := r.connections[wallet]
rc.spentRequests[*op] = struct{}{}
} | [
-0.8817614316940308,
-0.2790142297744751,
0.6455044746398926,
-0.04336284473538399,
0.18212606012821198,
-0.27264946699142456,
0.07699887454509735,
-0.32116711139678955,
0.921718955039978,
0.47756823897361755,
-0.5107576251029968,
0.2429378181695938,
-1.4881399869918823,
0.2958469390869140... |
func (r *wsContext) RemoveSpentRequest(wallet walletChan, op *btcwire.OutPoint) {
r.Lock()
defer r.Unlock()
r.removeGlobalSpentRequest(wallet, op)
rc := r.connections[wallet]
delete(rc.spentRequests, *op)
} | [
-0.6783092021942139,
-0.7613757252693176,
0.43196022510528564,
0.09287912398576736,
-1.1216747760772705,
-0.5095570683479309,
0.5805155038833618,
0.19278669357299805,
0.8526023626327515,
1.2199726104736328,
-0.2599201798439026,
0.08209777623414993,
-2.158535957336426,
-0.0964631587266922,
... |
func (r *wsContext) AddMinedTxRequest(wallet walletChan, txID *btcwire.ShaHash) {
r.Lock()
defer r.Unlock()
clist, ok := r.minedTxNotifications[*txID]
if !ok {
clist = list.New()
r.minedTxNotifications[*txID] = clist
}
clist.PushBack(wallet)
rc := r.connections[wallet]
rc.minedTxRequests[*txID] = struct{}... | [
-0.45852822065353394,
-0.19311785697937012,
0.6601722836494446,
-0.7814014554023743,
-0.23256821930408478,
0.12234034389257431,
-1.0978076457977295,
-0.9740676283836365,
0.4356004595756531,
0.3632112741470337,
-0.4178369641304016,
-0.14622728526592255,
-1.1140309572219849,
0.58429795503616... |
func (r *wsContext) RemoveMinedTxRequest(wallet walletChan, txID *btcwire.ShaHash) {
r.Lock()
defer r.Unlock()
r.removeMinedTxRequest(wallet, txID)
} | [
-0.7451712489128113,
-0.6236105561256409,
0.27871692180633545,
-0.526967465877533,
-1.353332757949829,
-0.3089316189289093,
-0.6245838403701782,
-0.959918737411499,
0.6305014491081238,
0.7063608765602112,
-0.0010440390324220061,
-0.4001055657863617,
-1.4459031820297241,
0.2865498960018158,... |
func (r *wsContext) removeMinedTxRequest(wallet walletChan, txID *btcwire.ShaHash) {
r.removeGlobalMinedTxRequest(wallet, txID)
rc := r.connections[wallet]
delete(rc.minedTxRequests, *txID)
} | [
-0.4796448349952698,
-0.821818470954895,
0.32423558831214905,
-0.6579259634017944,
-1.3474112749099731,
0.03109108656644821,
-0.7700548768043518,
-0.6928731203079224,
0.42698854207992554,
0.7504347562789917,
-0.0777299627661705,
-0.2446558177471161,
-1.5761899948120117,
0.6490088105201721,... |
func (r *wsContext) CloseListeners(wallet walletChan) {
r.Lock()
defer r.Unlock()
delete(r.connections, wallet)
close(wallet)
} | [
-0.3423333764076233,
-1.5951515436172485,
0.30527153611183167,
-1.1471455097198486,
-0.09215349704027176,
-0.16886308789253235,
-0.6181911826133728,
-1.4402414560317993,
0.4182422459125519,
0.4046521484851837,
0.6344808340072632,
0.032614339143037796,
-1.7370320558547974,
0.738080024719238... |
func respondToAnyCmd(cmd btcjson.Cmd, s *rpcServer, wallet walletChan) {
// Lookup the websocket extension for the command and if it doesn't
// exist fallback to handling the command as a standard command.
wsHandler, ok := wsHandlers[cmd.Method()]
if !ok {
reply := standardCmdReply(cmd, s)
mreply, _ := json.Mar... | [
0.42481136322021484,
-1.1111170053482056,
0.7888399362564087,
-0.9669460654258728,
0.3268127143383026,
-1.0114874839782715,
-0.04335200786590576,
-0.6115155220031738,
0.8089496493339539,
-0.02444314770400524,
0.22036440670490265,
0.5311175584793091,
-0.49123239517211914,
1.1533751487731934... |
func handleGetCurrentNet(s *rpcServer, cmd btcjson.Cmd, wallet walletChan) error {
id := cmd.Id()
reply := &btcjson.Reply{Id: &id}
var net btcwire.BitcoinNet
if cfg.TestNet3 {
net = btcwire.TestNet3
} else {
net = btcwire.MainNet
}
reply.Result = float64(net)
mreply, _ := json.Marshal(reply)
wallet <- mr... | [
0.5134190917015076,
-0.8884491324424744,
0.5425930023193359,
-0.6108376979827881,
0.43776270747184753,
-0.024457719177007675,
-0.30081701278686523,
-0.8640869855880737,
0.1411851942539215,
0.28674453496932983,
-0.1465132236480713,
0.22871056199073792,
-1.4921778440475464,
0.755816280841827... |
func handleGetBestBlock(s *rpcServer, cmd btcjson.Cmd, wallet walletChan) error {
id := cmd.Id()
reply := &btcjson.Reply{Id: &id}
// All other "get block" commands give either the height, the
// hash, or both but require the block SHA. This gets both for
// the best block.
sha, height, err := s.server.db.Newest... | [
0.773542046546936,
-0.08158788830041885,
0.774997889995575,
0.113859161734581,
0.7211766839027405,
-0.7589645385742188,
-0.4735161066055298,
-0.7254358530044556,
-0.1712121069431305,
-0.32100558280944824,
-0.5591411590576172,
0.6016668677330017,
-0.07152743637561798,
0.8593844175338745,
... |
func handleNotifyNewTXs(s *rpcServer, cmd btcjson.Cmd, wallet walletChan) error {
id := cmd.Id()
reply := &btcjson.Reply{Id: &id}
notifyCmd, ok := cmd.(*btcws.NotifyNewTXsCmd)
if !ok {
return btcjson.ErrInternal
}
for _, addr := range notifyCmd.Addresses {
addr, err := btcutil.DecodeAddr(addr)
if err != n... | [
-0.025836270302534103,
-0.08857367932796478,
0.5995571613311768,
-0.8980147242546082,
0.1946580708026886,
-0.8591586351394653,
-0.3264160752296448,
-0.9428076148033142,
-0.08867119997739792,
0.5761187076568604,
-0.7627134323120117,
-0.28368353843688965,
-0.06734093278646469,
0.861542820930... |
func handleNotifySpent(s *rpcServer, cmd btcjson.Cmd, wallet walletChan) error {
id := cmd.Id()
reply := &btcjson.Reply{Id: &id}
notifyCmd, ok := cmd.(*btcws.NotifySpentCmd)
if !ok {
return btcjson.ErrInternal
}
s.ws.AddSpentRequest(wallet, notifyCmd.OutPoint)
mreply, _ := json.Marshal(reply)
wallet <- mre... | [
0.37349411845207214,
-0.9839240908622742,
0.5635088682174683,
-0.740570604801178,
0.4081682562828064,
-0.010973873548209667,
-0.17129738628864288,
-0.8598353862762451,
0.4716772139072418,
0.8818085789680481,
-0.7647680044174194,
0.2885625958442688,
-1.0855019092559814,
0.8692229986190796,
... |
func handleRescan(s *rpcServer, cmd btcjson.Cmd, wallet walletChan) error {
rescanCmd, ok := cmd.(*btcws.RescanCmd)
if !ok {
return btcjson.ErrInternal
}
if len(rescanCmd.Addresses) == 1 {
rpcsLog.Info("Beginning rescan for 1 address.")
} else {
rpcsLog.Infof("Beginning rescan for %v addresses.",
len(res... | [
0.46363624930381775,
-0.12699387967586517,
0.8809964060783386,
0.0438942052423954,
-0.5149171352386475,
-1.3314958810806274,
0.7050197720527649,
-0.0556807667016983,
-0.19523663818836212,
0.3661637604236603,
0.24786734580993652,
-0.23323366045951843,
-0.37398186326026917,
0.673958003520965... |
func handleWalletSendRawTransaction(s *rpcServer, cmd btcjson.Cmd, wallet walletChan) error {
result, err := handleSendRawTransaction(s, cmd)
if err != nil {
return err
}
// The result is already guaranteed to be a valid hash string if no
// error was returned above, so it's safe to ignore the error here.
txSh... | [
0.5374202728271484,
-0.12764140963554382,
0.6784002184867859,
-0.5591490268707275,
-0.01808912679553032,
-1.1402419805526733,
-0.5420190095901489,
-0.6776362657546997,
0.6924070119857788,
0.25473740696907043,
-0.7896627187728882,
-0.6522226333618164,
-0.45120853185653687,
0.320141792297363... |
func (s *rpcServer) AddWalletListener(c walletChan) {
s.ws.Lock()
rc := &requestContexts{
txRequests: make(map[string]struct{}),
spentRequests: make(map[btcwire.OutPoint]struct{}),
minedTxRequests: make(map[btcwire.ShaHash]struct{}),
}
s.ws.connections[c] = rc
s.ws.Unlock()
} | [
-0.5356213450431824,
-0.5907529592514038,
0.45656269788742065,
-1.1506359577178955,
-0.3534725308418274,
0.09931694716215134,
-0.2880108058452606,
-0.7176304459571838,
0.4374653697013855,
-0.20237018167972565,
-0.3250698447227478,
-0.3969249427318573,
-0.8515540957450867,
1.115395784378051... |
func (s *rpcServer) RemoveWalletListener(c walletChan) {
s.ws.Lock()
rc := s.ws.connections[c]
for k := range rc.txRequests {
s.ws.removeGlobalTxRequest(c, k)
}
for k := range rc.spentRequests {
s.ws.removeGlobalSpentRequest(c, &k)
}
for k := range rc.minedTxRequests {
s.ws.removeGlobalMinedTxRequest(c, &... | [
-0.16568879783153534,
-0.7912976741790771,
0.5324758887290955,
-0.8717967867851257,
-1.0246589183807373,
0.1368357241153717,
0.058194343000650406,
-0.4587852358818054,
0.16097299754619598,
0.4157906174659729,
-0.3772890567779541,
-0.763937771320343,
-1.5130326747894287,
1.2482380867004395,... |
func (s *rpcServer) walletListenerDuplicator() {
// Duplicate all messages sent across walletNotificationMaster to each
// listening wallet.
for {
select {
case ntfn := <-s.ws.walletNotificationMaster:
s.ws.RLock()
for c := range s.ws.connections {
c <- ntfn
}
s.ws.RUnlock()
case <-s.quit:
... | [
-0.17888595163822174,
-0.7027283906936646,
0.5567261576652527,
-0.7766329646110535,
-0.087099589407444,
-0.1800617128610611,
0.6147225499153137,
-0.8337469100952148,
0.461234986782074,
0.132552370429039,
-0.5490170121192932,
-0.10459618270397186,
-0.7078487277030945,
1.1978669166564941,
... |
func (s *rpcServer) walletReqsNotifications(ws *websocket.Conn) {
// Add wallet notification channel so this handler receives btcd chain
// notifications.
c := make(walletChan)
s.AddWalletListener(c)
defer s.RemoveWalletListener(c)
// msgs is a channel for all messages received over the websocket.
msgs := make(... | [
-0.18144749104976654,
-0.6659825444221497,
0.9069977402687073,
-0.43091875314712524,
0.02788463607430458,
-0.6388508081436157,
0.11357927322387695,
-0.8880406022071838,
-0.057214412838220596,
-0.11546146869659424,
0.14214572310447693,
0.3451024293899536,
-0.40791207551956177,
0.68630462884... |
func (s *rpcServer) websocketJSONHandler(wallet walletChan, msg []byte) {
s.wg.Add(1)
defer s.wg.Done()
cmd, jsonErr := parseCmd(msg)
if jsonErr != nil {
var reply btcjson.Reply
if cmd != nil {
// Unmarshaling at least a valid JSON-RPC message succeeded.
// Use the provided id for errors.
id := cmd.Id... | [
-0.22495409846305847,
-0.7446110844612122,
0.6182151436805725,
-1.0886503458023071,
-0.5999875664710999,
-0.8353683948516846,
0.35425111651420593,
-0.7151505947113037,
0.7412569522857666,
0.37535881996154785,
-0.10839851945638657,
-0.011038916185498238,
-0.8318135142326355,
0.7051750421524... |
func (s *rpcServer) NotifyBlockConnected(block *btcutil.Block) {
hash, err := block.Sha()
if err != nil {
rpcsLog.Error("Bad block; connected block notification dropped.")
return
}
// TODO: remove int32 type conversion.
ntfn := btcws.NewBlockConnectedNtfn(hash.String(),
int32(block.Height()))
mntfn, _ := j... | [
0.10676232725381851,
-0.09334056079387665,
0.5995615720748901,
-0.20441098511219025,
-0.14866220951080322,
-0.781908392906189,
-0.05852275714278221,
-0.9626237750053406,
-0.4431954324245453,
0.7317600846290588,
-0.970264732837677,
0.02351326309144497,
-0.16727708280086517,
1.1007159948349,... |
func (s *rpcServer) NotifyBlockDisconnected(block *btcutil.Block) {
hash, err := block.Sha()
if err != nil {
rpcsLog.Error("Bad block; connected block notification dropped.")
return
}
// TODO: remove int32 type conversion.
ntfn := btcws.NewBlockDisconnectedNtfn(hash.String(),
int32(block.Height()))
mntfn, ... | [
0.1401926577091217,
-0.39379575848579407,
0.5097065567970276,
-0.15563341975212097,
-0.2053045630455017,
-0.011194377206265926,
-0.17279371619224548,
-0.7379026412963867,
0.06260490417480469,
0.03838000074028969,
-1.6705701351165771,
0.34902438521385193,
0.04254710674285889,
1.106619000434... |
func (s *rpcServer) NotifyBlockTXs(db btcdb.Db, block *btcutil.Block) {
for _, tx := range block.Transactions() {
s.newBlockNotifyCheckTxIn(tx)
s.NotifyForTxOuts(tx, block)
}
} | [
0.1861395537853241,
-0.05912753939628601,
0.38544684648513794,
0.23470358550548553,
-0.3659038841724396,
-1.2837015390396118,
-0.23221765458583832,
-0.29481491446495056,
-0.6498416662216187,
0.8881281018257141,
-0.6955779194831848,
0.20648762583732605,
0.023587603121995926,
0.8803407549858... |
func (s *rpcServer) newBlockNotifyCheckTxIn(tx *btcutil.Tx) {
for _, txin := range tx.MsgTx().TxIn {
if clist, ok := s.ws.spentNotifications[txin.PreviousOutpoint]; ok {
var enext *list.Element
for e := clist.Front(); e != nil; e = enext {
enext = e.Next()
c := e.Value.(walletChan)
notifySpentData(... | [
0.4430725872516632,
-0.4856276214122772,
0.7623769044876099,
-0.10932404547929764,
-0.21535176038742065,
-0.2735893428325653,
0.20170462131500244,
-0.33659639954566956,
-0.1312331259250641,
1.1835561990737915,
-0.38217365741729736,
-0.1146470382809639,
-0.6539566516876221,
0.48105171322822... |
func (s *rpcServer) NotifyForTxOuts(tx *btcutil.Tx, block *btcutil.Block) {
for i, txout := range tx.MsgTx().TxOut {
_, addrs, _, err := btcscript.ExtractPkScriptAddrs(
txout.PkScript, s.server.btcnet)
if err != nil {
continue
}
for _, addr := range addrs {
// Only support pay-to-pubkey-hash right no... | [
-0.012818986549973488,
-0.012804260477423668,
0.564572274684906,
-0.932610034942627,
-0.34724321961402893,
-1.6951746940612793,
-0.2110418975353241,
-0.10600484162569046,
-0.406719833612442,
0.6343028545379639,
-1.070936679840088,
-0.3479733169078827,
0.6462228298187256,
0.8241892457008362... |
func QueueDiscoveredPage(pageq <-chan *pageloader.Request,
loadq chan<- *pageloader.Request, workQueue *queue.Items, reloadWG *sync.WaitGroup) {
defer reloadWG.Done()
var qCheck int
time.Sleep(1 * time.Second)
for {
select {
case x := <-pageq:
if website.PageVisited(website.Page{URL: x.URL}) {
continu... | [
0.06834079325199127,
-0.35765841603279114,
0.8399478197097778,
-0.2978687882423401,
0.2330058217048645,
0.3827873468399048,
-0.21987611055374146,
-0.20010726153850555,
0.6513566970825195,
0.21543459594249725,
-0.16422930359840393,
0.44291526079177856,
-0.1588003784418106,
1.143127322196960... |
func (b *Base) GetName() string {
return b.Name
} | [
0.012360061518847942,
-0.4473540484905243,
0.4821208417415619,
0.9322015047073364,
0.427508682012558,
0.31321999430656433,
-0.33497992157936096,
-0.4591189920902252,
-0.5103839039802551,
0.7484132051467896,
-0.7604668140411377,
-0.23349083960056305,
-0.7580238580703735,
0.3903304636478424,... |
func (b *Base) IsEnabled() bool {
return b.Enabled
} | [
0.18978841602802277,
-0.17743247747421265,
0.34182316064834595,
1.2091562747955322,
0.5800968408584595,
0.5974547863006592,
-0.38429728150367737,
1.1868096590042114,
0.36046943068504333,
-0.1732848435640335,
-1.2949161529541016,
0.37374618649482727,
-1.6293509006500244,
0.14167653024196625... |
func (b *Base) IsPrimaryProvider() bool {
return b.PrimaryProvider
} | [
-0.4777802526950836,
-0.08550801128149033,
0.18674714863300323,
1.0142029523849487,
0.19416499137878418,
0.40220367908477783,
-0.8867388367652893,
-0.2789266109466553,
1.654307246208191,
0.6628512740135193,
-0.6089482307434082,
0.32758572697639465,
-1.1259346008300781,
0.8665692210197449,
... |
func UInt32ToBytes(i uint32) []byte {
data := make([]byte, 4)
binary.BigEndian.PutUint32(data, i)
return data
} | [
-0.30259719491004944,
1.3843578100204468,
0.38753098249435425,
-1.1309733390808105,
0.2419704794883728,
0.43578991293907166,
-0.9294155836105347,
-1.178097128868103,
-0.040929634124040604,
0.07635873556137085,
-1.7904736995697021,
-1.4521194696426392,
-0.20931434631347656,
0.18531098961830... |
func SetDB(db *gorm.DB) {
DB = db
DB.AutoMigrate(&Reservation{}, &User{})
} | [
-0.2914031147956848,
1.6787089109420776,
0.28842684626579285,
2.2408812046051025,
0.05842668563127518,
1.0384584665298462,
-0.08882325142621994,
0.3978234529495239,
0.16039784252643585,
0.22469310462474823,
-0.06653357297182083,
0.5678127408027649,
-0.20733894407749176,
0.885381281375885,
... |
func GetProcessing() []Reservation {
var reservations []Reservation
DB.Find(&reservations)
// response := fmt.Sprintf("%v", reservations)
return reservations
} | [
-0.983798086643219,
0.7022379636764526,
0.6747211217880249,
0.0657988116145134,
0.7764526605606079,
-0.7142736911773682,
-0.6656189560890198,
0.3005163371562958,
-0.08512331545352936,
1.3818964958190918,
0.35262125730514526,
0.2648308277130127,
-0.3957454264163971,
0.520039975643158,
0.4... |
func SetProcessing(t1 time.Time, userID string) ReturnRes {
var reservation Reservation
var resMsg string
newRes := Reservation{StartTime: t1, UserSlackID: userID, RoomID: "1"}
DB.Where(Reservation{StartTime: t1, UserSlackID: "", RoomID: "1"}).First(&reservation)
fmt.Println("look up reservations", reservation)
i... | [
-0.5116564631462097,
0.5877712368965149,
0.7218687534332275,
-0.17601469159126282,
0.19881822168827057,
-0.23741641640663147,
0.2230192869901657,
0.13241901993751526,
-1.0496834516525269,
1.248046636581421,
0.2384420782327652,
-0.10091166198253632,
-0.6034581065177917,
0.5574732422828674,
... |
func CancelProcessing(reservationID string, userID string) ReturnRes {
// var reservations []Reservation
var resMsg string
var toDelete Reservation
DB.First(&toDelete, reservationID)
if toDelete.UserSlackID == userID {
resMsg = "Reservations canceled"
DB.Delete(&toDelete)
return ReturnRes{Msg: resMsg, Err: n... | [
0.404494047164917,
0.4617964029312134,
0.7095791697502136,
0.31602904200553894,
-0.20765917003154755,
-0.27918893098831177,
-0.2564767301082611,
0.493454247713089,
-0.16681358218193054,
1.2687764167785645,
0.8672204613685608,
0.04367045313119888,
-0.49185505509376526,
0.4732222259044647,
... |
func GetParsing(args []string, userID string) ReturnRes {
// valid := GetVal(args)
reservations := GetProcessing()
response := fmt.Sprintf("%v", reservations)
return ReturnRes{Msg: response, Err: nil}
} | [
-0.5566835999488831,
0.8601604104042053,
0.7046423554420471,
0.35492250323295593,
0.17191071808338165,
-0.44121915102005005,
-0.4909828007221222,
0.41470977663993835,
-0.4101732075214386,
0.31174832582473755,
0.6186406016349792,
0.29568052291870117,
-0.8684371709823608,
0.05093816295266151... |
func SetParsing(args []string, userID string) ReturnRes {
numArgs := len(args)
if numArgs != 1 {
return returnHelp
}
t1, e := time.Parse(time.RFC3339, args[0])
if e != nil {
return ReturnRes{Msg: helpString, Err: e}
}
startTime := t1.Truncate(30 * time.Minute)
response := SetProcessing(startTime, userID)
r... | [
-0.11412486433982849,
0.41397297382354736,
0.5925868153572083,
0.0893138125538826,
0.1929733008146286,
0.3724766969680786,
-0.007138604763895273,
-0.2400771677494049,
-0.10542642325162888,
0.5947914123535156,
0.27683350443840027,
0.01595226675271988,
-0.8045081496238708,
0.4482217729091644... |
func CancelParsing(args []string, userID string) ReturnRes {
numArgs := len(args)
if numArgs != 1 {
return returnHelp
}
reservationID := args[0]
response := CancelProcessing(reservationID, userID)
return response
} | [
0.05248832702636719,
-0.27461209893226624,
0.5692446231842041,
0.3134172558784485,
-0.47618865966796875,
0.39797714352607727,
-0.04995923861861229,
1.0775330066680908,
-0.23678696155548096,
0.6765133142471313,
0.7313111424446106,
-0.3751925230026245,
-1.0523961782455444,
-0.057612452656030... |
func init() {
testing.AddTest(&testing.Test{
Func: KeysetTiedToTPM1,
Desc: "Verifies that, for TPMv1.2 devices, the keyset is tied to TPM regardless of when it's created and if a reboot happens",
Contacts: []string{
"cros-hwsec@chromium.org",
"zuan@chromium.org",
},
SoftwareDeps: []string{"tpm1"},
At... | [
-0.11317379027605057,
0.12802118062973022,
0.38463470339775085,
-0.2584195137023926,
0.6996886730194092,
0.5973665714263916,
0.25064805150032043,
-0.32095974683761597,
-0.3193737268447876,
0.31235823035240173,
0.29757189750671387,
0.6024837493896484,
-0.6920216679573059,
0.2681135237216949... |
func loginTakeOwnershipAndCheckKeysetTiedToTPM(ctx context.Context, s *testing.State, utility *hwsec.CryptohomeClient, helper *hwsecremote.CmdHelperRemote, reboot bool) {
// Reset TPM.
if err := helper.EnsureTPMAndSystemStateAreReset(ctx); err != nil {
s.Fatal("Failed to ensure resetting TPM: ", err)
}
s.Log("TPM... | [
-0.15466468036174774,
0.13339123129844666,
0.6592094302177429,
0.636764407157898,
0.6127116680145264,
-0.23799249529838562,
0.5750122666358948,
-0.9184961915016174,
0.7411153316497803,
0.3009273409843445,
-0.15409840643405914,
-0.24372054636478424,
-0.5564681887626648,
-0.22388789057731628... |
func KeysetTiedToTPM1(ctx context.Context, s *testing.State) {
cmdRunner := hwsecremote.NewCmdRunner(s.DUT())
helper, err := hwsecremote.NewHelper(cmdRunner, s.DUT())
if err != nil {
s.Fatal("Helper creation error: ", err)
}
utility := helper.CryptohomeClient()
// First we test the case without reboot, that is... | [
-0.09539609402418137,
-0.1981339454650879,
0.5408562421798706,
0.576680600643158,
0.6286324858665466,
0.5721046924591064,
0.3657936155796051,
-0.5870091319084167,
0.3642617166042328,
0.4551049470901489,
-0.3035006523132324,
0.3903316259384155,
-0.9964489340782166,
-0.21265651285648346,
0... |
func Run() {
l := logrus.WithField("component", "main")
ctx, cancel := context.WithCancel(context.Background())
defer l.Info("Done.")
// handle termination signals
signals := make(chan os.Signal, 1)
signal.Notify(signals, unix.SIGTERM, unix.SIGINT)
go func() {
s := <-signals
signal.Stop(signals)
l.Warnf("... | [
0.13701769709587097,
-0.10058782249689102,
0.6006390452384949,
0.45947325229644775,
0.2960449755191803,
-0.12303908169269562,
0.30672070384025574,
0.4319349527359009,
-0.8385166525840759,
0.23553992807865143,
-0.4906279444694519,
-0.5516905188560486,
-0.3100866377353668,
0.6321460008621216... |
func run(ctx context.Context, cfg *config.Config, configFilepath string) {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
// Actions runner is currently created inside client.New.
// It should be created separately.
// TODO https://jira.percona.com/browse/PMM-7206
supervisor := supervisor.N... | [
0.45549729466438293,
-0.845515251159668,
0.6101258397102356,
0.3847922682762146,
0.11976879090070724,
0.08692403882741928,
1.1573716402053833,
0.5427099466323853,
-0.6233434677124023,
0.35200732946395874,
-0.5037405490875244,
0.2764435410499573,
-0.27008581161499023,
0.30526018142700195,
... |
func UpdatePostContent(db *sql.DB, post *Post, postID string) error {
updateStr := "update `wp_posts` set post_date = '" + post.PostDate + "', post_content = '" +
post.PostContent + "', post_title = '" + post.PostTitle + "', post_name = '" + post.PostName +
"', comment_status = '" + post.CommentStatus + "' where I... | [
-0.09193048626184464,
-0.8306836485862732,
0.48012033104896545,
-0.24914531409740448,
-0.9305148720741272,
0.1854640543460846,
-0.9482651352882385,
-0.7172625660896301,
-1.0685839653015137,
0.9688780903816223,
-0.33103159070014954,
0.07772444188594818,
-0.5755429267883301,
0.01896780915558... |
func (s *State) String() string {
if s == nil {
return "<nil>"
}
// sort the modules by name for consistent output
modules := make([]string, 0, len(s.Modules))
for m := range s.Modules {
modules = append(modules, m)
}
sort.Strings(modules)
var buf bytes.Buffer
for _, name := range modules {
m := s.Modu... | [
0.45490989089012146,
-0.8482949137687683,
0.3060305416584015,
-1.0726368427276611,
-0.41211193799972534,
-0.2494596540927887,
0.739105761051178,
-0.6152137517929077,
-0.06756088137626648,
0.20528332889080048,
0.5980750322341919,
0.4084097146987915,
0.39445948600769043,
0.016471246257424355... |
func (ms *Module) testString() string {
var buf bytes.Buffer
if len(ms.Resources) == 0 {
buf.WriteString("<no state>")
}
// We use AbsResourceInstance here, even though everything belongs to
// the same module, just because we have a sorting behavior defined
// for those but not for just ResourceInstance.
ad... | [
0.11195214092731476,
-0.7247217893600464,
0.5989493131637573,
-1.3143459558486938,
-0.2123592048883438,
0.07249263674020767,
0.5270150303840637,
-0.6414527297019958,
0.4018707275390625,
0.275014191865921,
0.5249456167221069,
0.32790857553482056,
0.33813193440437317,
0.4052332639694214,
-... |
func LegacyInstanceObjectID(obj *ResourceInstanceObjectSrc) string {
if obj == nil {
return "<not created>"
}
if obj.AttrsJSON != nil {
type WithID struct {
ID string `json:"id"`
}
var withID WithID
err := json.Unmarshal(obj.AttrsJSON, &withID)
if err == nil {
return withID.ID
}
} else if obj.A... | [
0.7436959743499756,
-1.179312825202942,
0.38804206252098083,
-1.2462294101715088,
-0.5166168808937073,
-0.13050495088100433,
0.16694703698158264,
-0.1322963982820511,
0.9767924547195435,
0.18251876533031464,
-0.09759638458490372,
-0.5169432163238525,
-0.07482163608074188,
-0.42542445659637... |
func From(other generic.T) T {
r := Ident
cols := other.Cols()
rows := other.Rows()
if (cols == 3 && rows == 3) || (cols == 4 && rows == 4) {
cols = 2
rows = 2
} else if !(cols == 2 && rows == 2) {
panic("Unsupported type")
}
for col := 0; col < cols; col++ {
for row := 0; row < rows; row++ {
r[col][r... | [
-0.29767149686813354,
0.005982670933008194,
0.6360921263694763,
-0.5417223572731018,
-1.1365891695022583,
-0.09397391229867935,
-0.14706087112426758,
-0.7394776940345764,
0.269709974527359,
0.5093578696250916,
0.2530021667480469,
0.1734902560710907,
0.8043644428253174,
-0.8669337034225464,... |
func Parse(s string) (r T, err error) {
_, err = fmt.Sscanf(s,
"%f %f %f %f",
&r[0][0], &r[0][1],
&r[1][0], &r[1][1],
)
return r, err
} | [
0.22948406636714935,
0.22437617182731628,
0.46047982573509216,
-0.25833654403686523,
-1.0945043563842773,
-1.1651512384414673,
0.11345374584197998,
-0.7847570180892944,
-0.5638949275016785,
0.42486143112182617,
-0.21917133033275604,
-0.3878171145915985,
-0.34989044070243835,
-1.02356290817... |
func (self *T) String() string {
return fmt.Sprintf("%s %s", self[0].String(), self[1].String())
} | [
-0.5410606265068054,
-1.3103914260864258,
0.394178181886673,
-1.2576074600219727,
0.20073632895946503,
0.8952540159225464,
-0.17462453246116638,
-0.9073240756988525,
-1.4300395250320435,
0.7614237666130066,
-0.31121957302093506,
0.22526682913303375,
0.4839908182621002,
-0.8040406107902527,... |
func (self *T) Rows() int {
return 2
} | [
-0.8093487024307251,
0.7466216087341309,
0.46944981813430786,
-0.05872141197323799,
0.07075117528438568,
0.034522973001003265,
0.19113491475582123,
0.6651512384414673,
-0.2667142152786255,
-0.46260181069374084,
-0.7016066312789917,
-0.6948803663253784,
0.07863011956214905,
0.95035183429718... |
func (self *T) Cols() int {
return 2
} | [
-1.155806303024292,
-0.33075588941574097,
0.5849835276603699,
-0.24417543411254883,
0.025776740163564682,
-0.034551601856946945,
-0.00014306791126728058,
-0.4274598956108093,
-0.9350936412811279,
-0.004421010613441467,
-1.2712897062301636,
-0.7144428491592407,
0.29295387864112854,
-0.34803... |
func (self *T) Size() int {
return 4
} | [
-0.44421935081481934,
0.4703800678253174,
0.45588594675064087,
-0.7585734724998474,
0.29299771785736084,
0.9163157343864441,
0.8484089374542236,
-0.462070107460022,
-0.4804534614086151,
0.009705071337521076,
-1.600825309753418,
-1.097626805305481,
-0.5508943200111389,
-0.053978972136974335... |
func (self *T) Slice() []float32 {
return []float32{
self[0][0], self[0][1],
self[1][0], self[1][1],
}
} | [
-0.4593392014503479,
0.02907084859907627,
0.5852501392364502,
0.029208200052380562,
0.6122887134552002,
0.6665879487991333,
-0.4258420765399933,
-1.012871265411377,
-0.8521170616149902,
0.673719048500061,
-0.7871688604354858,
-0.1952683925628662,
0.5000538229942322,
0.27497443556785583,
... |
func (self *T) Get(col, row int) float32 {
return self[col][row]
} | [
0.2833704650402069,
0.6930601000785828,
0.40565964579582214,
-0.4447891414165497,
0.23405125737190247,
0.11183258891105652,
-0.48773878812789917,
-1.689536690711975,
-1.322575569152832,
0.18081456422805786,
0.3853990137577057,
0.7748686075210571,
0.3008591830730438,
-0.7139332294464111,
... |
func (self *T) IsZero() bool {
return *self == Zero
} | [
-0.9488412737846375,
-0.7117363810539246,
0.30264464020729065,
1.077176570892334,
0.7639141082763672,
0.13724887371063232,
-0.08037649095058441,
0.10372380167245865,
0.21260635554790497,
0.23643967509269714,
-0.8698062896728516,
0.2404673844575882,
-0.8179922103881836,
-0.03789858520030975... |
func (self *T) Scale(f float32) *T {
self[0][0] *= f
self[1][1] *= f
return self
} | [
-0.4712674021720886,
0.7586777806282043,
0.6551428437232971,
-0.6081299781799316,
0.20339903235435486,
0.5209218859672546,
-0.6208085417747498,
-0.5176893472671509,
-1.5364601612091064,
0.7766120433807373,
-0.73917156457901,
-1.1055333614349365,
0.24686259031295776,
-0.2878193259239197,
... |
func (self *T) Scaled(f float32) T {
r := *self
return *r.Scale(f)
} | [
0.018680108711123466,
0.3175141513347626,
0.4067326784133911,
-0.4129776060581207,
-0.05502882972359657,
0.5432550311088562,
-0.4348960518836975,
-0.7109037041664124,
-1.113297462463379,
0.5794001817703247,
-1.3157200813293457,
-0.9468277096748352,
0.23779161274433136,
-0.23756705224514008... |
func (*BasicGroup) TypeID() uint32 {
return BasicGroupTypeID
} | [
-0.10606752336025238,
-0.2887774705886841,
0.4387776553630829,
0.9475192427635193,
-0.03674264997243881,
1.2539198398590088,
0.5917736291885376,
-0.8495057821273804,
-0.5321381688117981,
-0.09714540839195251,
-0.5683562755584717,
0.35622066259384155,
-1.9596076011657715,
0.7115070819854736... |
func (*BasicGroup) TypeName() string {
return "basicGroup"
} | [
-0.6239481568336487,
-0.1362030953168869,
0.49568602442741394,
0.5957993268966675,
-0.417460560798645,
0.6735307574272156,
0.27795323729515076,
-0.6040500998497009,
-0.927478015422821,
-0.20266078412532806,
-0.638526439666748,
-0.17182281613349915,
-1.1051876544952393,
0.02713737078011036,... |
func (b *BasicGroup) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "basicGroup",
ID: BasicGroupTypeID,
}
if b == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ID",
SchemaName: "id",
},
{
Name: "MemberCount",
SchemaName: "member_count",
},
{
Name... | [
0.2787492275238037,
0.28197234869003296,
0.5102587342262268,
-0.41170889139175415,
0.23285312950611115,
0.29886069893836975,
0.13110284507274628,
-0.5185741782188416,
-0.8361113667488098,
0.25388476252555847,
-0.9623838663101196,
-0.5950032472610474,
-0.8154529333114624,
-0.146610885858535... |
func (b *BasicGroup) GetID() (value int64) {
if b == nil {
return
}
return b.ID
} | [
0.15718574821949005,
0.6280157566070557,
0.28016197681427,
1.1401950120925903,
0.3124597668647766,
0.6375015377998352,
0.36417919397354126,
-0.4437222182750702,
0.388242244720459,
-0.432615727186203,
-0.06867026537656784,
-0.6822157502174377,
-1.2036504745483398,
0.7337329387664795,
0.58... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.