Beispiel #1
0
func newHistoryListing(s *store.Store) (*historyListing, error) {
	seq, err := s.NextCmdSeq()
	if err != nil {
		return nil, err
	}
	cmds, err := s.Cmds(seq-100, seq)
	if err != nil {
		return nil, err
	}
	return &historyListing{cmds}, nil
}
Beispiel #2
0
func newHistlist(s *store.Store) (*histlist, error) {
	if s == nil {
		return nil, ErrStoreOffline
	}
	seq, err := s.NextCmdSeq()
	if err != nil {
		return nil, err
	}
	all, err := s.Cmds(0, seq)
	if err != nil {
		return nil, err
	}
	last := make(map[string]int)
	for i, entry := range all {
		last[entry] = i
	}
	hl := &histlist{all: all, last: last, indexWidth: len(strconv.Itoa(len(all) - 1))}
	hl.listing = newListing(modeHistoryListing, hl)
	return hl, nil
}