Documentation ¶
Index ¶
- type ErrFunc
- type TriggerFunc
- type UserDevicesManager
- func (d *UserDevicesManager) Acquire(ctx context.Context, userID string) error
- func (d *UserDevicesManager) Close()
- func (d *UserDevicesManager) GetUserDevices(ctx context.Context, userID string) ([]string, error)
- func (d *UserDevicesManager) IsUserDevice(userID, deviceID string) bool
- func (d *UserDevicesManager) Release(userID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TriggerFunc ¶
type TriggerFunc = func(ctx context.Context, userID string, addedDevices, removedDevices, currentDevices map[string]bool)
TriggerFunc notifies users remove/add device.
type UserDevicesManager ¶
type UserDevicesManager struct {
// contains filtered or unexported fields
}
UserDevicesManager provides notification mechanism about devices.
func NewUserDevicesManager ¶
func NewUserDevicesManager(fn TriggerFunc, asClient pbAS.AuthorizationServiceClient, tickFrequency, expiration time.Duration, errFunc ErrFunc) *UserDevicesManager
NewUserDevicesManager creates userID devices manager.
func (*UserDevicesManager) Acquire ¶
func (d *UserDevicesManager) Acquire(ctx context.Context, userID string) error
Acquire acquires reference counter by 1 for userID.
func (*UserDevicesManager) Close ¶
func (d *UserDevicesManager) Close()
Close stops userID manager goroutine.
func (*UserDevicesManager) GetUserDevices ¶
GetUserDevices returns devices which belows to user.
func (*UserDevicesManager) IsUserDevice ¶
func (d *UserDevicesManager) IsUserDevice(userID, deviceID string) bool
func (*UserDevicesManager) Release ¶
func (d *UserDevicesManager) Release(userID string) error
Release releases reference counter by 1 over userID.
Click to show internal directories.
Click to hide internal directories.