client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 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 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.

Jump to

Keyboard shortcuts

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