MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / updateType

Function updateType

worker/mutation.go:339–354  ·  view source on GitHub ↗

We commit schema to disk in blocking way, should be ok because this happens only during schema mutations or we see a new predicate.

(typeName string, t *pb.TypeUpdate, ts uint64)

Source from the content-addressed store, hash-verified

337// We commit schema to disk in blocking way, should be ok because this happens
338// only during schema mutations or we see a new predicate.
339func updateType(typeName string, t *pb.TypeUpdate, ts uint64) error {
340 schema.State().SetType(typeName, t)
341 txn := pstore.NewTransactionAt(ts, true)
342 defer txn.Discard()
343 data, err := proto.Marshal(t)
344 x.Check(err)
345 e := &badger.Entry{
346 Key: x.TypeKey(typeName),
347 Value: data,
348 UserMeta: posting.BitSchemaPosting,
349 }
350 if err := txn.SetEntry(e.WithDiscard()); err != nil {
351 return err
352 }
353 return txn.CommitAt(ts, nil)
354}
355
356func hasEdges(attr string, startTs uint64) bool {
357 pk := x.ParsedKey{Attr: attr}

Callers 4

applyInitialTypesMethod · 0.85
runTypeMutationFunction · 0.85
applyMutationsMethod · 0.85
applyInitialTypesFunction · 0.85

Calls 4

StateFunction · 0.92
CheckFunction · 0.92
TypeKeyFunction · 0.92
SetTypeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…