Documentation
¶
Overview ¶
Package sessiontarget manages persisted session delivery targets.
Index ¶
- Constants
- func ChannelOwner(a config.AgentConfig, sess *domain.Session) int
- func ChannelSessions(a config.AgentConfig, idx int) ([]*domain.Session, error)
- func EnsureChannel(agentName string, cc config.ChannelConfig, mgr *channels.Manager) (*domain.Session, error)
- func EnsureChannels(cfg *config.Config, mgr *channels.Manager) error
- func Register(agentID, agentName, sessionID string, target store.SessionChannel, ...)
- func RekeyChannels(prev, next *config.Config) error
- func ReleaseChannel(a config.AgentConfig, idx int, mode string) error
- func Set(agentID, agentName, sessionID string, target store.SessionChannel, ...) error
Constants ¶
const ( ReleaseArchive = "archive" ReleaseDelete = "delete" )
Ways to dispose of a removed channel's sessions.
Variables ¶
This section is empty.
Functions ¶
func ChannelOwner ¶ added in v0.7.1
func ChannelOwner(a config.AgentConfig, sess *domain.Session) int
ChannelOwner returns the index in a.Channels of the channel that owns sess, or -1. Only channel sessions are owned: the channel's own session and the conversations it received. Archived sessions are regular chats.
func ChannelSessions ¶ added in v0.7.1
ChannelSessions lists the sessions of a.Channels[idx]: its own session first, then the conversations it received, most recent first.
func EnsureChannel ¶ added in v0.7.1
func EnsureChannel(agentName string, cc config.ChannelConfig, mgr *channels.Manager) (*domain.Session, error)
EnsureChannel creates the channel's own session when it has none yet and points the session's delivery at the channel's DeliverTo conversation. It is safe to call on every config load.
func EnsureChannels ¶ added in v0.7.1
EnsureChannels runs EnsureChannel for every channel in cfg, returning the first error after trying them all.
func Register ¶
func Register(agentID, agentName, sessionID string, target store.SessionChannel, mgr *channels.Manager)
Register wires the session's text and media delivery to the configured target described by the sidecar entry.
func RekeyChannels ¶ added in v0.7.1
RekeyChannels moves the sessions of channels whose type stayed but whose ID changed between prev and next, matched by their position in each agent's channel list: the channel's own session moves to its new name, and its conversations record the new configured ID. Without this, editing a channel's ID (a Signal channel's phone number) would orphan its session.
func ReleaseChannel ¶ added in v0.7.1
func ReleaseChannel(a config.AgentConfig, idx int, mode string) error
ReleaseChannel disposes of the sessions of a.Channels[idx], which is being removed: archive keeps each one as a regular chat titled after the channel, and delete removes it with its messages.
Types ¶
This section is empty.