Commits

npe  committed 3d8d202

ioproxy work

  • Participants
  • Parent commits 404d82d

Comments (0)

Files changed (3)

File ioproxy/Makefile

 
 include $(GOROOT)/src/Make.inc
 
-TARG=range
+TARG=bitbucket.org/npe/cluster/ioproxy
 GOFILES=\
 	ioproxy.go\
 

File nrange/Makefile

 
 include $(GOROOT)/src/Make.inc
 
-TARG=nrange
+TARG=bitbucket.org/npe/cluster/nrange
 GOFILES=\
 	range.go\
 	scanner.go\

File nrange/range.go

 }
 
 
-func NewMerger() (m Merger) {
+func NewMerger() (m *Merger) {
 	// this is incorrect. 
-	m.l = &sync.RWMutex{}
-	m.fl = []*mergeFifoLine{}
-	m.rw = bytes.NewBuffer([]byte{})
-	m.alreadyRead = make(map[string]*mergeFifoLine)
-	m.inch = make(chan []*mergeFifoLine, 32) // arbitrary, should probably be set according to cluster
-	m.errch = make(chan os.Error)
-	m.doch = make(chan []*mergeFifoLine)
-	m.changeTimeout = make(chan int64)
+	m = &Merger{
+		l:             &sync.RWMutex{},
+		fl:            []*mergeFifoLine{},
+		rw:            bytes.NewBuffer([]byte{}),
+		alreadyRead:   make(map[string]*mergeFifoLine),
+		inch:          make(chan []*mergeFifoLine, 32), // arbitrary, should probably be set according to cluster
+		errch:         make(chan os.Error),
+		doch:          make(chan []*mergeFifoLine),
+		changeTimeout: make(chan int64),
+	}
+
 	tick := time.NewTicker(4000000000) // 4 seconds allow customizing the timeout later
 	//tick := time.NewTicker(1)
 	go func() {
 }
 
 
-func (m *Merger) NewWriter(id int) MergeWriter {
+func (m *Merger) NewWriter(id int) *MergeWriter {
 	m.l.Lock()
 	m.nwriters++
 	m.l.Unlock()
 	inch     chan []*mergeFifoLine
 }
 
-func NewMergeWriter(id int, inch chan []*mergeFifoLine, errch chan os.Error) (m MergeWriter) {
-	m.id = id
-	m.inch = inch
+func NewMergeWriter(id int, inch chan []*mergeFifoLine, errch chan os.Error) (m *MergeWriter) {
+	m = &MergeWriter{
+		id:   id,
+		inch: inch,
+	}
+
 	return
 }
 
 	}
 }
 
-func (rl *rangeList) Intersect(nl *rangeList) (il *rangeList){
+func (rl *rangeList) Intersect(nl *rangeList) (il *rangeList) {
 	il = newRangeList()
 
 	e := rl.l.Front()
 		case OverlapsFront:
 			il.Add(newNodeRange(r.beg, s.end))
 			e = e.Next()
-			f = f.Next()		
+			f = f.Next()
 		case OverlapsBack:
 			il.Add(newNodeRange(s.beg, r.end))
 			e = e.Next()
 }
 
 
-
 func (n *nodeRange) Enum() (ss []string) {
 	for i := n.beg; i <= n.end; i++ {
 		ss = append(ss, strconv.Itoa(i))