memory

package
v0.0.0-...-73fe611 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Devices        []datastore.Device
	Snaps          []datastore.DeviceSnap
	Actions        []datastore.Action
	DeviceVersions []datastore.DeviceVersion
	Groups         []datastore.Group
	GroupLinks     []datastore.GroupDeviceLink
	// contains filtered or unexported fields
}

Store implements an in-memory store for testing

func NewStore

func NewStore() *Store

NewStore creates a new memory store

func (*Store) ActionCreate

func (mem *Store) ActionCreate(act datastore.Action) (int64, error)

ActionCreate creates an action log

func (*Store) ActionListForDevice

func (mem *Store) ActionListForDevice(orgID, clientID string) ([]datastore.Action, error)

ActionListForDevice fetches the actions for a device

func (*Store) ActionUpdate

func (mem *Store) ActionUpdate(actionID, status, message string) error

ActionUpdate updates an action log

func (*Store) DeviceCreate

func (mem *Store) DeviceCreate(device datastore.Device) (int64, error)

DeviceCreate creates a new device

func (*Store) DeviceGet

func (mem *Store) DeviceGet(id string) (datastore.Device, error)

DeviceGet fetches an existing device

func (*Store) DeviceList

func (mem *Store) DeviceList(orgID string) ([]datastore.Device, error)

DeviceList fetches existing devices

func (*Store) DevicePing

func (mem *Store) DevicePing(id string, refresh time.Time) error

DevicePing updates a device to indicate its health

func (*Store) DeviceSnapDelete

func (mem *Store) DeviceSnapDelete(id int64) error

DeviceSnapDelete deletes the snap records for a device

func (*Store) DeviceSnapList

func (mem *Store) DeviceSnapList(id int64) ([]datastore.DeviceSnap, error)

DeviceSnapList lists the snaps for a device

func (*Store) DeviceSnapUpsert

func (mem *Store) DeviceSnapUpsert(ds datastore.DeviceSnap) error

DeviceSnapUpsert creates or updates a snap for a device

func (*Store) DeviceVersionDelete

func (mem *Store) DeviceVersionDelete(id int64) error

DeviceVersionDelete removes a OS record

func (*Store) DeviceVersionGet

func (mem *Store) DeviceVersionGet(deviceID int64) (datastore.DeviceVersion, error)

DeviceVersionGet gets the OS details for a device

func (*Store) DeviceVersionUpsert

func (mem *Store) DeviceVersionUpsert(dv datastore.DeviceVersion) error

DeviceVersionUpsert creates or updates the device OS details

func (*Store) GroupCreate

func (mem *Store) GroupCreate(orgID, name string) (int64, error)

GroupCreate creates a group record

func (*Store) GroupGet

func (mem *Store) GroupGet(orgID, name string) (datastore.Group, error)

GroupGet fetches a group record

func (*Store) GroupGetDevices

func (mem *Store) GroupGetDevices(orgID, name string) ([]datastore.Device, error)

GroupGetDevices fetches the devices for a group

func (*Store) GroupGetExcludedDevices

func (mem *Store) GroupGetExcludedDevices(orgID, name string) ([]datastore.Device, error)

GroupGetExcludedDevices fetches the devices not in a group

func (*Store) GroupLinkDevice

func (mem *Store) GroupLinkDevice(orgID, name, clientID string) error

GroupLinkDevice links a device with a group

func (*Store) GroupList

func (mem *Store) GroupList(orgID string) ([]datastore.Group, error)

GroupList lists groups for an organization

func (*Store) GroupUnlinkDevice

func (mem *Store) GroupUnlinkDevice(orgID, name, clientID string) error

GroupUnlinkDevice unlinks a device from a group

Jump to

Keyboard shortcuts

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