|
@ -69,11 +69,6 @@ type Group struct { |
|
|
minIndex int // Includes head
|
|
|
minIndex int // Includes head
|
|
|
maxIndex int // Includes head, where Head will move to
|
|
|
maxIndex int // Includes head, where Head will move to
|
|
|
|
|
|
|
|
|
// close this when the processTicks routine is done.
|
|
|
|
|
|
// this ensures we can cleanup the dir after calling Stop
|
|
|
|
|
|
// and the routine won't be trying to access it anymore
|
|
|
|
|
|
doneProcessTicks chan struct{} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: When we start deleting files, we need to start tracking GroupReaders
|
|
|
// TODO: When we start deleting files, we need to start tracking GroupReaders
|
|
|
// and their dependencies.
|
|
|
// and their dependencies.
|
|
|
} |
|
|
} |
|
@ -101,7 +96,6 @@ func OpenGroup(ctx context.Context, logger log.Logger, headPath string, groupOpt |
|
|
groupCheckDuration: defaultGroupCheckDuration, |
|
|
groupCheckDuration: defaultGroupCheckDuration, |
|
|
minIndex: 0, |
|
|
minIndex: 0, |
|
|
maxIndex: 0, |
|
|
maxIndex: 0, |
|
|
doneProcessTicks: make(chan struct{}), |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for _, option := range groupOptions { |
|
|
for _, option := range groupOptions { |
|
@ -154,13 +148,6 @@ func (g *Group) OnStop() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Wait blocks until all internal goroutines are finished. Supposed to be
|
|
|
|
|
|
// called after Stop.
|
|
|
|
|
|
func (g *Group) Wait() { |
|
|
|
|
|
// wait for processTicks routine to finish
|
|
|
|
|
|
<-g.doneProcessTicks |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Close closes the head file. The group must be stopped by this moment.
|
|
|
// Close closes the head file. The group must be stopped by this moment.
|
|
|
func (g *Group) Close() { |
|
|
func (g *Group) Close() { |
|
|
if err := g.FlushAndSync(); err != nil { |
|
|
if err := g.FlushAndSync(); err != nil { |
|
@ -241,8 +228,6 @@ func (g *Group) FlushAndSync() error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (g *Group) processTicks(ctx context.Context) { |
|
|
func (g *Group) processTicks(ctx context.Context) { |
|
|
defer close(g.doneProcessTicks) |
|
|
|
|
|
|
|
|
|
|
|
for { |
|
|
for { |
|
|
select { |
|
|
select { |
|
|
case <-ctx.Done(): |
|
|
case <-ctx.Done(): |
|
|