id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c14000
nil } return s.columns(s.pkNames, nil) }
c14001
} } } if len(exclude) > 0 { for _, name := range exclude { if fi, ok := s.nameMap[name]; ok { delete(v, fi.dbName) } } } return v }
c14002
return nil } a = a.Elem() } } return a.Interface() }
c14003
a = indirect(a.Field(fi.path[i])) } return a.Field(fi.path[i]) }
c14004
v.Set(reflect.New(v.Type().Elem())) } v = v.Elem() } return v }
c14005
&Exp{e, params[0]} } return &Exp{e, nil} }
c14006
*LikeExp { e.escape = chars return e }
c14007
case Delete: return "delete" case Command: return "command" case Noop: return "noop" case Skip: return "skip" default: return "unknown" } }
c14008
case 'd': return Delete case 'c': return Command case 'n': return Noop case 's': return Skip default: return Unknown } }
c14009
err } err = json.Unmarshal(b, a) if err != nil { return nil, err } return a, nil } return nil, ErrNotFound{name} }
c14010
0) for i := range functions { all = append(all, i) } return all }
c14011
<-time.After(time.Second): msgSlice, err := t.pluckFromLogicalDecoding(s.(*Session), filterFn) if err != nil { log.With("db", session.db).Errorf("error plucking from logical decoding %v", err) continue } for _, msg := range msgSlice { out <- msg } } } }() return o...
c14012
log.With("op", dataMatches[3]).With("schema", schemaAndTable).Infoln("no tuple data") continue } // normalize the action var action ops.Op switch dataMatches[3] { case "INSERT": action = ops.Insert case "DELETE": action = ops.Delete case "UPDATE": action = ops.Update default: return re...
c14013
pipeline.emitMetrics() pipeline.source.pipe.Event <- events.NewExitEvent(time.Now().UnixNano(), pipeline.version, endpoints) pipeline.emitter.Stop() }
c14014
endpoints) errors := make(chan error, 2) go func() { errors <- pipeline.startErrorListener() }() go func() { errors <- pipeline.source.Start() }() return <-errors }
c14015
return err case <-pipeline.done: return nil } } }
c14016
events.NewMetricsEvent(time.Now().UnixNano(), node.path, node.pipe.MessageCount) }) }
c14017
nodes = nodes[0], nodes[1:] f(head) nodes = append(nodes, head.children...) } }
c14018
(client.Writer, error) { return newWriter(), nil }
c14019
if err != nil { return err } err = json.Unmarshal(b, conf) if err != nil { return err } return nil }
c14020
} s, ok := i.(string) if !ok { return "" } return s }
c14021
Clients[v] = &VersionedClient{constraint, creator} }
c14022
fmt.Sprintf("%s-%s", offsetPrefixDir, name))), commitlog.WithMaxSegmentBytes(1024*1024*1024), ) if err != nil { return nil, err } m.log = l err = m.buildMap() if err == io.EOF { return m, nil } return m, err }
c14023
log.With("currentOffest", currentOffset). With("providedOffset", o.LogOffset). Debugln("refusing to commit offset") return nil } _, err := m.log.Append(o.Bytes()) if err != nil { return err } m.nsMap[o.Namespace] = o.LogOffset return nil }
c14024
defer m.Unlock() return m.nsMap }
c14025
newestOffset < v { newestOffset = v } } return int64(newestOffset) }
c14026
client.InvalidURIError{URI: uri, Err: err.Error()} } c.uri = uri return nil } }
c14027
:= &tls.Config{InsecureSkipVerify: true} tlsConfig.RootCAs = x509.NewCertPool() c.tlsConfig = tlsConfig } return nil } }
c14028
} if ok := roots.AppendCertsFromPEM([]byte(cert)); !ok { return client.ErrInvalidCert } } if c.tlsConfig != nil { c.tlsConfig.RootCAs = roots } else { c.tlsConfig = &tls.Config{RootCAs: roots} } c.tlsConfig.InsecureSkipVerify = false } return nil } }
c14029
{ return nil, err } } return &Session{c.conn, c.ch}, nil }
c14030
out += fmt.Sprintf("%s", t.sourceNode.String()) return out }
c14031
b, err := json.Marshal(cfg) if err != nil { panic(err) } var c config if err = json.Unmarshal(b, &c); err != nil { panic(err) } t.config = &c } return t.vm.ToValue(t) }
c14032
return nil, adaptor.ErrFuncNotSupported{Name: "Reader()", Func: "elasticsearch"} }
c14033
(client.Writer, error) { return setupWriter(e) }
c14034
ok := d[key] return val, ok }
c14035
encoding.PutUint64(l[offsetPos:sizePos], uint64(offset)) }
c14036
return ErrEmptyPath } c.path = path return nil } }
c14037
{ c.maxSegmentBytes = max } return nil } }
c14038
return c.segments[0].BaseOffset }
c14039
defer c.mu.Unlock() return c.segments }
c14040
c.Close(); err != nil { return err } return os.RemoveAll(c.path) }
c14041
offset in segment") if offset >= lowerOffset && offset < upperOffset { break } } } log.With("offset", offset).With("segment_index", idx).Debugln("finding offset in segment") // if err := c.segments[idx].Open(); err != nil { // log.Errorf("unable to open segment, %s", err) // } position, err := c.se...
c14042
p.Event = pipe.Event } else { p.Err = make(chan error) p.Event = make(chan events.Event, 10) // buffer the event channel } return p }
c14043
} timeout := time.After(10 * time.Second) for { select { case <-timeout: log.With("path", p.path).Errorln("timeout reached waiting for Out channels to clear") return default: } if p.empty() { return } time.Sleep(1 * time.Second) } } }
c14044
case ch <- TrackedMessage{msg, off}: break A } } } }
c14045
document") } query := bson.M{} if f, ok := r.collectionFilters[c]; ok { query = bson.M(f) } query["_id"] = id err = s.DB("").C(c).Find(query).One(&result) if err != nil { err = fmt.Errorf("%s.%s %v %v", s.DB("").Name, c, id, err) } return }
c14046
return ns == o.Ns && (o.Op == "i" || o.Op == "d" || o.Op == "u") }
c14047
return client.InvalidURIError{URI: uri, Err: err.Error()} } c.uri = uri return nil } }
c14048
err != nil { return client.InvalidTimeoutError{Timeout: timeout} } c.sessionTimeout = t return nil } }
c14049
c.readPreference = mgo.Secondary case "secondarypreferred": c.readPreference = mgo.SecondaryPreferred case "nearest": c.readPreference = mgo.Nearest default: return InvalidReadPreferenceError{ReadPreference: readPreference} } return nil } }
c14050
!= nil { return nil, err } } return c.session(), nil }
c14051
c.mgoSession.Copy() return &Session{sess} }
c14052
nil { return nil, err } } return &Session{c.file}, nil }
c14053
!= os.Stdout { c.file.Close() } }
c14054
Ts: ts, Kind: "metrics", Path: path, Records: records, } return e }
c14055
"error", Path: path, Record: record, Message: message, } return e }
c14056
&client.MockReader{}, writer: &client.MockWriter{}, resumeTimeout: 60 * time.Second, writeTimeout: defaultWriteTimeout, compactionInterval: defaultCompactionInterval, } // Run the options on it for _, option := range options { if err := option(n); err != nil { return n...
c14057
a.Reader() n.reader = r return err } }
c14058
*Node) error { w, err := a.Writer(n.done, &n.wg) n.writer = w return err } }
c14059
append(parent.children, n) n.path = parent.path + "/" + n.Name n.depth = parent.depth + 1 n.pipe = pipe.NewPipe(parent.pipe, n.path) return nil } }
c14060
n.transforms = t return nil } }
c14061
commitlog.New(options...) n.clog = clog return err } }
c14062
n.resumeTimeout = timeout return nil } }
c14063
defaultWriteTimeout return nil } wt, err := time.ParseDuration(timeout) if err != nil { return err } n.writeTimeout = wt return nil } }
c14064
*Node) error { n.om = om return nil } }
c14065
defaultCompactionInterval return nil } ci, err := time.ParseDuration(interval) if err != nil { return err } n.compactionInterval = ci return nil } }
c14066
msg.Mode, Op: msg.Msg.OP(), Timestamp: uint64(msg.Timestamp), Value: b, })) if err != nil { return err } logOffset = o n.l.With("offset", logOffset).Debugln("attaching offset to message") } n.pipe.Send(msg.Msg, offset.Offset{ Namespace: msg.Msg.Namespace(), ...
c14067
range n.children { node.Stop() } }
c14068
have children return false } for _, child := range n.children { if !child.Validate() { return false } } return true }
c14069
childMap := child.Endpoints() for k, v := range childMap { m[k] = v } } return m }
c14070
return client.InvalidURIError{URI: uri, Err: err.Error()} } c.uri = uri return nil } }
c14071
if err != nil { return client.InvalidTimeoutError{Timeout: timeout} } c.sessionTimeout = t return nil } }
c14072
if err != nil { return client.InvalidTimeoutError{Timeout: timeout} } c.writeTimeout = t return nil } }
c14073
if err != nil { return client.InvalidTimeoutError{Timeout: timeout} } c.readTimeout = t return nil } }
c14074
c.session.Close(r.CloseOpts{NoReplyWait: false}) } }
c14075
namespace, MapData: d, confirm: nil, } }
c14076
*Base: m.confirm = confirm } return msg }
c14077
case bson.ObjectId: return id.Hex() default: return fmt.Sprintf("%v", id) } }
c14078
return msg.Data() } if _, ok := msg.Data()["_id"]; ok { msg.Data().Set("id", msg.ID()) msg.Data().Delete("_id") } return msg.Data() }
c14079
primary key") { // we don't care about this error return fmt.Errorf("%s\n%s", "problem inserting docs", resp.FirstError) } } if confirms != nil { confirms <- struct{}{} } return nil }
c14080
listenChan: listen, emit: emit, stop: make(chan struct{}), started: false, } }
c14081
e.started = true e.wg.Add(1) go e.startEventListener(&e.wg) } }
c14082
e.wg.Wait() e.started = false }
c14083
if err != nil { return err } defer resp.Body.Close() if resp.StatusCode != 200 && resp.StatusCode != 201 { return BadStatusError{resp.StatusCode} } return nil }) }
c14084
err := conf.Construct(a) return a, err } return nil, ErrNotFound{name} }
c14085
all = append(all, i) } return all }
c14086
for name, c := range adaptors { a := c() all[name] = a } return all }
c14087
logPath, writer: log, reader: log, maxBytes: maxBytes, BaseOffset: baseOffset, NextOffset: baseOffset, } err = s.init() if err == io.EOF { return s, nil } return s, err }
c14088
return s.Position >= s.maxBytes }
c14089
err error) { s.Lock() defer s.Unlock() return s.log.ReadAt(p, off) }
c14090
o { log.With("position", position).With("offset", o).Infoln("found offset position") return position, nil } position += size + logEntryHeaderLen // add 9 to size to include the timestamp and attribute _, err = s.log.Seek(size+9, 1) if err != nil { return 0, err } } }
c14091
[]byte(o.Namespace), Value: valBytes, Timestamp: uint64(o.Timestamp), }) return l }
c14092
*Client) error { _, err := url.Parse(uri) c.uri = uri return err } }
c14093
url.Parse(c.uri) if uri.Path != "" { c.db = uri.Path[1:] } } err := c.pqSession.Ping() return &Session{c.pqSession, c.db}, err }
c14094
| (int(le.Op) << opShift)) }
c14095
v, Timestamp: encoding.Uint64(header[tsPos:attrPos]), Mode: modeFromBytes(header), Op: opFromBytes(header), } return encoding.Uint64(header[offsetPos:sizePos]), l, nil }
c14096
the we know the value is stored // after the keyLen + 8 (4 byte size of key and value) return kvBytes[4 : keyLen+4], kvBytes[keyLen+8:], nil }
c14097
nil { if err := g.initVM(); err != nil { return nil, err } } return g.transformOne(msg) }
c14098
return u.c.execute("GET", urlStr, "") }
c14099
return u.c.execute("GET", urlStr, "") }