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

Method validateType

dgraph/cmd/bulk/schema.go:132–157  ·  view source on GitHub ↗
(de *pb.DirectedEdge, objectIsUID bool)

Source from the content-addressed store, hash-verified

130}
131
132func (s *schemaStore) validateType(de *pb.DirectedEdge, objectIsUID bool) {
133 if objectIsUID {
134 de.ValueType = pb.Posting_UID
135 }
136
137 s.RLock()
138 sch, ok := s.schemaMap[de.Attr]
139 s.RUnlock()
140 if !ok {
141 s.Lock()
142 sch, ok = s.schemaMap[de.Attr]
143 if !ok {
144 sch = &pb.SchemaUpdate{ValueType: de.ValueType}
145 if objectIsUID {
146 sch.List = true
147 }
148 s.schemaMap[de.Attr] = sch
149 }
150 s.Unlock()
151 }
152
153 err := wk.ValidateAndConvert(de, sch)
154 if err != nil {
155 log.Fatalf("RDF doesn't match schema: %v", err)
156 }
157}
158
159func (s *schemaStore) getPredicates(db *badger.DB) []string {
160 txn := db.NewTransactionAt(math.MaxUint64, false)

Callers 1

createPostingsMethod · 0.80

Calls 5

RLockMethod · 0.80
RUnlockMethod · 0.80
FatalfMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected