mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-29 13:49:28 +08:00

* Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
79 lines
2.3 KiB
Go
79 lines
2.3 KiB
Go
//
|
|
// Copyright (c) 2018
|
|
// Mainflux
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package things
|
|
|
|
// Channel represents a Mainflux "communication group". This group contains the
|
|
// things that can exchange messages between eachother.
|
|
type Channel struct {
|
|
ID string
|
|
Owner string
|
|
Name string
|
|
Metadata map[string]interface{}
|
|
}
|
|
|
|
// ChannelsPage contains page related metadata as well as list of channels that
|
|
// belong to this page.
|
|
type ChannelsPage struct {
|
|
PageMetadata
|
|
Channels []Channel
|
|
}
|
|
|
|
// ChannelRepository specifies a channel persistence API.
|
|
type ChannelRepository interface {
|
|
// Save persists the channel. Successful operation is indicated by unique
|
|
// identifier accompanied by nil error response. A non-nil error is
|
|
// returned to indicate operation failure.
|
|
Save(Channel) (string, error)
|
|
|
|
// Update performs an update to the existing channel. A non-nil error is
|
|
// returned to indicate operation failure.
|
|
Update(Channel) error
|
|
|
|
// RetrieveByID retrieves the channel having the provided identifier, that is owned
|
|
// by the specified user.
|
|
RetrieveByID(string, string) (Channel, error)
|
|
|
|
// RetrieveAll retrieves the subset of channels owned by the specified user.
|
|
RetrieveAll(string, uint64, uint64) ChannelsPage
|
|
|
|
// RetrieveByThing retrieves the subset of channels owned by the specified
|
|
// user and have specified thing connected to them.
|
|
RetrieveByThing(string, string, uint64, uint64) ChannelsPage
|
|
|
|
// Remove removes the channel having the provided identifier, that is owned
|
|
// by the specified user.
|
|
Remove(string, string) error
|
|
|
|
// Connect adds thing to the channel's list of connected things.
|
|
Connect(string, string, string) error
|
|
|
|
// Disconnect removes thing from the channel's list of connected
|
|
// things.
|
|
Disconnect(string, string, string) error
|
|
|
|
// HasThing determines whether the thing with the provided access key, is
|
|
// "connected" to the specified channel. If that's the case, it returns
|
|
// thing's ID.
|
|
HasThing(string, string) (string, error)
|
|
}
|
|
|
|
// ChannelCache contains channel-thing connection caching interface.
|
|
type ChannelCache interface {
|
|
// Connect channel thing connection.
|
|
Connect(string, string) error
|
|
|
|
// HasThing checks if thing is connected to channel.
|
|
HasThing(string, string) bool
|
|
|
|
// Disconnects thing from channel.
|
|
Disconnect(string, string) error
|
|
|
|
// Removes channel from cache.
|
|
Remove(string) error
|
|
}
|