init the log entries.

pull/820/head
Xiang Li 2013-07-03 09:51:20 -07:00
parent d3f5d2b7fc
commit 95d369e659
1 changed files with 5 additions and 1 deletions

6
log.go
View File

@ -36,7 +36,9 @@ type Log struct {
// Creates a new log.
func NewLog() *Log {
return &Log{}
return &Log{
entries: make([]*LogEntry, 0),
}
}
//------------------------------------------------------------------------------
@ -232,6 +234,7 @@ func (l *Log) GetEntriesAfter(index uint64) ([]*LogEntry, uint64) {
// Return nil if index is before the start of the log.
if index < l.startIndex {
debugln("[GetEntries] index < startIndex ", index, " ", l.startIndex)
return nil, 0
}
@ -242,6 +245,7 @@ func (l *Log) GetEntriesAfter(index uint64) ([]*LogEntry, uint64) {
// If we're going from the beginning of the log then return the whole log.
if index == l.startIndex {
debugln("[GetEntries] index = startIndex ", index, " ", l.startIndex)
return l.entries, l.startTerm
}