util

package
v0.0.0-...-e28afbe Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// These loggers will only respect the logging flags while the call to
	// Run is executing. Otherwise, they log to os.Stdout and os.Stderr.
	InfoLogger *logger.Logger = logger.Init("apcore", false, false, os.Stdout)

	ErrorLogger *logger.Logger = logger.Init("apcore", false, false, os.Stderr)
)

Functions

func LogErrorTo

func LogErrorTo(system bool, w io.Writer)

func LogErrorToStderr

func LogErrorToStderr()

func LogInfoTo

func LogInfoTo(system bool, w io.Writer)

func LogInfoToStdout

func LogInfoToStdout()

func ToActivityStreamsFollow

func ToActivityStreamsFollow(c Context, t vocab.Type) (f vocab.ActivityStreamsFollow, err error)

Types

type Context

type Context struct {
	context.Context
}

func WithAPHTTPContext

func WithAPHTTPContext(scheme, host string, r *http.Request) Context

WithAPHTTPContext sets the CompleteRequestURL.

func WithUserAPHTTPContext

func WithUserAPHTTPContext(scheme, host string, r *http.Request, uuid paths.UUID, authdUserID string) Context

WithUserAPHTTPContext sets the UserPathUUID, ActorIRI, CompleteRequestURL, and PrivateScope.

func (Context) Activity

func (c Context) Activity() (t pub.Activity, err error)

Activity is available in federating contexts.

func (Context) ActivityStream

func (c Context) ActivityStream() (t vocab.Type, err error)

ActivityStream is available in social contexts.

func (Context) ActorIRI

func (c Context) ActorIRI() (s *url.URL, err error)

ActorIRI is used for ActivityPub HTTP contexts.

func (Context) CompleteRequestURL

func (c Context) CompleteRequestURL() (u *url.URL, err error)

CompleteRequestURL is used for ActivityPub HTTP contexts.

func (*Context) HasPrivateScope

func (c *Context) HasPrivateScope() bool

HasPrivateScope is available in all GET http requests.

func (Context) UserPathUUID

func (c Context) UserPathUUID() (s paths.UUID, err error)

UserPathUUID is used for ActivityPub HTTP contexts.

func (*Context) WithActivity

func (c *Context) WithActivity(t pub.Activity)

WithActivity is used for federating contexts.

func (*Context) WithActivityStream

func (c *Context) WithActivityStream(t vocab.Type)

WithActivityStream is used for social contexts.

func (*Context) WithActorIRI

func (c *Context) WithActorIRI(id *url.URL)

WithActorIRI is used for ActivityPub Inbox/Outbox contexts.

func (*Context) WithCompleteRequestURL

func (c *Context) WithCompleteRequestURL(r *http.Request, scheme, host string)

WithCompleteRequestURL is used for all ActivityPub HTTP contexts.

func (*Context) WithPrivateScope

func (c *Context) WithPrivateScope(b bool)

WithPrivateScope is available in all GET http requests.

func (*Context) WithUserPathUUID

func (c *Context) WithUserPathUUID(uuid paths.UUID)

WithUserID is used for ActivityPub Inbox/Outbox contexts.

type SafeStartStop

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

SafeStartStop guarantees at most one asynchronous function is being periodically run, no matter how many asynchronous calls to Start or Stop are being invoked.

There is no order to how the

func NewSafeStartStop

func NewSafeStartStop(fn func(context.Context), period time.Duration) *SafeStartStop

func (*SafeStartStop) Start

func (s *SafeStartStop) Start()

func (*SafeStartStop) Stop

func (s *SafeStartStop) Stop()

Jump to

Keyboard shortcuts

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