Skip to content
Snippets Groups Projects
Commit 9b6db62d authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

added a channels package docstring

parent e442a896
No related branches found
No related tags found
5 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!371[Channel RSAtoPrivate] Implement Reverse Asymmetric in Client/Broadcast,!354Channels impl,!340Project/channels
...@@ -18,4 +18,6 @@ var ( ...@@ -18,4 +18,6 @@ var (
"the passed message is too long") "the passed message is too long")
WrongPrivateKey = errors.New( WrongPrivateKey = errors.New(
"the passed private key does not match the channel") "the passed private key does not match the channel")
MessageTypeAlreadyRegistered = errors.New("the given message type has " +
"already been registered")
) )
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
package channels package channels
import ( import (
"errors"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/cmix/identity/receptionID" "gitlab.com/elixxir/client/cmix/identity/receptionID"
...@@ -22,13 +21,10 @@ import ( ...@@ -22,13 +21,10 @@ import (
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
) )
// AdminUsername defines the displayed username of admin messages, which are
// unique users for every channel defined by the channel's private key
const AdminUsername = "Admin" const AdminUsername = "Admin"
var (
MessageTypeAlreadyRegistered = errors.New("the given message type has " +
"already been registered")
)
// EventModel is an interface which an external party which uses the channels // EventModel is an interface which an external party which uses the channels
// system passed an object which adheres to in order to get events on the channel // system passed an object which adheres to in order to get events on the channel
type EventModel interface { type EventModel interface {
...@@ -72,6 +68,8 @@ type EventModel interface { ...@@ -72,6 +68,8 @@ type EventModel interface {
//UnPinMessage(ChannelID *id.ID, MessageID cryptoChannel.MessageID) //UnPinMessage(ChannelID *id.ID, MessageID cryptoChannel.MessageID)
} }
// MessageTypeReceiveMessage defines handlers for messages of various message
// types. Default ones for Text, Reaction, and AdminText.
type MessageTypeReceiveMessage func(channelID *id.ID, type MessageTypeReceiveMessage func(channelID *id.ID,
messageID cryptoChannel.MessageID, messageType MessageType, messageID cryptoChannel.MessageID, messageType MessageType,
senderUsername string, content []byte, timestamp time.Time, senderUsername string, content []byte, timestamp time.Time,
......
...@@ -17,6 +17,10 @@ import ( ...@@ -17,6 +17,10 @@ import (
"time" "time"
) )
// ValidForever is used as a validUntil lease when sending to denote the
// message or operation never expires. Note: A message relay must be
// present to enforce this otherwise things expire after 3 weeks due to
// network retention.
var ValidForever = time.Duration(math.MaxInt64) var ValidForever = time.Duration(math.MaxInt64)
type Manager interface { type Manager interface {
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
// LICENSE file // // LICENSE file //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Package channels provides a channels implementation on top of broadcast
// which is capable of handing the user facing features of channels, including
// replies, reactions, and eventually admin commands.
package channels package channels
import ( import (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment