service

package
v0.0.0-...-7b6f2c3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrFunc

type ErrFunc func(err error)

ErrFunc reports errors

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) 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.

Jump to

Keyboard shortcuts

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