Documentation
¶
Index ¶
- Constants
- type FileStore
- func (f *FileStore) Create(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
- func (f *FileStore) Delete(_ context.Context, id string) error
- func (f *FileStore) Get(_ context.Context, id string) (*schema.Session, error)
- func (f *FileStore) List(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
- func (f *FileStore) Update(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
- func (f *FileStore) Write(s *schema.Session) error
- type MemoryStore
- func (m *MemoryStore) Create(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
- func (m *MemoryStore) Delete(_ context.Context, id string) error
- func (m *MemoryStore) Get(_ context.Context, id string) (*schema.Session, error)
- func (m *MemoryStore) List(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
- func (m *MemoryStore) Update(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
- func (m *MemoryStore) Write(_ *schema.Session) error
Constants ¶
const ( DirPerm os.FileMode = 0o700 // Directory permission for session store FilePerm os.FileMode = 0o600 // File permission for session files )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is a file-backed implementation of Store. Each session is stored as {id}.json in a directory. It is safe for concurrent use.
func NewFileStore ¶
NewFileStore creates a new file-backed session store in the given directory. The directory is created if it does not exist.
func (*FileStore) Create ¶
Create creates a new session with a unique ID, writes it to disk, and returns it.
func (*FileStore) List ¶
func (f *FileStore) List(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
List returns sessions from disk, ordered by last modified time (most recent first), with pagination support.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-memory implementation of Store. It is safe for concurrent use.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new empty in-memory session store.
func (*MemoryStore) Create ¶
func (m *MemoryStore) Create(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
Create creates a new session with a unique ID and returns it.
func (*MemoryStore) Delete ¶
func (m *MemoryStore) Delete(_ context.Context, id string) error
Delete removes a session by ID.
func (*MemoryStore) List ¶
func (m *MemoryStore) List(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
List returns sessions, ordered by last modified time (most recent first), with pagination support.