Documentation
¶
Overview ¶
Package sessionstoretest checks baseAgent.SessionStore implementations against the contract documented on baseAgent.SessionStore.
Call Run from a test in the store's package:
func TestConformance(t *testing.T) {
sessionstoretest.Run(t, func(t *testing.T) baseAgent.SessionStore {
return newTestStore(t)
})
}
Index ¶
- func Run(t *testing.T, newStore func(t *testing.T) baseAgent.SessionStore)
- type MemoryStore
- func (s *MemoryStore) AppendEntry(ctx context.Context, sessionID string, entry baseAgent.SessionEntry) error
- func (s *MemoryStore) CreateSession(ctx context.Context, header baseAgent.SessionHeader, ...) error
- func (s *MemoryStore) ListSessions(ctx context.Context, query baseAgent.SessionQuery) ([]baseAgent.SessionInfo, error)
- func (s *MemoryStore) LoadSession(ctx context.Context, sessionID string) (baseAgent.LoadedSession, error)
- func (s *MemoryStore) SetCurrentEntry(ctx context.Context, sessionID string, expected, entryID *string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-memory baseAgent.SessionStore. It keeps entries encoded with baseAgent.MarshalSessionEntry, as a database would, so it doubles as a reference implementation of the contract and a store for tests.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore returns an empty MemoryStore.
func (*MemoryStore) AppendEntry ¶
func (s *MemoryStore) AppendEntry(ctx context.Context, sessionID string, entry baseAgent.SessionEntry) error
func (*MemoryStore) CreateSession ¶
func (s *MemoryStore) CreateSession(ctx context.Context, header baseAgent.SessionHeader, entries []baseAgent.SessionEntry) error
func (*MemoryStore) ListSessions ¶
func (s *MemoryStore) ListSessions(ctx context.Context, query baseAgent.SessionQuery) ([]baseAgent.SessionInfo, error)
func (*MemoryStore) LoadSession ¶
func (s *MemoryStore) LoadSession(ctx context.Context, sessionID string) (baseAgent.LoadedSession, error)
func (*MemoryStore) SetCurrentEntry ¶
Click to show internal directories.
Click to hide internal directories.