memory

package
v0.0.0-...-aa5a986 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package memory is an implementation of a in-memory only datastore

Index

Constants

View Source
const CertPEM = `` /* 988-byte string literal not displayed */

CertPEM is a test CA

View Source
const RootPEM = `` /* 1678-byte string literal not displayed */

RootPEM is a test CA key

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Orgs     []domain.Organization
	Roll     []domain.Enrollment
	Settings map[string]string
}

Store implements an in-memory store for testing

func NewStore

func NewStore() *Store

NewStore creates a new memory store

func (*Store) DeviceDelete

func (mem *Store) DeviceDelete(deviceID string) (string, error)

nolint

func (*Store) DeviceEnroll

func (mem *Store) DeviceEnroll(device datastore.DeviceEnrollRequest) (*domain.Enrollment, error)

DeviceEnroll enrolls a device with the IoT service

func (*Store) DeviceGet

func (mem *Store) DeviceGet(brand, model, serial string) (*domain.Enrollment, error)

DeviceGet fetches a device registration

func (*Store) DeviceGetByID

func (mem *Store) DeviceGetByID(deviceID string) (*domain.Enrollment, error)

DeviceGetByID fetches a device by its ID

func (*Store) DeviceList

func (mem *Store) DeviceList(orgID string) ([]domain.Enrollment, error)

DeviceList fetches the devices for an organization

func (*Store) DeviceNew

func (mem *Store) DeviceNew(device datastore.DeviceNewRequest) (string, error)

DeviceNew creates a new device registration

func (*Store) DeviceUpdate

func (mem *Store) DeviceUpdate(deviceID string, status domain.Status, deviceData string) error

DeviceUpdate update a device for selected fields

func (*Store) OrganizationGet

func (mem *Store) OrganizationGet(id string) (*domain.Organization, error)

OrganizationGet fetches an organization by ID

func (*Store) OrganizationGetByName

func (mem *Store) OrganizationGetByName(name string) (*domain.Organization, error)

OrganizationGetByName fetches an organization by name

func (*Store) OrganizationList

func (mem *Store) OrganizationList() ([]domain.Organization, error)

OrganizationList lists existing organizations

func (*Store) OrganizationNew

func (mem *Store) OrganizationNew(organization datastore.OrganizationNewRequest) (string, error)

OrganizationNew creates a new organization

Jump to

Keyboard shortcuts

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