state/join: use Join method when available
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Run NixOS test (push) Successful in 4m11s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-02-14 14:11:02 +09:00
parent e431ab3c24
commit 1f74b636d3
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -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)