Delete updates the schema in memory and disk
(attr string, ts uint64)
| 90 | |
| 91 | // Delete updates the schema in memory and disk |
| 92 | func (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 |
| 113 | func (s *state) DeleteType(typeName string, ts uint64) error { |