mondb

package
v0.0.0-...-91d2721 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TeamMonitorIDSet        = "id-set"
	ParticipantMonitorIDSet = "id-set"
)

Variables

This section is empty.

Functions

func GetLookupKey

func GetLookupKey(monName string, parts ...string) string

func GetRedisClient

func GetRedisClient() (*redis.Client, error)

GetRedisClient get our redis client

func MakeKey

func MakeKey(monName string, key ...string) string

Types

type BaseMonitor

type BaseMonitor struct {
	MonitorName string `json:"monitor-name"`
}

func NewBaseMonitor

func NewBaseMonitor(monName string) *BaseMonitor

func (*BaseMonitor) GetLookupKey

func (m *BaseMonitor) GetLookupKey(parts ...string) string

func (*BaseMonitor) GetRedisClient

func (m *BaseMonitor) GetRedisClient() (*redis.Client, error)

GetRedisClient get our redis client

func (*BaseMonitor) MakeKey

func (m *BaseMonitor) MakeKey(key ...string) string

type ParticipantMonitor

type ParticipantMonitor struct {
	*BaseMonitor
	ParticipantID int `json:"participant-id"`
}

func GetAllParticipants

func GetAllParticipants(ctx context.Context) ([]*ParticipantMonitor, error)

GetAllParticipants returns a list of all monitored participants

func NewParticipantMonitor

func NewParticipantMonitor(participantID int) *ParticipantMonitor

func NewParticipantMonitorFromJSON

func NewParticipantMonitorFromJSON(data []byte) (*ParticipantMonitor, error)

func (*ParticipantMonitor) AmMonitoring

func (t *ParticipantMonitor) AmMonitoring(ctx context.Context) (bool, error)

AmMonitoring are we monitoring this id

func (*ParticipantMonitor) GetKey

func (t *ParticipantMonitor) GetKey() string

func (*ParticipantMonitor) GetParticipant

func (t *ParticipantMonitor) GetParticipant(ctx context.Context) (*df.CachedParticipant, error)

GetParticipant gets the cached participant info

func (*ParticipantMonitor) KafkaHeaders

func (t *ParticipantMonitor) KafkaHeaders(p *df.CachedParticipant) []kafka.Header

KafkaHeaders are used in kafka for info, routing, and debugging

func (*ParticipantMonitor) KafkaKeyForEvents

func (t *ParticipantMonitor) KafkaKeyForEvents(p *df.CachedParticipant) ([]byte, error)

KafkaKeyForEvents is used in kafka for identity - For events topic (non-compacted) - tl;dr All data, not fetch time though

func (*ParticipantMonitor) KafkaKeyForParticipants

func (t *ParticipantMonitor) KafkaKeyForParticipants(p *df.CachedParticipant) ([]byte, error)

KafkaKeyForParticipants is used in kafka for identity - For teams topic (compacted)

func (*ParticipantMonitor) MakeEventsMessages

func (t *ParticipantMonitor) MakeEventsMessages(p *df.CachedParticipant) ([]kafka.Message, error)

MakeEventsMessages creates the kafka message(s) for the given Participant - events topic

func (*ParticipantMonitor) MakeParticipantMessages

func (t *ParticipantMonitor) MakeParticipantMessages(p *df.CachedParticipant) ([]kafka.Message, error)

MakeParticipantMessages creates the kafka message(s) for the given participant - participants topic

func (*ParticipantMonitor) MonitorKey

func (t *ParticipantMonitor) MonitorKey() string

func (*ParticipantMonitor) SetUpdateMonitoring

func (t *ParticipantMonitor) SetUpdateMonitoring(ctx context.Context, duration time.Duration) error

SetUpdateMonitoring turns on monitoring for team.active period

func (*ParticipantMonitor) WriteParticipantToKafka

func (t *ParticipantMonitor) WriteParticipantToKafka(ctx context.Context) error

WriteParticipantToKafka fetches and writes the updated info from gcache into kafka

type TeamMonitor

type TeamMonitor struct {
	*BaseMonitor
	TeamID int `json:"team-id"`
}

func GetAllTeams

func GetAllTeams(ctx context.Context) ([]*TeamMonitor, error)

GetAllTeams returns a list of all monitored teams

func NewTeamMonitor

func NewTeamMonitor(teamID int) *TeamMonitor

func NewTeamMonitorFromJSON

func NewTeamMonitorFromJSON(data []byte) (*TeamMonitor, error)

func (*TeamMonitor) AmMonitoring

func (t *TeamMonitor) AmMonitoring(ctx context.Context) (bool, error)

AmMonitoring are we monitoring this id

func (*TeamMonitor) GetKey

func (t *TeamMonitor) GetKey() string

func (*TeamMonitor) GetTeam

func (t *TeamMonitor) GetTeam(ctx context.Context) (*df.CachedTeam, error)

GetTeam gets the cached team info

func (*TeamMonitor) GetTeamParticipants

func (t *TeamMonitor) GetTeamParticipants(ctx context.Context) (*df.CachedParticipants, error)

GetTeamParticipants gets the cached list of participants for the team

func (*TeamMonitor) MakeEventsMessages

func (t *TeamMonitor) MakeEventsMessages(team *df.CachedTeam) ([]kafka.Message, error)

MakeEventsMessages creates the kafka message(s) for the given team - events topic

func (*TeamMonitor) MakeTeamMessages

func (t *TeamMonitor) MakeTeamMessages(team *df.CachedTeam) ([]kafka.Message, error)

MakeTeamMessages creates the kafka message(s) for the given team - teams topic

func (*TeamMonitor) MonitorKey

func (t *TeamMonitor) MonitorKey() string

func (*TeamMonitor) SetUpdateMonitoring

func (t *TeamMonitor) SetUpdateMonitoring(ctx context.Context) error

SetUpdateMonitoring turns on monitoring for team.active period

func (*TeamMonitor) TeamKafkaHeaders

func (t *TeamMonitor) TeamKafkaHeaders(team *df.CachedTeam) []kafka.Header

TeamKafkaHeaders are used in kafka for info, routing, and debugging

func (*TeamMonitor) TeamKafkaKeyEvents

func (t *TeamMonitor) TeamKafkaKeyEvents(team *df.CachedTeam) ([]byte, error)

TeamKafkaKeyEvents is used in kafka for identity - For events topic (compacted) - tl;dr All data, not fetch time though

func (*TeamMonitor) TeamKafkaKeyTeams

func (t *TeamMonitor) TeamKafkaKeyTeams(team *df.CachedTeam) ([]byte, error)

TeamKafkaKeyTeams is used in kafka for identity - For teams topic (compacted)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL