Documentation ¶
Index ¶
- Variables
- type BoltStore
- func (b BoltStore) CleanupErr() <-chan error
- func (b *BoltStore) Close() error
- func (b *BoltStore) Create(_ context.Context, s sessionup.Session) error
- func (b *BoltStore) DeleteByID(_ context.Context, id string) error
- func (b *BoltStore) DeleteByUserKey(_ context.Context, key string, expIDs ...string) error
- func (b *BoltStore) FetchByID(_ context.Context, id string) (sessionup.Session, bool, error)
- func (b *BoltStore) FetchByUserKey(_ context.Context, key string) ([]sessionup.Session, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBucket is returned when invalid bucket name is provided. ErrInvalidBucket = errors.New("invalid bucket name") // ErrInvalidInterval is returned when invalid cleanup interval is provided. ErrInvalidInterval = errors.New("invalid cleanup interval") )
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
BoltStore is a bolt implementation of sessionup.Store.
func New ¶
New creates and returns a fresh intance of BoltStore. Bucket parameter determines bucket name which is used to store and manage sessions, it cannot be an empty string. Cleanup interval parameter is an interval time between each clean up. If this interval is equal to zero, cleanup won't be executed. Cannot be less than zero.
func (BoltStore) CleanupErr ¶
CleanupErr returns a channel that should be used to read and handle errors that occured during cleanup process. Whenever the cleanup service is active, errors from this channel will have to be drained, otherwise cleanup won't be able to continue its process.
func (*BoltStore) Close ¶
Close stops the cleanup service. It always returns nil as an error, used to implement io.Closer interface.
func (*BoltStore) Create ¶
Create inserts provided session into the store and ensures that it is deleted when expiration time is due.
func (*BoltStore) DeleteByID ¶
DeleteByID deletes the session from the store by the provided ID. If session is not found, this function will be no-op.
func (*BoltStore) DeleteByUserKey ¶
DeleteByUserKey deletes all sessions associated with the provided user key, except those whose IDs are provided as last argument. If none are found, this function will no-op.