client

package
v2.25.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 OwnerCache

type OwnerCache struct {
	// contains filtered or unexported fields
}

func NewOwnerCache

func NewOwnerCache(ownerClaim string, expiration time.Duration, conn *nats.Conn, isClient pbIS.IdentityStoreClient, errFunc ErrFunc) *OwnerCache

func (*OwnerCache) Close

func (c *OwnerCache) Close()

func (*OwnerCache) GetDevices

func (c *OwnerCache) GetDevices(ctx context.Context) (devices []string, err error)

GetDevices provides the owner of the cached device. If the cache does not expire, the cache expiration is extended.

func (*OwnerCache) GetSelectedDevices

func (c *OwnerCache) GetSelectedDevices(ctx context.Context, devices []string) ([]string, error)

Check provided list of device ids and return only ids owned by the user

func (*OwnerCache) OwnerClaim

func (c *OwnerCache) OwnerClaim() string

func (*OwnerCache) OwnsDevice

func (c *OwnerCache) OwnsDevice(ctx context.Context, deviceID string) (bool, error)

Convenience method to check if given device is owned by the user

func (*OwnerCache) OwnsDevices

func (c *OwnerCache) OwnsDevices(ctx context.Context, devices []string) (bool, error)

Check if all provided devices are owned by the user

func (*OwnerCache) Subscribe

func (c *OwnerCache) Subscribe(owner string, onEvent func(e *events.Event)) (func(), error)

Subscribe register onEvents handler and creates a NATS subscription, if it does not exist. To free subscription call the returned close function.

func (*OwnerCache) Update

func (c *OwnerCache) Update(ctx context.Context) (added []string, removed []string, err error)

Update updates devices in cache and subscribe to NATS for updating them.

Jump to

Keyboard shortcuts

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