func (bs *boltStorage) FirstIndex() (uint64, error) {
	tx, err := bs.db.Begin(false)
	if err != nil {
		bs.logger.Errorf("Failed getting first index: %s", err.Error())
		return 0, err
	}

	defer tx.Rollback()
	curs := tx.Bucket(entriesBucket).Cursor()
	first, _ := curs.First()
	if first == nil {
		// if we can't find a key in the bucket,
		// return 1 as frist index
		return 1, nil
	}

	return bytesToUint64(first), nil
}
// FirstIndex returns the index of the first log entry that is
// possibly available via Entries (older entries have been incorporated
// into the latest Snapshot; if storage only contains the dummy entry the
// first log entry is not available).
FirstIndex returns the index of the first log entry that is
possibly available via Entries (older entries have been incorporated
into the latest Snapshot; if storage only contains the dummy entry the
first log entry is not available).
// FirstIndex returns the index of the first log entry that is // possibly available via Entries ( older entries have been incorporated // into the latest Snapshot ; if storage only contains the dummy entry the // first log entry is not available ) .
func (bs *boltStorage) FirstIndex() (uint64, error) {
	tx, err := bs.db.Begin(false)
	if err != nil {
		bs.logger.Errorf("Failed getting first index: %s", err.Error())
		return 0, err
	}
	defer tx.Rollback()
	curs := tx.Bucket(entriesBucket).Cursor()
	first, _ := curs.First()
	if first == nil {
		return 1, nil
	}
	return bytesToUint64(first), nil
}
func ( bs * boltStorage ) FirstIndex ( ) ( uint64 , error ) { tx , err := bs . db . Begin ( false ) if err != nil { bs . logger . Errorf ( " " , err . Error ( ) ) return 0 , err } defer tx . Rollback ( ) curs := tx . Bucket ( entriesBucket ) . Cursor ( ) first , _ := curs . First ( ) if first == nil { return 1 , nil } return bytesToUint64 ( first ) , nil }
FirstIndex returns the index of the first log entry that is
possibly available via Entries (older entries have been incorporated
into the latest Snapshot; if storage only contains the dummy entry the
first log entry is not available).
FirstIndex returns the index of the first log entry that is possibly available via Entries ( older entries have been incorporated into the latest Snapshot ; if storage only contains the dummy entry the first log entry is not available ) .
// if we can't find a key in the bucket, // return 1 as frist index