queue

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClearRequest

type ClearRequest struct{}

ClearRequest represents a Clear request.

func (ClearRequest) Validate

func (r ClearRequest) Validate() error

Validate the request.

type DelayedRequest

type DelayedRequest struct{}

DelayedRequest represents an Delayed request.

func (DelayedRequest) Validate

func (r DelayedRequest) Validate() error

Validate the request.

type Domain

type Domain string

Domain in the queue.

const (
	DeliverDomain       Domain = "deliver"
	InboxDomain         Domain = "inbox"
	DBDomain            Domain = "db"
	ObjectStorageDomain Domain = "objectStorage"
)

Job domains.

type JobsRequest

type JobsRequest struct {
	Domain Domain `json:"domain"`
	State  State  `json:"state"`
	Limit  uint   `json:"limit,omitempty"`
}

JobsRequest represents an Jobs request.

func (JobsRequest) Validate

func (r JobsRequest) Validate() error

Validate the request.

type Service

type Service struct {
	Call core.RequestHandlerFunc
}

Service is the base for all the endpoints on this service.

func NewService

func NewService(requestHandler core.RequestHandlerFunc) *Service

NewService creates a new Service instance.

func (*Service) Clear

func (s *Service) Clear() error

Clear all queues.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

err := client.Admin().Queue().Clear()
if err != nil {
	log.Printf("[Admin/Queue] %s", err)
}
Output:

func (*Service) DeliverDelayed

func (s *Service) DeliverDelayed() ([]models.Delayed, error)

DeliverDelayed lists delayed deliver hosts with count.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

response, err := client.Admin().Queue().DeliverDelayed()
if err != nil {
	log.Printf("[Admin/Queue] %s", err)

	return
}

for _, item := range response {
	log.Printf("%s => %d", item.Host, item.Count)
}
Output:

func (*Service) InboxDelayed

func (s *Service) InboxDelayed() ([]models.Delayed, error)

InboxDelayed lists delayed inbox hosts with count.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

response, err := client.Admin().Queue().InboxDelayed()
if err != nil {
	log.Printf("[Admin/Queue] %s", err)

	return
}

for _, item := range response {
	log.Printf("%s => %d", item.Host, item.Count)
}
Output:

func (*Service) Jobs

func (s *Service) Jobs(request JobsRequest) ([]models.Job, error)

Jobs lists all jobs in a queue with state.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

response, err := client.Admin().Queue().Jobs(queue.JobsRequest{})
if err != nil {
	log.Printf("[Admin/Queue] %s", err)

	return
}

for _, item := range response {
	log.Printf("[Admin/Queue] Attempts: %d/%d", item.Attempts, item.MaxAttempts)
}
Output:

func (*Service) Stats

func (s *Service) Stats() (models.QueueStats, error)

Stats shows all queues with stats.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

response, err := client.Admin().Queue().Stats()
if err != nil {
	log.Printf("[Admin/Queue] %s", err)

	return
}

log.Printf("Deliver :: Waiting = %d", response.Deliver.Waiting)
Output:

type State

type State string

State for a job.

const (
	ActiveState  State = "active"
	WaitingState State = "waiting"
	DelayedState State = "delayed"
)

Job states.

type StatsRequest

type StatsRequest struct{}

StatsRequest represents an Stats request.

func (StatsRequest) Validate

func (r StatsRequest) Validate() error

Validate the request.

Jump to

Keyboard shortcuts

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