Skip to content

Commit

Permalink
make newest offset public and add oldest offset for offsets api
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Nov 19, 2016
1 parent 70f7d43 commit 24abb98
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions commitlog/commitlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (l *CommitLog) checkSplit() bool {
}

func (l *CommitLog) split() error {
seg, err := NewSegment(l.Path, l.newestOffset(), l.SegmentBytes)
seg, err := NewSegment(l.Path, l.NewestOffset(), l.SegmentBytes)
if err != nil {
return err
}
Expand All @@ -114,10 +114,14 @@ func (l *CommitLog) split() error {
return nil
}

func (l *CommitLog) newestOffset() int64 {
func (l *CommitLog) NewestOffset() int64 {
return l.activeSegment().NextOffset
}

func (l *CommitLog) OldestOffset() int64 {
return l.segments[0].BaseOffset
}

func (l *CommitLog) activeSegment() *Segment {
return l.vActiveSegment.Load().(*Segment)
}

0 comments on commit 24abb98

Please sign in to comment.