service

package
v1.0.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServicePath               string
	ServiceIRI                *url.URL
	ServiceEndpointURL        *url.URL
	ActivityHandlerBufferSize int
	VerifyActorInSignature    bool

	// MaxWitnessDelay is the maximum delay that the witnessed transaction becomes included into the ledger.
	MaxWitnessDelay time.Duration

	IRICacheSize             int
	IRICacheExpiration       time.Duration
	OutboxSubscriberPoolSize int
	InboxSubscriberPoolSize  int
}

Config holds the configuration parameters for an ActivityPub service.

type PubSub

type PubSub interface {
	Subscribe(ctx context.Context, topic string) (<-chan *message.Message, error)
	SubscribeWithOpts(ctx context.Context, topic string, opts ...pubsub.Option) (<-chan *message.Message, error)
	Publish(topic string, messages ...*message.Message) error
	Close() error
}

PubSub defines the functions for a publisher/subscriber.

type Service

type Service struct {
	*lifecycle.Lifecycle
	// contains filtered or unexported fields
}

Service implements an ActivityPub service which has an inbox, outbox, and handlers for the various ActivityPub activities.

func New

func New(cfg *Config, activityStore store.Store, t httpTransport, sigVerifier signatureVerifier,
	pubSub PubSub, activityPubClient activityPubClient, resourceResolver resourceResolver,
	tm authTokenManager, m metricsProvider, handlerOpts ...spi.HandlerOpt,
) (*Service, error)

New returns a new ActivityPub service.

func (*Service) InboxHTTPHandler

func (s *Service) InboxHTTPHandler() common.HTTPHandler

InboxHTTPHandler returns the HTTP handler for the inbox which is invoked by the HTTP server. This handler must be registered with an HTTP server.

func (*Service) InboxHandler added in v1.0.0

func (s *Service) InboxHandler() spi.InboxHandler

InboxHandler returns the handler for inbox activities.

func (*Service) Outbox

func (s *Service) Outbox() spi.Outbox

Outbox returns the outbox, which allows clients to post activities.

func (*Service) Subscribe

func (s *Service) Subscribe() <-chan *vocab.ActivityType

Subscribe allows a client to receive published activities.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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