client

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

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

func (d *UserDevicesManager) GetUserDevices(ctx context.Context, userID string) ([]string, error)

GetUserDevices returns devices which belongs 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.

func (*UserDevicesManager) UpdateUserDevices added in v1.1.1

func (d *UserDevicesManager) UpdateUserDevices(ctx context.Context, userID string) ([]string, error)

UpdateUserDevices updates and returns devices which belongs to user.

Jump to

Keyboard shortcuts

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