raft/log.go
func newLogWithSize(storage Storage, logger Logger, maxNextEntsSize uint64) *raftLog {
	if storage == nil {
		log.Panic("storage must not be nil")
	}
	log := &raftLog{
		storage:         storage,
		logger:          logger,
		maxNextEntsSize: maxNextEntsSize,
	}
	firstIndex, err := storage.FirstIndex()
	if err != nil {
		panic(err) // TODO(bdarnell)
	}
	lastIndex, err := storage.LastIndex()
	if err != nil {
		panic(err) // TODO(bdarnell)
	}
	log.unstable.offset = lastIndex + 1
	log.unstable.logger = logger
	// Initialize our committed and applied pointers to the time of the last compaction.
	log.committed = firstIndex - 1
	log.applied = firstIndex - 1

	return log
}
func newLogWithSize(storage Storage, logger Logger, maxNextEntsSize uint64) *raftLog {
	if storage == nil {
		log.Panic("storage must not be nil")
	}
	log := &raftLog{
		storage:         storage,
		logger:          logger,
		maxNextEntsSize: maxNextEntsSize,
	}
	firstIndex, err := storage.FirstIndex()
	if err != nil {
		panic(err) // TODO(bdarnell)
	}
	lastIndex, err := storage.LastIndex()
	if err != nil {
		panic(err) // TODO(bdarnell)
	}
	log.unstable.offset = lastIndex + 1
	log.unstable.logger = logger
	// Initialize our committed and applied pointers to the time of the last compaction.
	log.committed = firstIndex - 1
	log.applied = firstIndex - 1

	return log
}
func newLogWithSize ( storage Storage , logger Logger , maxNextEntsSize uint64 ) * raftLog { if storage == nil { log . Panic ( " " ) } log := & raftLog { storage : storage , logger : logger , maxNextEntsSize : maxNextEntsSize , } firstIndex , err := storage . FirstIndex ( ) if err != nil { panic ( err ) // TODO(bdarnell) } lastIndex , err := storage . LastIndex ( ) if err != nil { panic ( err ) // TODO(bdarnell) } log . unstable . offset = lastIndex + 1 log . unstable . logger = logger // Initialize our committed and applied pointers to the time of the last compaction. log . committed = firstIndex - 1 log . applied = firstIndex - 1 return log }
// newLogWithSize returns a log using the given storage and max
// message size.
newLogWithSize returns a log using the given storage and max message size .