Skip to content

Commit 1216521

Browse files
committed
Use a distinct IterableCtxStore interface
1 parent 2e73121 commit 1216521

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ func (s *SessionManager) doStoreCommit(ctx context.Context, token string, b []by
653653
}
654654

655655
func (s *SessionManager) doStoreAll(ctx context.Context) (map[string][]byte, error) {
656-
cs, ok := s.Store.(CtxStore)
656+
cs, ok := s.Store.(IterableCtxStore)
657657
if ok {
658658
return cs.AllCtx(ctx)
659659
}

store.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,20 @@ type IterableStore interface {
3939
type CtxStore interface {
4040
Store
4141

42-
// DeleteCtx same as Store.Delete, except it takes a context.Context.
42+
// DeleteCtx is the same as Store.Delete, except it takes a context.Context.
4343
DeleteCtx(ctx context.Context, token string) (err error)
4444

45-
// FindCtx same as Store.Find, except it takes a context.Context.
45+
// FindCtx is thesame as Store.Find, except it takes a context.Context.
4646
FindCtx(ctx context.Context, token string) (b []byte, found bool, err error)
4747

48-
// CommitCtx same as Store.Commit, except it takes a context.Context.
48+
// CommitCtx is the same as Store.Commit, except it takes a context.Context.
4949
CommitCtx(ctx context.Context, token string, b []byte, expiry time.Time) (err error)
50+
}
5051

51-
// AllCtx same as IterableStore.All, expect it takes a context.Context.
52+
// IterableCtxStore is the interface for session stores which support iteration
53+
// and which take a context.Context parameter.
54+
type IterableCtxStore interface {
55+
// AllCtx is the same as IterableStore.All, expect it takes a
56+
// context.Context.
5257
AllCtx(ctx context.Context) (map[string][]byte, error)
5358
}

0 commit comments

Comments
 (0)