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

Method Delete

schema/schema.go:92–110  ·  view source on GitHub ↗

Delete updates the schema in memory and disk

(attr string, ts uint64)

Source from the content-addressed store, hash-verified

90
91// Delete updates the schema in memory and disk
92func (s *state) Delete(attr string, ts uint64) error {
93 s.Lock()
94 defer s.Unlock()
95
96 glog.Infof("Deleting schema for predicate: [%s]", attr)
97 txn := pstore.NewTransactionAt(ts, true)
98 defer txn.Discard()
99 if err := txn.Delete(x.SchemaKey(attr)); err != nil {
100 return err
101 }
102 // Delete is called rarely so sync write should be fine.
103 if err := txn.CommitAt(ts, nil); err != nil {
104 return err
105 }
106
107 delete(s.predicate, attr)
108 delete(s.mutSchema, attr)
109 return nil
110}
111
112// DeleteType updates the schema in memory and disk
113func (s *state) DeleteType(typeName string, ts uint64) error {

Callers 8

proposeAndWaitMethod · 0.45
blockTabletMethod · 0.45
initTestExportFunction · 0.45
proposeAndWaitMethod · 0.45
DeletePredicateFunction · 0.45
DeleteTypeMethod · 0.45
deleteMethod · 0.45

Calls 4

SchemaKeyFunction · 0.92
InfofMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 2

initTestExportFunction · 0.36