storage

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertStorageErrorToGrpcStatus

func ConvertStorageErrorToGrpcStatus(err error) error

ConvertStorageErrorToGrpcStatus converts any custom hss strogae error into a gRPC status error.

func NewSubscriberListener

func NewSubscriberListener(store SubscriberStore) *subscriberListener

Types

type AlreadyExistsError

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

AlreadyExistsError indicates that the subscriber ID was already in the store and so it cannot be added again.

func NewAlreadyExistsError

func NewAlreadyExistsError(imsi string) AlreadyExistsError

NewAlreadyExistsError creates an AlreadyExistsError.

func (AlreadyExistsError) Error

func (err AlreadyExistsError) Error() string

type InvalidArgumentError

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

InvalidArgumentError indicates that one of the arguments given to a function was not valid.

func NewInvalidArgumentError

func NewInvalidArgumentError(msg string) InvalidArgumentError

NewInvalidArgumentError creates an InvalidArgumentError.

func (InvalidArgumentError) Error

func (err InvalidArgumentError) Error() string

type MemorySubscriberStore

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

MemorySubscriberStore is an in memory implementation of SubscriberStore.

func NewMemorySubscriberStore

func NewMemorySubscriberStore() *MemorySubscriberStore

NewMemorySubscriberStore initializes a MemorySubscriberStore with an empty accounts map. Output: a new MemorySubscriberStore

func (*MemorySubscriberStore) AddSubscriber

func (store *MemorySubscriberStore) AddSubscriber(data *protos.SubscriberData) error

AddSubscriber tries to add this subscriber to the server. This function returns an AlreadyExists error if the subscriber has already been added. Input: The subscriber data which will be added.

func (*MemorySubscriberStore) DeleteAllSubscribers

func (store *MemorySubscriberStore) DeleteAllSubscribers() error

func (*MemorySubscriberStore) DeleteSubscriber

func (store *MemorySubscriberStore) DeleteSubscriber(id string) error

DeleteSubscriber deletes a subscriber by their id. If the subscriber is not found, then this call is ignored. Input: The id of the subscriber to be deleted.

func (*MemorySubscriberStore) GetSubscriberData

func (store *MemorySubscriberStore) GetSubscriberData(id string) (*protos.SubscriberData, error)

GetSubscriberData looks up a subscriber by their id. If the subscriber cannot be found, an error is returned instead. Input: The id of the subscriber to be looked up. Output: The data of the corresponding subscriber or an error.

func (*MemorySubscriberStore) UpdateSubscriber

func (store *MemorySubscriberStore) UpdateSubscriber(data *protos.SubscriberData) error

UpdateSubscriber changes the data stored for an existing subscriber. If the subscriber cannot be found, an error is returned instead. Input: The new subscriber data to store

type SubscriberStore

type SubscriberStore interface {
	// AddSubscriber tries to add this subscriber to the server.
	// This function returns an AlreadyExists error if the subscriber has already
	// been added.
	// Input: The subscriber data which will be added.
	AddSubscriber(data *protos.SubscriberData) error

	// GetSubscriberData looks up a subscriber by their Id.
	// If the subscriber cannot be found, an error is returned instead.
	// Input: The id of the subscriber to be looked up.
	// Output: The data of the corresponding subscriber or an error.
	GetSubscriberData(id string) (*protos.SubscriberData, error)

	// UpdateSubscriber changes the data stored for an existing subscriber.
	// If the subscriber cannot be found, an error is returned instead.
	// Input: The new subscriber data to store
	UpdateSubscriber(data *protos.SubscriberData) error

	// DeleteSubscriber deletes a subscriber by their Id.
	// If the subscriber is not found, then this call is ignored.
	// Input: The id of the subscriber to be deleted.
	DeleteSubscriber(id string) error

	// DeleteAllSubscribers deletes all the data from the store.
	DeleteAllSubscribers() error
}

SubscriberStore is an interface for storing and accessing subscriber data.

type UnknownSubscriberError

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

UnknownSubscriberError indicates that the subscriber ID was not found.

func NewUnknownSubscriberError

func NewUnknownSubscriberError(imsi string) UnknownSubscriberError

NewUnknownSubscriberError creates an UnknownSubscriberError.

func (UnknownSubscriberError) Error

func (err UnknownSubscriberError) Error() string

Jump to

Keyboard shortcuts

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