workers

package
v0.0.0-...-aa867a8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job interface {
	Work(w *Worker)
}

type JobResp

type JobResp interface{}

type RoomAliasesJob

type RoomAliasesJob struct {
	RoomID   string
	Page     int
	PageSize int
}

func (RoomAliasesJob) Work

func (job RoomAliasesJob) Work(w *Worker)

type RoomAliasesResp

type RoomAliasesResp struct {
	RoomInfo    mxclient.RoomInfo
	RoomAliases mxclient.RoomAliases
	PageSize    int
	Page        int
}

type RoomEventsJob

type RoomEventsJob struct {
	RoomID   string
	Anchor   string
	Offset   int
	PageSize int
}

func (RoomEventsJob) Work

func (job RoomEventsJob) Work(w *Worker)

type RoomEventsResp

type RoomEventsResp struct {
	Events      []gomatrix.Event
	RoomInfo    mxclient.RoomInfo
	MemberMap   map[string]mxclient.MemberInfo
	AtTopEnd    bool
	AtBottomEnd bool
	Err         error
}

type RoomForwardPaginateJob

type RoomForwardPaginateJob struct {
	Wg      *sync.WaitGroup
	TTL     time.Duration
	KeepMin int
}

func (RoomForwardPaginateJob) Work

func (job RoomForwardPaginateJob) Work(w *Worker)

type RoomInitialSyncJob

type RoomInitialSyncJob struct {
	RoomID string
}

func (RoomInitialSyncJob) Work

func (job RoomInitialSyncJob) Work(w *Worker)

type RoomInitialSyncResp

type RoomInitialSyncResp struct {
	Err error
}

type RoomMemberInfoJob

type RoomMemberInfoJob struct {
	RoomID string
	Mxid   string
}

func (RoomMemberInfoJob) Work

func (job RoomMemberInfoJob) Work(w *Worker)

type RoomMemberInfoResp

type RoomMemberInfoResp struct {
	RoomInfo   mxclient.RoomInfo
	MemberInfo mxclient.MemberInfo
	Err        error
}

type RoomMemberNotFoundError

type RoomMemberNotFoundError struct {
	// contains filtered or unexported fields
}

func (*RoomMemberNotFoundError) Error

func (err *RoomMemberNotFoundError) Error() string

type RoomMembersJob

type RoomMembersJob struct {
	RoomID   string
	Page     int
	PageSize int
}

func (RoomMembersJob) Work

func (job RoomMembersJob) Work(w *Worker)

type RoomMembersResp

type RoomMembersResp struct {
	RoomInfo mxclient.RoomInfo
	Members  []mxclient.MemberInfo
	PageSize int
	Page     int
}

type RoomPowerLevelsJob

type RoomPowerLevelsJob struct {
	RoomID string
}

func (RoomPowerLevelsJob) Work

func (job RoomPowerLevelsJob) Work(w *Worker)

type RoomPowerLevelsResp

type RoomPowerLevelsResp struct {
	RoomInfo    mxclient.RoomInfo
	PowerLevels mxclient.PowerLevels
}

type RoomServersJob

type RoomServersJob struct {
	RoomID   string
	Page     int
	PageSize int
}

func (RoomServersJob) Work

func (job RoomServersJob) Work(w *Worker)

type RoomServersResp

type RoomServersResp struct {
	RoomInfo mxclient.RoomInfo
	Servers  mxclient.ServerUserCounts
	PageSize int
	Page     int
}

type Worker

type Worker struct {
	ID int

	Queue  chan Job
	Output chan JobResp
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(id int, m *mxclient.Client) *Worker

NewWorker instantiates a worker and their necessary channels, then starts them and returns them.

func (*Worker) Start

func (w *Worker) Start()

type Workers

type Workers struct {
	NumWorkers uint32
	// contains filtered or unexported fields
}

func NewWorkers

func NewWorkers(numWorkers uint32, m *mxclient.Client) *Workers

func (*Workers) GetWorkerForRoomID

func (ws *Workers) GetWorkerForRoomID(roomID string) Worker

func (*Workers) JobForAllWorkers

func (ws *Workers) JobForAllWorkers(job Job)

JobForAllWorkers sends the job to the channel of each worker.

Jump to

Keyboard shortcuts

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