Documentation ¶
Overview ¶
Package session defines API for the session storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID []byte
ID identifies a session.
func GenerateID ¶
func GenerateID() ID
GenerateID generates a new random session ID or panics if there's not enough entropy.
type Store ¶
type Store interface { // FetchSession fetches an existing session with the given ID. // // Returns (nil, nil) if there's no such session. All errors are transient. FetchSession(ctx context.Context, id ID) (*sessionpb.Session, error) // UpdateSession transactionally updates or creates a session. // // If fetches the session, calls the callback to mutate it, and stores the // result. If it is a new session, the callback receives an empty proto. // // The callback may be called multiple times in case the transaction is // retried. Errors from callbacks are returned as is. All other errors are // transient. UpdateSession(ctx context.Context, id ID, cb func(*sessionpb.Session) error) error }
Store is a persistent transactional-capable storage of user sessions.
Session IDs are assumed to be generated by GenerateID, i.e. be high-entropy random blobs.
Click to show internal directories.
Click to hide internal directories.