Skip to content
Snippets Groups Projects
Commit a1371d55 authored by Manish R Jain's avatar Manish R Jain
Browse files

Change function names to make their purpose clear

parent 235c62c7
No related branches found
No related tags found
No related merge requests found
......@@ -175,7 +175,7 @@ func (s *state) getUidForString(str string) {
}
}
func (s *state) handleNQuadsWhileAssign(wg *sync.WaitGroup) {
func (s *state) assignUidsOnly(wg *sync.WaitGroup) {
for nq := range s.cnq {
if farm.Fingerprint64([]byte(nq.Subject))%s.numInstances != s.instanceIdx {
// This instance shouldnt assign UID to this string
......@@ -240,8 +240,10 @@ func HandleRdfReader(reader io.Reader, instanceIdx uint64,
return atomic.LoadUint64(&s.ctr.processed), nil
}
// Blocking function.
func HandleRdfReaderWhileAssign(reader io.Reader, instanceIdx uint64,
// AssignUids would pick up all the external ids in RDFs read,
// and assign unique integer ids for them. This function would
// not load the edges, only assign UIDs.
func AssignUids(reader io.Reader, instanceIdx uint64,
numInstances uint64) (uint64, error) {
s := new(state)
s.ctr = new(counters)
......@@ -264,7 +266,7 @@ func HandleRdfReaderWhileAssign(reader io.Reader, instanceIdx uint64,
wg := new(sync.WaitGroup)
for i := 0; i < 3000; i++ {
wg.Add(1)
go s.handleNQuadsWhileAssign(wg) //Different compared to HandleRdfReader
go s.assignUidsOnly(wg)
}
// Block until all parseStream goroutines are finished.
......
......@@ -83,8 +83,7 @@ func main() {
glog.WithError(err).Fatal("Unable to create gzip reader.")
}
count, err := loader.HandleRdfReaderWhileAssign(r, *instanceIdx,
*numInstances)
count, err := loader.AssignUids(r, *instanceIdx, *numInstances)
if err != nil {
glog.WithError(err).Fatal("While handling rdf reader.")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment