subscriptions

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Subscriptions

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

func New

func New(
	state *state.State,
	transportController transport.Controller,
	tc *typeutils.Converter,
) *Subscriptions

func (*Subscriptions) ProcessDomainPermissionSubscription

func (s *Subscriptions) ProcessDomainPermissionSubscription(
	ctx context.Context,
	permSub *gtsmodel.DomainPermissionSubscription,
	tsport transport.Transport,
	higherPrios []*gtsmodel.DomainPermissionSubscription,
	dry bool,
) ([]gtsmodel.DomainPermission, error)

ProcessDomainPermissionSubscription processes one domain permission subscription by dereferencing the URI, parsing the response into a list of permissions, and for each discovered permission either creating an entry in the database, or ignoring it if it's excluded or already covered by a higher-priority subscription.

On success, the slice of discovered DomainPermissions will be returned. In case of parsing error, or error on the remote side, permSub.Error will be updated with the calling/parsing error, and `nil, nil` will be returned. In case of an actual db error, `nil, err` will be returned and the caller should handle it.

getHigherPrios should be a function for returning a slice of domain permission subscriptions with a higher priority than the given permSub.

If dry == true, then the URI will still be called, and permissions will be parsed, but they will not actually be created.

Note that while this function modifies fields on the given permSub, it's up to the caller to update it in the database (if desired).

func (*Subscriptions) ProcessDomainPermissionSubscriptions

func (s *Subscriptions) ProcessDomainPermissionSubscriptions(
	ctx context.Context,
	permType gtsmodel.DomainPermissionType,
)

ProcessDomainPermissionSubscriptions processes all domain permission subscriptions of the given permission type by, in turn, calling the URI of each subscription, parsing the result into a list of domain permissions, and creating (or skipping) each permission as appropriate.

func (*Subscriptions) ScheduleJobs

func (s *Subscriptions) ScheduleJobs() error

ScheduleJobs schedules domain permission subscription fetching + updating using configured parameters.

Returns an error if `MediaCleanupFrom` is not a valid format (hh:mm:ss).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