dereferencing

package
v0.7.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrNotRetrievable added in v0.7.0

func NewErrNotRetrievable(err error) error

Types

type Dereferencer

type Dereferencer interface {
	// GetAccountByURI will attempt to fetch an account by its URI, first checking the database and in the case of a remote account will either check the
	// last_fetched (and updating if beyond fetch interval) or dereferencing for the first-time if this remote account has never been encountered before.
	GetAccountByURI(ctx context.Context, requestUser string, uri *url.URL, block bool) (*gtsmodel.Account, error)

	// GetAccountByUsernameDomain will attempt to fetch an account by username@domain, first checking the database and in the case of a remote account will either
	// check the last_fetched (and updating if beyond fetch interval) or dereferencing for the first-time if this remote account has never been encountered before.
	GetAccountByUsernameDomain(ctx context.Context, requestUser string, username string, domain string, block bool) (*gtsmodel.Account, error)

	// UpdateAccount updates the given account if last_fetched is beyond fetch interval (or if force is set). An updated account model is returned, any media fetching is done async.
	UpdateAccount(ctx context.Context, requestUser string, account *gtsmodel.Account, force bool) (*gtsmodel.Account, error)

	GetStatus(ctx context.Context, username string, remoteStatusID *url.URL, refetch, includeParent bool) (*gtsmodel.Status, ap.Statusable, error)

	EnrichRemoteStatus(ctx context.Context, username string, status *gtsmodel.Status, includeParent bool) (*gtsmodel.Status, error)
	GetRemoteInstance(ctx context.Context, username string, remoteInstanceURI *url.URL) (*gtsmodel.Instance, error)
	DereferenceAnnounce(ctx context.Context, announce *gtsmodel.Status, requestingUsername string) error
	DereferenceThread(ctx context.Context, username string, statusIRI *url.URL, status *gtsmodel.Status, statusable ap.Statusable)

	GetRemoteMedia(ctx context.Context, requestingUsername string, accountID string, remoteURL string, ai *media.AdditionalMediaInfo) (*media.ProcessingMedia, error)
	GetRemoteEmoji(ctx context.Context, requestingUsername string, remoteURL string, shortcode string, domain string, id string, emojiURI string, ai *media.AdditionalEmojiInfo, refresh bool) (*media.ProcessingEmoji, error)

	Handshaking(username string, remoteAccountID *url.URL) bool
}

Dereferencer wraps logic and functionality for doing dereferencing of remote accounts, statuses, etc, from federated instances.

func NewDereferencer

func NewDereferencer(db db.DB, typeConverter typeutils.TypeConverter, transportController transport.Controller, mediaManager media.Manager) Dereferencer

NewDereferencer returns a Dereferencer initialized with the given parameters.

type ErrDB added in v0.6.0

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

ErrDB denotes that a proper error has occurred when doing a database call, as opposed to a simple db.ErrNoEntries.

func (*ErrDB) Error added in v0.6.0

func (err *ErrDB) Error() string

type ErrNotRetrievable added in v0.6.0

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

ErrNotRetrievable denotes that an item could not be dereferenced with the given parameters.

func (*ErrNotRetrievable) Error added in v0.6.0

func (err *ErrNotRetrievable) Error() string

type ErrOther added in v0.6.0

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

ErrOther denotes some other kind of weird error, perhaps from a malformed json or some other weird crapola.

func (*ErrOther) Error added in v0.6.0

func (err *ErrOther) Error() string

type ErrTransportError added in v0.6.0

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

ErrTransportError indicates that something unforeseen went wrong creating a transport, or while making an http call to a remote resource with a transport.

func (*ErrTransportError) Error added in v0.6.0

func (err *ErrTransportError) Error() string

type ErrWrongType added in v0.6.0

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

ErrWrongType indicates that an unexpected type was returned from a remote call; for example, we were served a Person when we were looking for a statusable.

func (*ErrWrongType) Error added in v0.6.0

func (err *ErrWrongType) Error() string

Jump to

Keyboard shortcuts

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