registry

package
v0.12.10 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppContainer          = "app"
	ThingContainer        = "thing"
	AttributeUpdatedByCmd = 1
	AttributeUpdatedByEvt = 2
)
View Source
const IDnil = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	ID       ID        `json:"id" storm:"id,increment"`
	Services []Service `json:"services"`
}

type App

type App struct {
	ID       ID        `json:"id" storm:"id,increment"`
	Services []Service `json:"services"`
}

type AttributeValueContainer

type AttributeValueContainer struct {
	Value     interface{}
	ValueType string
	UpdatedAt time.Time
	UpdatedBy int
}

type Bridge

type Bridge struct {
	ID       ID        `json:"id" storm:"id,increment"`
	Services []Service `json:"services"`
}

type ID

type ID int

type Interface

type Interface struct {
	Type      string `json:"intf_t"`
	MsgType   string `json:"msg_t"`
	ValueType string `json:"val_t"`
	Version   string `json:"ver"`
}

type InterfaceFlatView

type InterfaceFlatView struct {
	ThingId            ID       `json:"thing_id"`
	ThingAddress       string   `json:"thing_address"`
	ThingTech          string   `json:"thing_tech"`
	ThingAlias         string   `json:"thing_alias"`
	ServiceId          ID       `json:"service_id"`
	ServiceName        string   `json:"service_name"`
	ServiceAlias       string   `json:"service_alias"`
	ServiceAddress     string   `json:"service_address"`
	InterfaceType      string   `json:"intf_type"`
	InterfaceMsgType   string   `json:"intf_msg_type"`
	InterfaceAddress   string   `json:"intf_address"`
	InterfaceValueType string   `json:"intf_val_type"`
	LocationId         ID       `json:"location_id"`
	LocationAlias      string   `json:"location_alias"`
	LocationType       string   `json:"location_type"`
	Groups             []string `json:"groups"`
}

type Location

type Location struct {
	ID             ID         `json:"id" storm:"id,increment,index"`
	IntegrationId  string     `json:"integr_id"`
	Type           string     `json:"type"`
	SubType        string     `json:"sub_type"`
	Alias          string     `json:"alias"`
	Address        string     `json:"address"`
	Longitude      float64    `json:"long"`
	Latitude       float64    `json:"lat"`
	Image          string     `json:"image"`
	ChildLocations []Location `json:"child_locations"`
	State          string     `json:"state"`
}

type Service

type Service struct {
	ID                  ID                                 `json:"id"  storm:"id,increment,index"`
	IntegrationId       string                             `json:"integr_id" storm:"index"`
	ParentContainerId   ID                                 `json:"container_id" storm:"index"`
	ParentContainerType string                             `json:"container_type" storm:"index"`
	Name                string                             `json:"name" storm:"index"`
	Enabled             bool                               `json:"enabled"`
	Alias               string                             `json:"alias"`
	Address             string                             `json:"address" storm:"index"`
	Groups              []string                           `json:"groups"`
	LocationId          ID                                 `json:"location_id" storm:"index"`
	Props               map[string]interface{}             `json:"props"`
	Tags                []string                           `json:"tags"`
	Interfaces          []Interface                        `json:"interfaces"`
	Attributes          map[string]AttributeValueContainer `json:"attributes"`
}

type ServiceExtendedView

type ServiceExtendedView struct {
	Service
	LocationAlias   string `json:"location_alias"`
	LocationType    string `json:"location_type"`
	LocationSubType string `json:"location_sub_type"`
}

type Thing

type Thing struct {
	ID                ID                                `json:"id" storm:"id,increment,index"`
	IntegrationId     string                            `json:"integr_id" storm:"index"`
	Address           string                            `json:"address" storm:"index"`
	Type              string                            `json:"type"`
	ProductHash       string                            `json:"product_hash"`
	Alias             string                            `json:"alias"`
	CommTechnology    string                            `json:"comm_tech" storm:"index"`
	ProductId         string                            `json:"product_id"`
	ProductName       string                            `json:"product_name"`
	ManufacturerId    string                            `json:"manufacturer_id"`
	DeviceId          string                            `json:"device_id"`
	HwVersion         string                            `json:"hw_ver"`
	SwVersion         string                            `json:"sw_ver"`
	PowerSource       string                            `json:"power_source"`
	WakeUpInterval    string                            `json:"wakeup_interval"`
	Security          string                            `json:"security"`
	Tags              []string                          `json:"tags"`
	LocationId        ID                                `json:"location_id" storm:"index"`
	PropSets          map[string]map[string]interface{} `json:"prop_set"`
	TechSpecificProps map[string]string                 `json:"tech_specific_props"`
	UpdatedAt         time.Time                         `json:"updated_at"`
}

type ThingExtendedView

type ThingExtendedView struct {
	Thing
	Services      []ServiceExtendedView `json:"services"`
	LocationAlias string                `json:"location_alias"`
}

