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

Method DeleteType

schema/schema.go:113–134  ·  view source on GitHub ↗

DeleteType updates the schema in memory and disk

(typeName string, ts uint64)

Source from the content-addressed store, hash-verified

111
112// DeleteType updates the schema in memory and disk
113func (s *state) DeleteType(typeName string, ts uint64) error {
114 if s == nil {
115 return nil
116 }
117
118 s.Lock()
119 defer s.Unlock()
120
121 glog.Infof("Deleting type definition for type: [%s]", typeName)
122 txn := pstore.NewTransactionAt(ts, true)
123 defer txn.Discard()
124 if err := txn.Delete(x.TypeKey(typeName)); err != nil {
125 return err
126 }
127 // Delete is called rarely so sync write should be fine.
128 if err := txn.CommitAt(ts, nil); err != nil {
129 return err
130 }
131
132 delete(s.types, typeName)
133 return nil
134}
135
136// Namespaces returns the active namespaces based on the current types.
137func (s *state) Namespaces() map[uint64]struct{} {

Callers 2

deleteStalePredsFunction · 0.80
applyMutationsMethod · 0.80

Calls 5

TypeKeyFunction · 0.92
InfofMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected