Documentation ¶
Index ¶
- type Processor
- func (p *Processor) GetAPIAccount(ctx context.Context, requester *gtsmodel.Account, target *gtsmodel.Account) (apiAcc *apimodel.Account, errWithCode gtserror.WithCode)
- func (p *Processor) GetAPIAccountBlocked(ctx context.Context, targetAcc *gtsmodel.Account) (apiAcc *apimodel.Account, errWithCode gtserror.WithCode)
- func (p *Processor) GetAPIStatus(ctx context.Context, requester *gtsmodel.Account, target *gtsmodel.Status) (apiStatus *apimodel.Status, errWithCode gtserror.WithCode)
- func (p *Processor) GetTargetAccountBy(ctx context.Context, requester *gtsmodel.Account, ...) (account *gtsmodel.Account, visible bool, errWithCode gtserror.WithCode)
- func (p *Processor) GetTargetAccountByID(ctx context.Context, requester *gtsmodel.Account, targetID string) (account *gtsmodel.Account, visible bool, errWithCode gtserror.WithCode)
- func (p *Processor) GetTargetStatusBy(ctx context.Context, requester *gtsmodel.Account, ...) (status *gtsmodel.Status, visible bool, errWithCode gtserror.WithCode)
- func (p *Processor) GetTargetStatusByID(ctx context.Context, requester *gtsmodel.Account, targetID string) (status *gtsmodel.Status, visible bool, errWithCode gtserror.WithCode)
- func (p *Processor) GetVisibleAPIAccounts(ctx context.Context, requester *gtsmodel.Account, ...) []*apimodel.Account
- func (p *Processor) GetVisibleAPIAccountsPaged(ctx context.Context, requester *gtsmodel.Account, ...) []interface{}
- func (p *Processor) GetVisibleAPIStatuses(ctx context.Context, requester *gtsmodel.Account, ...) []*apimodel.Status
- func (p *Processor) GetVisibleAPIStatusesPaged(ctx context.Context, requester *gtsmodel.Account, ...) []interface{}
- func (p *Processor) GetVisibleTargetAccount(ctx context.Context, requester *gtsmodel.Account, targetID string) (account *gtsmodel.Account, errWithCode gtserror.WithCode)
- func (p *Processor) GetVisibleTargetStatus(ctx context.Context, requester *gtsmodel.Account, targetID string) (status *gtsmodel.Status, errWithCode gtserror.WithCode)
- func (p *Processor) InvalidateTimelinedStatus(ctx context.Context, accountID string, statusID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor provides a processor with logic common to multiple logical domains of the processing subsection of the codebase.
func New ¶
func New( state *state.State, converter *typeutils.Converter, federator federation.Federator, filter *visibility.Filter, ) Processor
New returns a new Processor instance.
func (*Processor) GetAPIAccount ¶
func (p *Processor) GetAPIAccount( ctx context.Context, requester *gtsmodel.Account, target *gtsmodel.Account, ) ( apiAcc *apimodel.Account, errWithCode gtserror.WithCode, )
GetAPIAccount fetches the appropriate API account model depending on whether requester = target.
func (*Processor) GetAPIAccountBlocked ¶
func (p *Processor) GetAPIAccountBlocked( ctx context.Context, targetAcc *gtsmodel.Account, ) ( apiAcc *apimodel.Account, errWithCode gtserror.WithCode, )
GetAPIAccountBlocked fetches the limited "blocked" account model for given target.
func (*Processor) GetAPIStatus ¶
func (p *Processor) GetAPIStatus( ctx context.Context, requester *gtsmodel.Account, target *gtsmodel.Status, ) ( apiStatus *apimodel.Status, errWithCode gtserror.WithCode, )
GetAPIStatus fetches the appropriate API status model for target.
func (*Processor) GetTargetAccountBy ¶
func (p *Processor) GetTargetAccountBy( ctx context.Context, requester *gtsmodel.Account, getTargetFromDB func() (*gtsmodel.Account, error), ) ( account *gtsmodel.Account, visible bool, errWithCode gtserror.WithCode, )
GetTargetAccountBy fetches the target account with db load function, given the authorized (or, nil) requester's account. This returns an approprate gtserror.WithCode accounting (ha) for not found and visibility to requester.
func (*Processor) GetTargetAccountByID ¶
func (p *Processor) GetTargetAccountByID( ctx context.Context, requester *gtsmodel.Account, targetID string, ) ( account *gtsmodel.Account, visible bool, errWithCode gtserror.WithCode, )
GetTargetAccountByID is a call-through to GetTargetAccountBy() using the db GetAccountByID() function.
func (*Processor) GetTargetStatusBy ¶
func (p *Processor) GetTargetStatusBy( ctx context.Context, requester *gtsmodel.Account, getTargetFromDB func() (*gtsmodel.Status, error), ) ( status *gtsmodel.Status, visible bool, errWithCode gtserror.WithCode, )
GetTargetStatusBy fetches the target status with db load function, given the authorized (or, nil) requester's account. This returns an approprate gtserror.WithCode accounting for not found and visibility to requester.
func (*Processor) GetTargetStatusByID ¶
func (p *Processor) GetTargetStatusByID( ctx context.Context, requester *gtsmodel.Account, targetID string, ) ( status *gtsmodel.Status, visible bool, errWithCode gtserror.WithCode, )
GetTargetStatusByID is a call-through to GetTargetStatus() using the db GetStatusByID() function.
func (*Processor) GetVisibleAPIAccounts ¶
func (p *Processor) GetVisibleAPIAccounts( ctx context.Context, requester *gtsmodel.Account, next func(int) *gtsmodel.Account, length int, ) []*apimodel.Account
GetVisibleAPIAccounts converts an array of gtsmodel.Accounts (inputted by next function) into public API model accounts, checking first for visibility. Please note that all errors will be logged at ERROR level, but will not be returned. Callers are likely to run into show-stopping errors in the lead-up to this function, whereas calling this should not be a show-stopper.
func (*Processor) GetVisibleAPIAccountsPaged ¶
func (p *Processor) GetVisibleAPIAccountsPaged( ctx context.Context, requester *gtsmodel.Account, next func(int) *gtsmodel.Account, length int, ) []interface{}
GetVisibleAPIAccountsPaged is functionally equivalent to GetVisibleAPIAccounts(), except the accounts are returned as a converted slice of accounts as interface{}.
func (*Processor) GetVisibleAPIStatuses ¶
func (p *Processor) GetVisibleAPIStatuses( ctx context.Context, requester *gtsmodel.Account, next func(int) *gtsmodel.Status, length int, ) []*apimodel.Status
GetVisibleAPIStatuses converts an array of gtsmodel.Status (inputted by next function) into API model statuses, checking first for visibility. Please note that all errors will be logged at ERROR level, but will not be returned. Callers are likely to run into show-stopping errors in the lead-up to this function, whereas calling this should not be a show-stopper.
func (*Processor) GetVisibleAPIStatusesPaged ¶
func (p *Processor) GetVisibleAPIStatusesPaged( ctx context.Context, requester *gtsmodel.Account, next func(int) *gtsmodel.Status, length int, ) []interface{}
GetVisibleAPIStatusesPaged is functionally equivalent to GetVisibleAPIStatuses(), except the statuses are returned as a converted slice of statuses as interface{}.
func (*Processor) GetVisibleTargetAccount ¶
func (p *Processor) GetVisibleTargetAccount( ctx context.Context, requester *gtsmodel.Account, targetID string, ) ( account *gtsmodel.Account, errWithCode gtserror.WithCode, )
GetVisibleTargetAccount calls GetTargetAccountByID(), but converts a non-visible result to not-found error.
func (*Processor) GetVisibleTargetStatus ¶
func (p *Processor) GetVisibleTargetStatus( ctx context.Context, requester *gtsmodel.Account, targetID string, ) ( status *gtsmodel.Status, errWithCode gtserror.WithCode, )
GetVisibleTargetStatus calls GetTargetStatusByID(), but converts a non-visible result to not-found error.
func (*Processor) InvalidateTimelinedStatus ¶
func (p *Processor) InvalidateTimelinedStatus(ctx context.Context, accountID string, statusID string) error
InvalidateTimelinedStatus is a shortcut function for invalidating the cached representation one status in the home timeline and all list timelines of the given accountID. It should only be called in cases where a status update does *not* need to be passed into the processor via the worker queue, since such invalidation will, in that case, be handled by the processor instead.