type ThingRegistry

type ThingRegistry struct {
	Things    []Thing
	Locations []Location
}

type ThingRegistryStore

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

func NewThingRegistryStore

func NewThingRegistryStore(storeFile string) *ThingRegistryStore

func (*ThingRegistryStore) ClearAll

func (st *ThingRegistryStore) ClearAll() error

func (*ThingRegistryStore) Connect

func (st *ThingRegistryStore) Connect() error

func (*ThingRegistryStore) DeleteLocation

func (st *ThingRegistryStore) DeleteLocation(id ID) error

func (*ThingRegistryStore) DeleteService

func (st *ThingRegistryStore) DeleteService(id ID) error

func (*ThingRegistryStore) DeleteThing

func (st *ThingRegistryStore) DeleteThing(id ID) error

func (*ThingRegistryStore) Disconnect

func (st *ThingRegistryStore) Disconnect()

func (*ThingRegistryStore) ExtendThingsWithLocation

func (st *ThingRegistryStore) ExtendThingsWithLocation(things []Thing) []ThingWithLocationView

func (*ThingRegistryStore) GetAllLocations

func (st *ThingRegistryStore) GetAllLocations() ([]Location, error)

func (*ThingRegistryStore) GetAllServices

func (st *ThingRegistryStore) GetAllServices() ([]Service, error)

func (*ThingRegistryStore) GetAllThings

func (st *ThingRegistryStore) GetAllThings() ([]Thing, error)

func (*ThingRegistryStore) GetConnection

func (st *ThingRegistryStore) GetConnection() interface{}

func (*ThingRegistryStore) GetExtendedServices

func (st *ThingRegistryStore) GetExtendedServices(serviceNameFilter string, filterWithoutAlias bool, thingIdFilter ID, locationIdFilter ID) ([]ServiceExtendedView, error)

GetExtendedServices return services enhanced with location Alias

func (*ThingRegistryStore) GetLocationById

func (st *ThingRegistryStore) GetLocationById(Id ID) (*Location, error)

func (*ThingRegistryStore) GetLocationByIntegrationId

func (st *ThingRegistryStore) GetLocationByIntegrationId(id string) (*Location, error)

func (*ThingRegistryStore) GetServiceByAddress

func (st *ThingRegistryStore) GetServiceByAddress(serviceName string, serviceAddress string) (*Service, error)

func (*ThingRegistryStore) GetServiceByFullAddress

func (st *ThingRegistryStore) GetServiceByFullAddress(address string) (*ServiceExtendedView, error)

func (*ThingRegistryStore) GetServiceById

func (st *ThingRegistryStore) GetServiceById(Id ID) (*Service, error)

func (*ThingRegistryStore) GetState

func (st *ThingRegistryStore) GetState() string

func (*ThingRegistryStore) GetThingByAddress

func (st *ThingRegistryStore) GetThingByAddress(technology string, address string) (*Thing, error)

func (*ThingRegistryStore) GetThingById

func (st *ThingRegistryStore) GetThingById(Id ID) (*Thing, error)

func (*ThingRegistryStore) GetThingByIntegrationId

func (st *ThingRegistryStore) GetThingByIntegrationId(id string) (*Thing, error)

func (*ThingRegistryStore) GetThingExtendedViewByAddress

func (st *ThingRegistryStore) GetThingExtendedViewByAddress(technology string, address string) (*ThingExtendedView, error)

func (*ThingRegistryStore) GetThingExtendedViewById

func (st *ThingRegistryStore) GetThingExtendedViewById(Id ID) (*ThingExtendedView, error)

GetThingExtendedViewById return thing enhanced with linked services and location Alias

func (*ThingRegistryStore) GetThingsByLocationId

func (st *ThingRegistryStore) GetThingsByLocationId(locationId ID) ([]Thing, error)

func (*ThingRegistryStore) Init

func (st *ThingRegistryStore) Init() error

func (*ThingRegistryStore) LoadConfig

func (st *ThingRegistryStore) LoadConfig(config interface{}) error

func (*ThingRegistryStore) ReindexAll

func (st *ThingRegistryStore) ReindexAll() error

func (*ThingRegistryStore) Stop

func (st *ThingRegistryStore) Stop()

func (*ThingRegistryStore) UpsertLocation

func (st *ThingRegistryStore) UpsertLocation(location *Location) (ID, error)

func (*ThingRegistryStore) UpsertService

func (st *ThingRegistryStore) UpsertService(service *Service) (ID, error)

func (*ThingRegistryStore) UpsertThing

func (st *ThingRegistryStore) UpsertThing(thing *Thing) (ID, error)

type ThingWithLocationView

type ThingWithLocationView struct {
	Thing
	LocationAlias string `json:"location_alias"`
}

Directories

Path Synopsis
integration
fh

Jump to

Keyboard shortcuts

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