memactives

package
v0.0.0-...-be25ffa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DirectiveFactory = func(loader func(v interface{}) error) (usersystem.Directive, error) {
	c := &Config{}
	err := loader(c)

	if err != nil {
		return nil, err
	}

	return c, nil
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Durations map[string]string
}

func (*Config) CreateService

func (c *Config) CreateService() (*Service, error)

func (*Config) Execute

func (c *Config) Execute(us *usersystem.UserSystem) error

type Service

type Service struct {
	Stores map[usersystem.SessionType]*StoreList
}

func NewService

func NewService() *Service

func (*Service) Execute

func (s *Service) Execute(us *usersystem.UserSystem) error

func (*Service) MustConfig

func (s *Service) MustConfig(st usersystem.SessionType) *activesessions.Config

func (*Service) MustCreateSerialNumber

func (s *Service) MustCreateSerialNumber() string

func (*Service) MustGetActiveSessions

func (s *Service) MustGetActiveSessions(st usersystem.SessionType, uid string) []*activesessions.Active

func (*Service) MustOnSessionActive

func (s *Service) MustOnSessionActive(session *usersystem.Session)

func (*Service) MustPurgeActiveSession

func (s *Service) MustPurgeActiveSession(st usersystem.SessionType, uid string, serialnumber string)

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop() error

type Store

type Store struct {
	CreatedTime time.Time
	Data        map[string]*UserData
}

func NewStore

func NewStore() *Store

func (*Store) GetActiveSessions

func (s *Store) GetActiveSessions(uid string, from time.Time) map[string]*activesessions.Active

func (*Store) OnSessionActive

func (s *Store) OnSessionActive(session *usersystem.Session)

func (*Store) PurgeActiveSession

func (s *Store) PurgeActiveSession(uid string, serialnumber string)

type StoreList

type StoreList struct {
	Ticker   *time.Ticker
	Duration time.Duration
	Locker   sync.RWMutex
	List     []*Store
}

func NewStoreList

func NewStoreList() *StoreList

func (*StoreList) GetActiveSessions

func (l *StoreList) GetActiveSessions(uid string) []*activesessions.Active

func (*StoreList) OnSessionActive

func (l *StoreList) OnSessionActive(session *usersystem.Session)

func (*StoreList) PurgeActiveSession

func (l *StoreList) PurgeActiveSession(uid string, serialnumber string)

func (*StoreList) Start

func (l *StoreList) Start() error

func (*StoreList) Stop

func (l *StoreList) Stop() error

func (*StoreList) Update

func (l *StoreList) Update()

type UserData

type UserData map[string]*activesessions.Active

func NewUserdata

func NewUserdata() *UserData

func (*UserData) GetActiveSessions

func (d *UserData) GetActiveSessions(from time.Time) map[string]*activesessions.Active

func (*UserData) OnSessionActive

func (d *UserData) OnSessionActive(session *usersystem.Session)

func (*UserData) PurgeActiveSession

func (d *UserData) PurgeActiveSession(serialnumber string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL