1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-26 13:48:53 +08:00
Manuel Imperiale d2fc379e3f NOISSUE - Fix Postgres logs in Things service (#734)
* NOISSUE - Fix Postgres logs in Things service

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix uuid package

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2019-05-10 18:55:13 +02:00

79 lines
2.4 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, error)
// RetrieveByThing retrieves the subset of channels owned by the specified
// user and have specified thing connected to them.
RetrieveByThing(string, string, uint64, uint64) (ChannelsPage, error)
// 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
}