diff --git a/internal/state/util.go b/internal/state/join.go similarity index 78% rename from internal/state/util.go rename to internal/state/join.go index 473ae51..2b4011f 100644 --- a/internal/state/util.go +++ b/internal/state/join.go @@ -9,8 +9,19 @@ var ( ErrDuplicate = errors.New("store contains duplicates") ) +/* +Joiner is the interface that wraps the Join method. + +The Join function uses Joiner if available. +*/ +type Joiner interface{ Join() (Entries, error) } + // Join returns joined state entries of all active aids. func Join(s Store) (Entries, error) { + if j, ok := s.(Joiner); ok { + return j.Join() + } + var ( aids []int entries = make(Entries)