delivery

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: AGPL-3.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 Delivery

type Delivery struct {

	// ActorID contains the ActivityPub
	// actor ID IRI (if any) of the activity
	// being sent out by this request.
	ActorID string

	// ObjectID contains the ActivityPub
	// object ID IRI (if any) of the activity
	// being sent out by this request.
	ObjectID string

	// TargetID contains the ActivityPub
	// target ID IRI (if any) of the activity
	// being sent out by this request.
	TargetID string

	// Request is the prepared (+ wrapped)
	// httpclient.Client{} request that
	// constitutes this ActivtyPub delivery.
	Request httpclient.Request
	// contains filtered or unexported fields
}

Delivery wraps an httpclient.Request{} to add ActivityPub ID IRI fields of the outgoing activity, so that deliveries may be indexed (and so, dropped from queue) by any of these possible ID IRIs.

type Worker

type Worker struct {

	// Client is the httpclient.Client{} that
	// delivery worker will use for requests.
	Client *httpclient.Client

	// Queue is the Delivery{} message queue
	// that delivery worker will feed from.
	Queue *queue.StructQueue[*Delivery]
	// contains filtered or unexported fields
}

Worker wraps an httpclient.Client{} to feed from queue.StructQueue{} for ActivityPub reqs to deliver. It does so while prioritizing new queued requests over backlogged retries.

func (*Worker) Start

func (w *Worker) Start() bool

Start will attempt to start the Worker{}.

func (*Worker) Stop

func (w *Worker) Stop() bool

Stop will attempt to stop the Worker{}.

type WorkerPool

type WorkerPool struct {

	// Client defines httpclient.Client{}
	// passed to each of delivery pool Worker{}s.
	Client *httpclient.Client

	// Queue is the embedded queue.StructQueue{}
	// passed to each of delivery pool Worker{}s.
	Queue queue.StructQueue[*Delivery]
	// contains filtered or unexported fields
}

WorkerPool wraps multiple Worker{}s in a singular struct for easy multi start/stop.

func (*WorkerPool) Init

func (p *WorkerPool) Init(client *httpclient.Client)

Init will initialize the Worker{} pool with given http client, request queue to pull from and number of delivery workers to spawn.

func (*WorkerPool) Start

func (p *WorkerPool) Start(n int)

Start will attempt to start 'n' Worker{}s.

func (*WorkerPool) Stop

func (p *WorkerPool) Stop()

Stop will attempt to stop contained Worker{}s.

Jump to

Keyboard shortcuts

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