Documentation ¶
Overview ¶
Package redis provides implementation of the application packages registry using Redis.
Index ¶
- func NewAppPkgsRegistryWithMockedHandlers(associationRegistry packages.AssociationRegistry, ...) packages.Registry
- func NewApplicationPackagesRegistry(ctx context.Context, cl *ttnredis.Client, lockTTL time.Duration) (packages.Registry, error)
- func NewAssociationRegistryMock(...) packages.AssociationRegistry
- func NewDefaultAssociationRegistryMock(...) packages.DefaultAssociationRegistry
- func NewTransactionRegistryMock(...) packages.TransactionRegistry
- type ApplicationPackagesRegistry
- func (r ApplicationPackagesRegistry) ClearAssociations(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) error
- func (r ApplicationPackagesRegistry) ClearDefaultAssociations(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) error
- func (r *ApplicationPackagesRegistry) EndDeviceTransaction(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, fPort uint32, ...) error
- func (r ApplicationPackagesRegistry) GetAssociation(ctx context.Context, ids *ttnpb.ApplicationPackageAssociationIdentifiers, ...) (*ttnpb.ApplicationPackageAssociation, error)
- func (r ApplicationPackagesRegistry) GetDefaultAssociation(ctx context.Context, ...) (*ttnpb.ApplicationPackageDefaultAssociation, error)
- func (r *ApplicationPackagesRegistry) Init(ctx context.Context) error
- func (r ApplicationPackagesRegistry) ListAssociations(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, paths []string) ([]*ttnpb.ApplicationPackageAssociation, error)
- func (r ApplicationPackagesRegistry) ListDefaultAssociations(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, paths []string) ([]*ttnpb.ApplicationPackageDefaultAssociation, error)
- func (r ApplicationPackagesRegistry) Range(ctx context.Context, paths []string, ...) error
- func (r ApplicationPackagesRegistry) SetAssociation(ctx context.Context, ids *ttnpb.ApplicationPackageAssociationIdentifiers, ...) (*ttnpb.ApplicationPackageAssociation, error)
- func (r ApplicationPackagesRegistry) SetDefaultAssociation(ctx context.Context, ...) (*ttnpb.ApplicationPackageDefaultAssociation, error)
- func (r ApplicationPackagesRegistry) WithPagination(ctx context.Context, limit, page uint32, total *int64) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAppPkgsRegistryWithMockedHandlers ¶ added in v3.27.0
func NewAppPkgsRegistryWithMockedHandlers( associationRegistry packages.AssociationRegistry, defaultAssociationRegistry packages.DefaultAssociationRegistry, transactionRegistry packages.TransactionRegistry, rangeFunc func(ctx context.Context, paths []string, devFunc func(context.Context, *ttnpb.EndDeviceIdentifiers, *ttnpb.ApplicationPackageAssociation) bool, appFunc func(context.Context, *ttnpb.ApplicationIdentifiers, *ttnpb.ApplicationPackageDefaultAssociation) bool) error, withPaginationFunc func(ctx context.Context, limit uint32, page uint32, total *int64) context.Context, ) packages.Registry
NewAppPkgsRegistryWithMockedHandlers creates a new application packages registry with mocked handlers.
func NewApplicationPackagesRegistry ¶ added in v3.27.0
func NewApplicationPackagesRegistry( ctx context.Context, cl *ttnredis.Client, lockTTL time.Duration, ) (packages.Registry, error)
NewApplicationPackagesRegistry creates, initializes and returns a new ApplicationPackagesRegistry.
func NewAssociationRegistryMock ¶ added in v3.27.0
func NewAssociationRegistryMock( clearAssociationsFunc func(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) error, getAssociationFunc func(ctx context.Context, ids *ttnpb.ApplicationPackageAssociationIdentifiers, paths []string) (*ttnpb.ApplicationPackageAssociation, error), listAssociationsFunc func(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, paths []string) ([]*ttnpb.ApplicationPackageAssociation, error), setAssociationFunc func(ctx context.Context, ids *ttnpb.ApplicationPackageAssociationIdentifiers, gets []string, f func(*ttnpb.ApplicationPackageAssociation) (*ttnpb.ApplicationPackageAssociation, []string, error)) (*ttnpb.ApplicationPackageAssociation, error), withPaginationFunc func(ctx context.Context, limit, page uint32, total *int64) context.Context, ) packages.AssociationRegistry
NewAssociationRegistryMock returns a new mock AssociationRegistry.
func NewDefaultAssociationRegistryMock ¶ added in v3.27.0
func NewDefaultAssociationRegistryMock( clearDefaultAssociationsFunc func(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) error, getDefaultAssociationFunc func(ctx context.Context, ids *ttnpb.ApplicationPackageDefaultAssociationIdentifiers, paths []string) (*ttnpb.ApplicationPackageDefaultAssociation, error), listDefaultAssociationsFunc func(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, paths []string) ([]*ttnpb.ApplicationPackageDefaultAssociation, error), setDefaultAssociationFunc func(ctx context.Context, ids *ttnpb.ApplicationPackageDefaultAssociationIdentifiers, gets []string, f func(*ttnpb.ApplicationPackageDefaultAssociation) (*ttnpb.ApplicationPackageDefaultAssociation, []string, error)) (*ttnpb.ApplicationPackageDefaultAssociation, error), withPaginationFunc func(ctx context.Context, limit, page uint32, total *int64) context.Context, ) packages.DefaultAssociationRegistry
NewDefaultAssociationRegistryMock returns a new mock for the default association registry.
func NewTransactionRegistryMock ¶ added in v3.27.0
func NewTransactionRegistryMock( endDeviceTransactionFunc func(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, fPort uint32, packageName string, fn func(ctx context.Context) error) error, ) packages.TransactionRegistry
NewTransactionRegistryMock returns a new mock TransactionRegistry.
Types ¶
type ApplicationPackagesRegistry ¶
ApplicationPackagesRegistry is a Redis application packages registry.
func (ApplicationPackagesRegistry) ClearAssociations ¶ added in v3.27.0
func (r ApplicationPackagesRegistry) ClearAssociations( ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, ) error
ClearAssociations clears all the associations for an end device.
func (ApplicationPackagesRegistry) ClearDefaultAssociations ¶ added in v3.27.0
func (r ApplicationPackagesRegistry) ClearDefaultAssociations( ctx context.Context, ids *ttnpb.ApplicationIdentifiers, ) error
ClearDefaultAssociations clears all package associations for an application.
func (*ApplicationPackagesRegistry) EndDeviceTransaction ¶ added in v3.14.1
func (r *ApplicationPackagesRegistry) EndDeviceTransaction(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, fPort uint32, packageName string, fn func(ctx context.Context) error) error
EndDeviceTransaction implements applicationpackages.TransactionRegistry.
func (ApplicationPackagesRegistry) GetAssociation ¶ added in v3.9.0
func (r ApplicationPackagesRegistry) GetAssociation(ctx context.Context, ids *ttnpb.ApplicationPackageAssociationIdentifiers, paths []string) (*ttnpb.ApplicationPackageAssociation, error)
GetAssociation implements applicationpackages.AssociationRegistry.
func (ApplicationPackagesRegistry) GetDefaultAssociation ¶ added in v3.9.0
func (r ApplicationPackagesRegistry) GetDefaultAssociation(ctx context.Context, ids *ttnpb.ApplicationPackageDefaultAssociationIdentifiers, paths []string) (*ttnpb.ApplicationPackageDefaultAssociation, error)
GetDefaultAssociation implements applicationpackages.AssociationRegistry.
func (*ApplicationPackagesRegistry) Init ¶ added in v3.14.1
func (r *ApplicationPackagesRegistry) Init(ctx context.Context) error
Init initializes the ApplicationPackagesRegistry.
func (ApplicationPackagesRegistry) ListAssociations ¶ added in v3.9.0
func (r ApplicationPackagesRegistry) ListAssociations(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, paths []string) ([]*ttnpb.ApplicationPackageAssociation, error)
ListAssociations implements applicationpackages.AssociationRegistry.
func (ApplicationPackagesRegistry) ListDefaultAssociations ¶ added in v3.9.0
func (r ApplicationPackagesRegistry) ListDefaultAssociations(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, paths []string) ([]*ttnpb.ApplicationPackageDefaultAssociation, error)
ListDefaultAssociations implements applicationpackages.AssociationRegistry.
func (ApplicationPackagesRegistry) Range ¶ added in v3.15.2
func (r ApplicationPackagesRegistry) Range( ctx context.Context, paths []string, devFunc func(context.Context, *ttnpb.EndDeviceIdentifiers, *ttnpb.ApplicationPackageAssociation) bool, appFunc func(context.Context, *ttnpb.ApplicationIdentifiers, *ttnpb.ApplicationPackageDefaultAssociation) bool, ) error
Range ranges over the application packages and calls the appropriate callback function, until false is returned.
func (ApplicationPackagesRegistry) SetAssociation ¶ added in v3.9.0
func (r ApplicationPackagesRegistry) SetAssociation(ctx context.Context, ids *ttnpb.ApplicationPackageAssociationIdentifiers, gets []string, f func(*ttnpb.ApplicationPackageAssociation) (*ttnpb.ApplicationPackageAssociation, []string, error)) (*ttnpb.ApplicationPackageAssociation, error)
SetAssociation implements applicationpackages.AssociationRegistry.
func (ApplicationPackagesRegistry) SetDefaultAssociation ¶ added in v3.9.0
func (r ApplicationPackagesRegistry) SetDefaultAssociation(ctx context.Context, ids *ttnpb.ApplicationPackageDefaultAssociationIdentifiers, gets []string, f func(*ttnpb.ApplicationPackageDefaultAssociation) (*ttnpb.ApplicationPackageDefaultAssociation, []string, error)) (*ttnpb.ApplicationPackageDefaultAssociation, error)
SetDefaultAssociation implements applicationpackages.AssociationRegistry.
func (ApplicationPackagesRegistry) WithPagination ¶
func (r ApplicationPackagesRegistry) WithPagination(ctx context.Context, limit, page uint32, total *int64) context.Context
WithPagination implements applicationpackages.AssociationRegistry.