Documentation
¶
Index ¶
- Variables
- func Chunk[T any](items []T, chunkSize int) iter.Seq[[]T]
- func ClearJSON(ctx context.Context, ss sessions.SessionStore, ...) error
- func DeleteJSON(ctx context.Context, ss sessions.SessionStore, key string, ...) error
- func GetAllJSON[T any](ctx context.Context, ss sessions.SessionStore, ...) (map[string]T, error)
- func GetJSON[T any](ctx context.Context, ss sessions.SessionStore, key string, ...) (T, bool, error)
- func GetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, keys []string, ...) (map[string]T, error)
- func NewGRPCSessionClient(ctx context.Context, accessToken string, dpopKey *jose.JSONWebKey, ...) (v1.BatonSessionServiceClient, error)
- func NewGRPCSessionStore(ctx context.Context, client v1.BatonSessionServiceClient, ...) (sessions.SessionStore, error)
- func SetJSON[T any](ctx context.Context, ss sessions.SessionStore, key string, item T, ...) error
- func SetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, items map[string]T, ...) error
- func StartGRPCSessionServerWithOptions(ctx context.Context, listener net.Listener, ...) error
- func UnrollGetAll[T any](ctx context.Context, ss GetAllable[T], opt ...sessions.SessionStoreOption) (map[string]T, error)
- func UnrollGetMany[T any](ctx context.Context, ss GetManyable[T], keys []string, ...) (map[string]T, error)
- func UnrollSetMany[T any](ctx context.Context, ss SetManyable[T], items iter.Seq2[SizedItem[T], error], ...) error
- type CacheItem
- type Codec
- type GRPCSessionServer
- func (s *GRPCSessionServer) Clear(ctx context.Context, req *v1.ClearRequest) (*v1.ClearResponse, error)
- func (s *GRPCSessionServer) Delete(ctx context.Context, req *v1.DeleteRequest) (*v1.DeleteResponse, error)
- func (s *GRPCSessionServer) DeleteMany(ctx context.Context, req *v1.DeleteManyRequest) (*v1.DeleteManyResponse, error)
- func (s *GRPCSessionServer) Get(ctx context.Context, req *v1.GetRequest) (*v1.GetResponse, error)
- func (s *GRPCSessionServer) GetAll(ctx context.Context, req *v1.GetAllRequest) (*v1.GetAllResponse, error)
- func (s *GRPCSessionServer) GetMany(ctx context.Context, req *v1.GetManyRequest) (*v1.GetManyResponse, error)
- func (s *GRPCSessionServer) Set(ctx context.Context, req *v1.SetRequest) (*v1.SetResponse, error)
- func (s *GRPCSessionServer) SetMany(ctx context.Context, req *v1.SetManyRequest) (*v1.SetManyResponse, error)
- func (s *GRPCSessionServer) SetSessionStore(ctx context.Context, store sessions.SessionStore)
- func (s *GRPCSessionServer) Validate() error
- type GRPCSessionStoreClient
- func (g *GRPCSessionStoreClient) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
- func (g *GRPCSessionStoreClient) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
- func (g *GRPCSessionStoreClient) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
- func (g *GRPCSessionStoreClient) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error)
- func (g *GRPCSessionStoreClient) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error)
- func (g *GRPCSessionStoreClient) Set(ctx context.Context, key string, value []byte, ...) error
- func (g *GRPCSessionStoreClient) SetMany(ctx context.Context, values map[string][]byte, ...) error
- type GetAllable
- type GetManyable
- type IntCodec
- type JSONCodec
- type MemorySessionCache
- func (m *MemorySessionCache) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
- func (m *MemorySessionCache) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
- func (m *MemorySessionCache) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
- func (m *MemorySessionCache) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error)
- func (m *MemorySessionCache) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error)
- func (m *MemorySessionCache) Set(ctx context.Context, key string, value []byte, ...) error
- func (m *MemorySessionCache) SetMany(ctx context.Context, values map[string][]byte, ...) error
- type NoOpSessionStore
- func (n *NoOpSessionStore) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
- func (n *NoOpSessionStore) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
- func (n *NoOpSessionStore) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
- func (n *NoOpSessionStore) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error)
- func (n *NoOpSessionStore) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error)
- func (n *NoOpSessionStore) Set(ctx context.Context, key string, value []byte, ...) error
- func (n *NoOpSessionStore) SetMany(ctx context.Context, values map[string][]byte, ...) error
- type SetManyable
- type SetSessionStore
- type SizedItem
- type StringCodec
- type TypedSessionCache
- func NewIntSessionCache(cache sessions.SessionStore) *TypedSessionCache[int]
- func NewJSONSessionCache[T any](cache sessions.SessionStore) *TypedSessionCache[T]
- func NewStringSessionCache(cache sessions.SessionStore) *TypedSessionCache[string]
- func NewTypedSessionCache[T any](cache sessions.SessionStore, codec Codec[T]) *TypedSessionCache[T]
- func (t *TypedSessionCache[T]) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
- func (t *TypedSessionCache[T]) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
- func (t *TypedSessionCache[T]) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) (T, bool, error)
- func (t *TypedSessionCache[T]) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string]T, string, error)
- func (t *TypedSessionCache[T]) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, []string, error)
- func (t *TypedSessionCache[T]) Set(ctx context.Context, key string, value T, opt ...sessions.SessionStoreOption) error
- func (t *TypedSessionCache[T]) SetMany(ctx context.Context, values map[string]T, opt ...sessions.SessionStoreOption) error
Constants ¶
This section is empty.
Variables ¶
var ErrSessionStoreDisabled = fmt.Errorf("session store is disabled by connector author. It must be explicitly enabled via RunConnector WithSessionStoreEnabled()")
Functions ¶
func ClearJSON ¶
func ClearJSON(ctx context.Context, ss sessions.SessionStore, opt ...sessions.SessionStoreOption) error
func DeleteJSON ¶
func DeleteJSON(ctx context.Context, ss sessions.SessionStore, key string, opt ...sessions.SessionStoreOption) error
func GetAllJSON ¶
func GetAllJSON[T any](ctx context.Context, ss sessions.SessionStore, opt ...sessions.SessionStoreOption) (map[string]T, error)
func GetJSON ¶
func GetJSON[T any](ctx context.Context, ss sessions.SessionStore, key string, opt ...sessions.SessionStoreOption) (T, bool, error)
func GetManyJSON ¶
func GetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, error)
func NewGRPCSessionClient ¶ added in v0.5.0
func NewGRPCSessionClient(ctx context.Context, accessToken string, dpopKey *jose.JSONWebKey, opt ...sessions.SessionStoreConstructorOption) (v1.BatonSessionServiceClient, error)
NewGRPCSessionClient creates a new gRPC session service client using existing DPoP credentials. It reuses an existing access token and DPoP key instead of performing a new authentication round. It reads the session service address from the BATON_SESSION_SERVICE_ADDR environment variable, defaulting to "localhost:50051" if not set.
func NewGRPCSessionStore ¶ added in v0.5.3
func NewGRPCSessionStore(ctx context.Context, client v1.BatonSessionServiceClient, opt ...sessions.SessionStoreConstructorOption) (sessions.SessionStore, error)
NewGRPCSessionStore creates a new gRPC session cache instance.
func SetJSON ¶
func SetJSON[T any](ctx context.Context, ss sessions.SessionStore, key string, item T, opt ...sessions.SessionStoreOption) error
func SetManyJSON ¶
func SetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, items map[string]T, opt ...sessions.SessionStoreOption) error
func StartGRPCSessionServerWithOptions ¶ added in v0.5.0
func StartGRPCSessionServerWithOptions(ctx context.Context, listener net.Listener, sessionServer v1.BatonSessionServiceServer, opts ...grpc.ServerOption) error
func UnrollGetAll ¶ added in v0.5.3
func UnrollGetAll[T any](ctx context.Context, ss GetAllable[T], opt ...sessions.SessionStoreOption) (map[string]T, error)
func UnrollGetMany ¶ added in v0.5.3
func UnrollGetMany[T any](ctx context.Context, ss GetManyable[T], keys []string, opt ...sessions.SessionStoreOption) (map[string]T, error)
func UnrollSetMany ¶ added in v0.5.3
func UnrollSetMany[T any](ctx context.Context, ss SetManyable[T], items iter.Seq2[SizedItem[T], error], opt ...sessions.SessionStoreOption) error
UnrollSetMany takes an iterator of sized items and batches them into SetMany calls, respecting both MaxKeysPerRequest and MaxSessionStoreSizeLimit. The iterator yields (item, error) pairs; iteration stops on the first error.
Types ¶
type GRPCSessionServer ¶ added in v0.5.0
type GRPCSessionServer struct {
// contains filtered or unexported fields
}
func NewGRPCSessionServer ¶ added in v0.5.0
func NewGRPCSessionServer() *GRPCSessionServer
func (*GRPCSessionServer) Clear ¶ added in v0.5.0
func (s *GRPCSessionServer) Clear(ctx context.Context, req *v1.ClearRequest) (*v1.ClearResponse, error)
func (*GRPCSessionServer) Delete ¶ added in v0.5.0
func (s *GRPCSessionServer) Delete(ctx context.Context, req *v1.DeleteRequest) (*v1.DeleteResponse, error)
func (*GRPCSessionServer) DeleteMany ¶ added in v0.5.0
func (s *GRPCSessionServer) DeleteMany(ctx context.Context, req *v1.DeleteManyRequest) (*v1.DeleteManyResponse, error)
func (*GRPCSessionServer) Get ¶ added in v0.5.0
func (s *GRPCSessionServer) Get(ctx context.Context, req *v1.GetRequest) (*v1.GetResponse, error)
func (*GRPCSessionServer) GetAll ¶ added in v0.5.0
func (s *GRPCSessionServer) GetAll(ctx context.Context, req *v1.GetAllRequest) (*v1.GetAllResponse, error)
func (*GRPCSessionServer) GetMany ¶ added in v0.5.0
func (s *GRPCSessionServer) GetMany(ctx context.Context, req *v1.GetManyRequest) (*v1.GetManyResponse, error)
func (*GRPCSessionServer) Set ¶ added in v0.5.0
func (s *GRPCSessionServer) Set(ctx context.Context, req *v1.SetRequest) (*v1.SetResponse, error)
func (*GRPCSessionServer) SetMany ¶ added in v0.5.0
func (s *GRPCSessionServer) SetMany(ctx context.Context, req *v1.SetManyRequest) (*v1.SetManyResponse, error)
func (*GRPCSessionServer) SetSessionStore ¶ added in v0.5.0
func (s *GRPCSessionServer) SetSessionStore(ctx context.Context, store sessions.SessionStore)
func (*GRPCSessionServer) Validate ¶ added in v0.5.0
func (s *GRPCSessionServer) Validate() error
type GRPCSessionStoreClient ¶ added in v0.5.3
type GRPCSessionStoreClient struct {
// contains filtered or unexported fields
}
func (*GRPCSessionStoreClient) Clear ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
Clear removes all values from the cache.
func (*GRPCSessionStoreClient) Delete ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
Delete removes a value from the cache by key.
func (*GRPCSessionStoreClient) Get ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
Get retrieves a value from the cache by key.
func (*GRPCSessionStoreClient) GetAll ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error)
func (*GRPCSessionStoreClient) GetMany ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error)
GetMany retrieves multiple values from the cache by keys.
func (*GRPCSessionStoreClient) Set ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) Set(ctx context.Context, key string, value []byte, opt ...sessions.SessionStoreOption) error
Set stores a value in the cache with the given key.
func (*GRPCSessionStoreClient) SetMany ¶ added in v0.5.3
func (g *GRPCSessionStoreClient) SetMany(ctx context.Context, values map[string][]byte, opt ...sessions.SessionStoreOption) error
SetMany stores multiple values in the cache.
type GetAllable ¶ added in v0.5.3
type GetManyable ¶ added in v0.5.3
type MemorySessionCache ¶
type MemorySessionCache struct {
// contains filtered or unexported fields
}
func NewMemorySessionCache ¶
func NewMemorySessionCache(otterOptions *otter.Options[string, []byte], ss sessions.SessionStore) (*MemorySessionCache, error)
func (*MemorySessionCache) Clear ¶
func (m *MemorySessionCache) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
func (*MemorySessionCache) Delete ¶
func (m *MemorySessionCache) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
func (*MemorySessionCache) Get ¶
func (m *MemorySessionCache) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
func (*MemorySessionCache) GetAll ¶
func (m *MemorySessionCache) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error)
GetAll always calls the backing store and caches the results.
func (*MemorySessionCache) GetMany ¶
func (m *MemorySessionCache) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error)
func (*MemorySessionCache) Set ¶
func (m *MemorySessionCache) Set(ctx context.Context, key string, value []byte, opt ...sessions.SessionStoreOption) error
func (*MemorySessionCache) SetMany ¶
func (m *MemorySessionCache) SetMany(ctx context.Context, values map[string][]byte, opt ...sessions.SessionStoreOption) error
type NoOpSessionStore ¶ added in v0.5.7
type NoOpSessionStore struct{}
Don't panic in dev (ideally).
func (*NoOpSessionStore) Clear ¶ added in v0.5.7
func (n *NoOpSessionStore) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
func (*NoOpSessionStore) Delete ¶ added in v0.5.7
func (n *NoOpSessionStore) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
func (*NoOpSessionStore) Get ¶ added in v0.5.7
func (n *NoOpSessionStore) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
func (*NoOpSessionStore) GetAll ¶ added in v0.5.7
func (n *NoOpSessionStore) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error)
func (*NoOpSessionStore) GetMany ¶ added in v0.5.7
func (n *NoOpSessionStore) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error)
func (*NoOpSessionStore) Set ¶ added in v0.5.7
func (n *NoOpSessionStore) Set(ctx context.Context, key string, value []byte, opt ...sessions.SessionStoreOption) error
func (*NoOpSessionStore) SetMany ¶ added in v0.5.7
func (n *NoOpSessionStore) SetMany(ctx context.Context, values map[string][]byte, opt ...sessions.SessionStoreOption) error
type SetManyable ¶ added in v0.5.3
type SetSessionStore ¶ added in v0.5.0
type SetSessionStore interface {
SetSessionStore(ctx context.Context, store sessions.SessionStore)
}
type StringCodec ¶ added in v0.5.0
type StringCodec struct{}
type TypedSessionCache ¶ added in v0.5.0
type TypedSessionCache[T any] struct { // contains filtered or unexported fields }
func NewIntSessionCache ¶ added in v0.5.0
func NewIntSessionCache(cache sessions.SessionStore) *TypedSessionCache[int]
func NewJSONSessionCache ¶ added in v0.5.0
func NewJSONSessionCache[T any](cache sessions.SessionStore) *TypedSessionCache[T]
func NewStringSessionCache ¶ added in v0.5.0
func NewStringSessionCache(cache sessions.SessionStore) *TypedSessionCache[string]
func NewTypedSessionCache ¶ added in v0.5.0
func NewTypedSessionCache[T any](cache sessions.SessionStore, codec Codec[T]) *TypedSessionCache[T]
func (*TypedSessionCache[T]) Clear ¶ added in v0.5.0
func (t *TypedSessionCache[T]) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
func (*TypedSessionCache[T]) Delete ¶ added in v0.5.0
func (t *TypedSessionCache[T]) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
func (*TypedSessionCache[T]) Get ¶ added in v0.5.0
func (t *TypedSessionCache[T]) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) (T, bool, error)
func (*TypedSessionCache[T]) GetAll ¶ added in v0.5.0
func (t *TypedSessionCache[T]) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string]T, string, error)
func (*TypedSessionCache[T]) GetMany ¶ added in v0.5.0
func (t *TypedSessionCache[T]) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, []string, error)
func (*TypedSessionCache[T]) Set ¶ added in v0.5.0
func (t *TypedSessionCache[T]) Set(ctx context.Context, key string, value T, opt ...sessions.SessionStoreOption) error
func (*TypedSessionCache[T]) SetMany ¶ added in v0.5.0
func (t *TypedSessionCache[T]) SetMany(ctx context.Context, values map[string]T, opt ...sessions.SessionStoreOption) error