logic

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block added in v0.6.0

type Block interface {
	AddBlock(ctx context.Context, account *models.Account, block *models.Block) error
	AddBlocks(ctx context.Context, account *models.Account, blocks ...*models.Block) error
	DeleteBlock(ctx context.Context, account *models.Account, block *models.Block) error
	GetBlockList(ctx context.Context) (*[]string, error)
	IsDomainBlocked(ctx context.Context, d string) (bool, error)
	ProcessBlockAdd(ctx context.Context, blockID int64) error
	ProcessBlockDelete(ctx context.Context, blockID int64) error
	ProcessBlockUpdate(ctx context.Context, blockID int64) error
	UpdateBlock(ctx context.Context, account *models.Account, changes []models.LogEntryBlockUpdateChange, block *models.Block) error
}

type Error

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

Error represents a logic specific error.

func NewError

func NewError(m string) *Error

NewError wraps a message in an Error object.

func NewErrorf

func NewErrorf(m string, args ...interface{}) *Error

NewErrorf wraps a message in an Error object.

func (*Error) Error

func (e *Error) Error() string

Error returns the error message as a string.

type Instance added in v0.6.0

type Instance interface {
	GetInstance(ctx context.Context, domain string) (*models.Instance, error)
	GetInstanceForActor(ctx context.Context, actorID *url.URL) (*models.Instance, error)
	GetInstanceForServerHostname(ctx context.Context, serverHostname string) (*models.Instance, error)
	GetInstanceSelf(ctx context.Context) (*models.Instance, error)
}

type Logic

type Logic interface {
	Block
	Instance
	Metrics
	Scheduler

	DeliverActivity(ctx context.Context, jid string, instanceID int64, activity fedihelper.Activity) error
	Domain() string
	GetAccountConfigMap(ctx context.Context, keys ...models.ConfigKey) (*models.AccountConfigMap, error)
	GetConfigMap(ctx context.Context, keys ...models.ConfigKey) (*models.ConfigMap, error)
	GetConfigMapForAccount(ctx context.Context, accountID int64, keys ...models.ConfigKey) (*models.ConfigMap, error)
	GetLoginURL(ctx context.Context, instance *models.Instance) (*url.URL, error)
	GetPeers(ctx context.Context) (*[]string, error)
	MaintDeliveryErrorTimeout(ctx context.Context, jid string) error
	ProcessActivity(ctx context.Context, jid string, instanceID int64, actorIRI *url.URL, activity fedihelper.Activity) error
	ProcessConfigChanges(ctx context.Context, configChanges []*models.ConfigChange) error
	SendNotification(ctx context.Context, jid string, event models.EventType, metadata map[string]interface{}) error
	ValidateRequest(r *http.Request, actorURI *url.URL) (bool, *fedihelper.Actor)
}

type Metrics added in v0.6.0

type Metrics interface {
	MetricsGetAllDeliverErrorWeek(ctx context.Context, days int) (map[*models.Instance]MetricsDataPointsTime, error)
	MetricsGetAllDeliverSuccessWeek(ctx context.Context, days int) (map[*models.Instance]MetricsDataPointsTime, error)
	MetricsGetAllReceivedWeek(ctx context.Context, days int) (map[*models.Instance]MetricsDataPointsTime, error)
	MetricsGetDeliverErrorWeek(ctx context.Context, days int, instanceID int64) (MetricsDataPointsTime, error)
	MetricsGetDeliverSuccessWeek(ctx context.Context, days int, instanceID int64) (MetricsDataPointsTime, error)
	MetricsGetReceivedWeek(ctx context.Context, days int, instanceID int64) (MetricsDataPointsTime, error)
	MetricsGetReceivedTotalWeek(ctx context.Context, days int) (MetricsDataPointsTime, error)
	MetricsIncDeliverError(ctx context.Context, instanceID int64)
	MetricsIncDeliverSuccess(ctx context.Context, instanceID int64)
	MetricsIncReceived(ctx context.Context, instanceID int64)
}

type MetricsDataPointTime added in v0.4.0

type MetricsDataPointTime struct {
	X time.Time
	Y int
}

type MetricsDataPointsTime added in v0.4.0

type MetricsDataPointsTime []MetricsDataPointTime

type Scheduler added in v0.6.0

type Scheduler interface {
	GetSchedulerJobs() (jobs []SchedulerJob, err error)
}

type SchedulerJob added in v0.6.0

type SchedulerJob struct {
	Name    string
	Running bool
	LastRun time.Time
	NextRun time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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