MCPcopy
hub / github.com/dgraph-io/dgraph / commit

Method commit

dgraph/cmd/zero/oracle.go:123–142  ·  view source on GitHub ↗
(src *api.TxnContext)

Source from the content-addressed store, hash-verified

121}
122
123func (o *Oracle) commit(src *api.TxnContext) error {
124 o.Lock()
125 defer o.Unlock()
126
127 if o.hasConflict(src) {
128 return x.ErrConflict
129 }
130 // We store src.Keys as string to ensure compatibility with all the various language clients we
131 // have. But, really they are just uint64s encoded as strings. We use base 36 during creation of
132 // these keys in FillContext in posting/mvcc.go.
133 for _, k := range src.Keys {
134 ki, err := strconv.ParseUint(k, 36, 64)
135 if err != nil {
136 glog.Errorf("Got error while parsing conflict key %q: %v\n", k, err)
137 continue
138 }
139 o.keyCommit.Set(ki, src.CommitTs) // CommitTs is handed out before calling this func.
140 }
141 return nil
142}
143
144func (o *Oracle) currentState() *pb.OracleDelta {
145 o.AssertRLock()

Callers 1

commitMethod · 0.45

Calls 5

hasConflictMethod · 0.95
SetMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected