DeleteType updates the schema in memory and disk
(typeName string, ts uint64)
| 111 | |
| 112 | // DeleteType updates the schema in memory and disk |
| 113 | func (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. |
| 137 | func (s *state) Namespaces() map[uint64]struct{} { |