Documentation
¶
Index ¶
- 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 NewGRPCSessionCache(ctx context.Context, client v1.BatonSessionServiceClient, ...) (sessions.SessionStore, error)
- func NewGRPCSessionClient(ctx context.Context, accessToken string, dpopKey *jose.JSONWebKey, ...) (v1.BatonSessionServiceClient, 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
- type Codec
- type GRPCSessionCache
- func (g *GRPCSessionCache) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
- func (g *GRPCSessionCache) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
- func (g *GRPCSessionCache) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
- func (g *GRPCSessionCache) GetAll(ctx context.Context, opt ...sessions.SessionStoreOption) (map[string][]byte, error)
- func (g *GRPCSessionCache) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error)
- func (g *GRPCSessionCache) Set(ctx context.Context, key string, value []byte, ...) error
- func (g *GRPCSessionCache) SetMany(ctx context.Context, values map[string][]byte, ...) error
- 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 IntCodec
- type JSONCodec
- type SetSessionStore
- 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, opt ...sessions.SessionStoreOption) (map[string]T, error)
- func (t *TypedSessionCache[T]) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, 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 ¶
This section is empty.
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 NewGRPCSessionCache ¶ added in v0.5.0
func NewGRPCSessionCache(ctx context.Context, client v1.BatonSessionServiceClient, opt ...sessions.SessionStoreConstructorOption) (sessions.SessionStore, error)
NewGRPCSessionCache creates a new gRPC session cache instance.
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 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
Types ¶
type GRPCSessionCache ¶ added in v0.5.0
type GRPCSessionCache struct {
// contains filtered or unexported fields
}
func (*GRPCSessionCache) Clear ¶ added in v0.5.0
func (g *GRPCSessionCache) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) error
Clear removes all values from the cache.
func (*GRPCSessionCache) Delete ¶ added in v0.5.0
func (g *GRPCSessionCache) Delete(ctx context.Context, key string, opt ...sessions.SessionStoreOption) error
Delete removes a value from the cache by key.
func (*GRPCSessionCache) Get ¶ added in v0.5.0
func (g *GRPCSessionCache) Get(ctx context.Context, key string, opt ...sessions.SessionStoreOption) ([]byte, bool, error)
Get retrieves a value from the cache by key.
func (*GRPCSessionCache) GetAll ¶ added in v0.5.0
func (g *GRPCSessionCache) GetAll(ctx context.Context, opt ...sessions.SessionStoreOption) (map[string][]byte, error)
GetAll returns all key-value pairs. Note: The gRPC service doesn't have a GetAll method, so we'll need to implement this by getting all keys first and then using GetMany. This is a limitation of the current gRPC service definition.
func (*GRPCSessionCache) GetMany ¶ added in v0.5.0
func (g *GRPCSessionCache) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error)
GetMany retrieves multiple values from the cache by keys.
func (*GRPCSessionCache) Set ¶ added in v0.5.0
func (g *GRPCSessionCache) Set(ctx context.Context, key string, value []byte, opt ...sessions.SessionStoreOption) error
Set stores a value in the cache with the given key.
func (*GRPCSessionCache) SetMany ¶ added in v0.5.0
func (g *GRPCSessionCache) SetMany(ctx context.Context, values map[string][]byte, opt ...sessions.SessionStoreOption) error
SetMany stores multiple values in the cache.
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 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, opt ...sessions.SessionStoreOption) (map[string]T, 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, 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