Documentation ¶
Index ¶
- func RegisterPlugin(plugin string, newFunc NewPlugin)
- type AuthInfo
- type BaseAdapter
- func (adapter *BaseAdapter) Close()
- func (adapter *BaseAdapter) GetData(pathList []string) (data map[string]interface{}, err error)
- func (adapter *BaseAdapter) GetName() (name string)
- func (adapter *BaseAdapter) GetPathList() (pathList []string, err error)
- func (adapter *BaseAdapter) GetSubscribeChannel() (channel <-chan map[string]interface{})
- func (adapter *BaseAdapter) IsPathPublic(path string) (result bool, err error)
- func (adapter *BaseAdapter) SetData(data map[string]interface{}) (err error)
- func (adapter *BaseAdapter) Subscribe(pathList []string) (err error)
- func (adapter *BaseAdapter) Unsubscribe(pathList []string) (err error)
- func (adapter *BaseAdapter) UnsubscribeAll() (err error)
- type BaseData
- type DataAdapter
- type DataProvider
- func (provider *DataProvider) Close()
- func (provider *DataProvider) GetData(path string, authInfo *AuthInfo) (data interface{}, err error)
- func (provider *DataProvider) GetSubscribeIDs() (result []uint64)
- func (provider *DataProvider) SetData(path string, data interface{}, authInfo *AuthInfo) (err error)
- func (provider *DataProvider) Subscribe(path string, authInfo *AuthInfo) (id uint64, channel <-chan interface{}, err error)
- func (provider *DataProvider) Unsubscribe(id uint64, authInfo *AuthInfo) (err error)
- type NewPlugin
- type PathFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPlugin ¶
RegisterPlugin registers data adapter plugin.
Types ¶
type BaseAdapter ¶
type BaseAdapter struct { Name string Data map[string]*BaseData sync.Mutex SubscribeChannel chan map[string]interface{} }
BaseAdapter base adapter.
func NewBaseAdapter ¶
func NewBaseAdapter() (adapter *BaseAdapter, err error)
NewBaseAdapter creates base adapter.
func (*BaseAdapter) GetData ¶
func (adapter *BaseAdapter) GetData(pathList []string) (data map[string]interface{}, err error)
GetData returns data by path.
func (*BaseAdapter) GetName ¶
func (adapter *BaseAdapter) GetName() (name string)
GetName returns adapter name.
func (*BaseAdapter) GetPathList ¶
func (adapter *BaseAdapter) GetPathList() (pathList []string, err error)
GetPathList returns list of all pathes for this adapter.
func (*BaseAdapter) GetSubscribeChannel ¶
func (adapter *BaseAdapter) GetSubscribeChannel() (channel <-chan map[string]interface{})
GetSubscribeChannel returns channel on which data changes will be sent.
func (*BaseAdapter) IsPathPublic ¶
func (adapter *BaseAdapter) IsPathPublic(path string) (result bool, err error)
IsPathPublic returns true if requested data accessible without authorization.
func (*BaseAdapter) SetData ¶
func (adapter *BaseAdapter) SetData(data map[string]interface{}) (err error)
SetData sets data by pathes.
func (*BaseAdapter) Subscribe ¶
func (adapter *BaseAdapter) Subscribe(pathList []string) (err error)
Subscribe subscribes for data changes.
func (*BaseAdapter) Unsubscribe ¶
func (adapter *BaseAdapter) Unsubscribe(pathList []string) (err error)
Unsubscribe unsubscribes from data changes.
func (*BaseAdapter) UnsubscribeAll ¶
func (adapter *BaseAdapter) UnsubscribeAll() (err error)
UnsubscribeAll unsubscribes from all data changes.
type BaseData ¶
type BaseData struct { Public bool ReadOnly bool Value interface{} // contains filtered or unexported fields }
BaseData base data type.
type DataAdapter ¶
type DataAdapter interface { // Close closes adapter Close() // GetName returns adapter name GetName() (name string) // GetPathList returns list of all pathes for this adapter GetPathList() (pathList []string, err error) // IsPathPublic returns true if requested data accessible without authorization IsPathPublic(path string) (result bool, err error) // GetData returns data by path GetData(pathList []string) (data map[string]interface{}, err error) // SetData sets data by pathes SetData(data map[string]interface{}) (err error) // GetSubscribeChannel returns channel on which data changes will be sent GetSubscribeChannel() (channel <-chan map[string]interface{}) // Subscribe subscribes for data changes Subscribe(pathList []string) (err error) // Unsubscribe unsubscribes from data changes Unsubscribe(pathList []string) (err error) // UnsubscribeAll unsubscribes from all data changes UnsubscribeAll() (err error) }
DataAdapter interface to data adapter.
type DataProvider ¶
DataProvider interface for geeting vehicle data.
func New ¶
func New(config *config.Config) (provider *DataProvider, err error)
New returns pointer to DataProvider.
func (*DataProvider) GetData ¶
func (provider *DataProvider) GetData(path string, authInfo *AuthInfo) (data interface{}, err error)
GetData returns VIS data.
func (*DataProvider) GetSubscribeIDs ¶
func (provider *DataProvider) GetSubscribeIDs() (result []uint64)
GetSubscribeIDs returns list of active subscribe ID.
func (*DataProvider) SetData ¶
func (provider *DataProvider) SetData(path string, data interface{}, authInfo *AuthInfo) (err error)
SetData sets VIS data.
func (*DataProvider) Subscribe ¶
func (provider *DataProvider) Subscribe( path string, authInfo *AuthInfo, ) (id uint64, channel <-chan interface{}, err error)
Subscribe subscribes for data change.
func (*DataProvider) Unsubscribe ¶
func (provider *DataProvider) Unsubscribe(id uint64, authInfo *AuthInfo) (err error)
Unsubscribe unsubscribes from data change.
type NewPlugin ¶
type NewPlugin func(configJSON json.RawMessage) (adapter DataAdapter, err error)
NewPlugin plugin new function.
type PathFilter ¶
type PathFilter struct {
// contains filtered or unexported fields
}
PathFilter path filter structure.
func CreatePathFilter ¶
func CreatePathFilter(path string) (filter *PathFilter, err error)
CreatePathFilter creates path filter.
func (*PathFilter) Match ¶
func (filter *PathFilter) Match(path string) (result bool)
Match returns true is path matches the filter.