From 1f74b636d31e816907ff6adbf1472f9e0fb37ab7 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 14 Feb 2025 14:11:02 +0900 Subject: [PATCH] state/join: use Join method when available Signed-off-by: Ophestra --- internal/state/{util.go => join.go} | 11 +++++++++++ 1 file changed, 11 insertions(+) rename internal/state/{util.go => join.go} (78%) 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)