Documentation
¶
Index ¶
- type BoltSession
- type BoltStorage
- type KeyValue
- type MemoryStorage
- type PeerStorage
- func (s PeerStorage) Add(ctx context.Context, value storage.Peer) error
- func (s PeerStorage) Assign(ctx context.Context, key string, value storage.Peer) error
- func (s PeerStorage) Delete(ctx context.Context, key storage.PeerKey) error
- func (s PeerStorage) Find(ctx context.Context, key storage.PeerKey) (storage.Peer, error)
- func (s PeerStorage) Iterate(ctx context.Context) (storage.PeerIterator, error)
- func (s PeerStorage) Purge(ctx context.Context) error
- func (s PeerStorage) Resolve(ctx context.Context, key string) (storage.Peer, error)
- type PostgresSession
- type PostgresStorage
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltSession ¶
BoltSession wraps kv.Session for BoltDB backend
func NewBoltSession ¶
func NewBoltSession(db *bbolt.DB, key string) *BoltSession
NewBoltSession creates a new BoltDB-backed session
type BoltStorage ¶
type BoltStorage struct {
// contains filtered or unexported fields
}
BoltStorage implements session storage using BoltDB Uses a single file with separate buckets for different sessions
func NewBoltStorage ¶
func NewBoltStorage(cfg config.BoltSessionConfig, key string) (*BoltStorage, error)
NewBoltStorage creates a new BoltDB session storage
func (*BoltStorage) LoadSession ¶
func (s *BoltStorage) LoadSession(ctx context.Context) ([]byte, error)
LoadSession retrieves session data from BoltDB
func (*BoltStorage) StoreSession ¶
func (s *BoltStorage) StoreSession(ctx context.Context, data []byte) error
StoreSession saves session data to BoltDB
type KeyValue ¶
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage implements session storage using in-memory storage This is suitable for development/testing only - data is lost on restart
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage creates a new in-memory session storage
func (*MemoryStorage) Close ¶
func (s *MemoryStorage) Close() error
Close is a no-op for memory storage
func (*MemoryStorage) LoadSession ¶
func (s *MemoryStorage) LoadSession(ctx context.Context) ([]byte, error)
LoadSession retrieves session data from memory
func (*MemoryStorage) StoreSession ¶
func (s *MemoryStorage) StoreSession(ctx context.Context, data []byte) error
StoreSession saves session data to memory
type PeerStorage ¶
type PeerStorage struct {
// contains filtered or unexported fields
}
func NewPeerStorage ¶
func NewPeerStorage(kvRepo repositories.KVRepository, prefix string) *PeerStorage
func (PeerStorage) Iterate ¶
func (s PeerStorage) Iterate(ctx context.Context) (storage.PeerIterator, error)
type PostgresSession ¶
PostgresSession wraps kv.Session for PostgreSQL backend with cache
func NewPostgresSession ¶
func NewPostgresSession(kvRepo repositories.KVRepository, cache cache.Cacher, key string) *PostgresSession
NewPostgresSession creates a new PostgreSQL-backed session with optional caching
type PostgresStorage ¶
type PostgresStorage struct {
// contains filtered or unexported fields
}
PostgresStorage implements session storage using repository KV storage
func NewPostgresStorage ¶
func NewPostgresStorage(kvRepo repositories.KVRepository, cache cache.Cacher, key string) *PostgresStorage
NewPostgresStorage creates a new PostgreSQL-backed session storage with caching
func (*PostgresStorage) Close ¶
func (s *PostgresStorage) Close() error
Close is a no-op for PostgreSQL storage (connection managed elsewhere)
func (*PostgresStorage) LoadSession ¶
func (s *PostgresStorage) LoadSession(ctx context.Context) ([]byte, error)
LoadSession retrieves session data from PostgreSQL with caching
func (*PostgresStorage) StoreSession ¶
func (s *PostgresStorage) StoreSession(ctx context.Context, data []byte) error
StoreSession saves session data to PostgreSQL
func (*PostgresStorage) Type ¶
func (s *PostgresStorage) Type() string
Type returns the storage type
type Storage ¶
type Storage interface {
session.Storage // LoadSession, StoreSession
// Type returns the storage backend type
Type() string
// Close closes the storage backend
Close() error
}
Storage defines the interface for all session storage backends It wraps gotd/td/session.Storage with additional lifecycle methods
func NewSessionStorage ¶
func NewSessionStorage(cfg config.SessionStorageConfig, kvRepo repositories.KVRepository, cache cache.Cacher, key string) (Storage, error)
NewSessionStorage creates a session storage based on configuration key identifies the specific session (e.g., userID, bot token) cache is used for PostgreSQL storage to reduce DB reads