observer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnchorGraph

type AnchorGraph interface {
	Read(hl string) (*linkset.Linkset, error)
	GetDidAnchors(cid, suffix string) ([]graph.Anchor, error)
}

AnchorGraph interface to access anchors.

type Observer

type Observer struct {
	*Providers
	// contains filtered or unexported fields
}

Observer receives transactions over a channel and processes them by storing them to an operation store.

func New

func New(serviceIRI *url.URL, providers *Providers, opts ...Option) (*Observer, error)

New returns a new observer.

func (*Observer) Publisher

func (o *Observer) Publisher() Publisher

Publisher returns the publisher that adds anchors and DIDs to a message queue for processing.

func (*Observer) Start

func (o *Observer) Start()

Start starts observer routines.

func (*Observer) Stop

func (o *Observer) Stop()

Stop stops the observer.

type OperationFilter

type OperationFilter interface {
	Filter(uniqueSuffix string, ops []*operation.AnchoredOperation) ([]*operation.AnchoredOperation, error)
}

OperationFilter filters out operations before they are persisted.

type OperationStore

type OperationStore interface {
	Put(ops []*operation.AnchoredOperation) error
}

OperationStore interface to access operation store.

type Option

type Option func(opts *options)

Option is an option for observer.

func WithDiscoveryDomain

func WithDiscoveryDomain(domain string) Option

WithDiscoveryDomain sets optional discovery domain hint (used for did equivalent ids).

func WithProofMonitoringExpiryPeriod

func WithProofMonitoringExpiryPeriod(value time.Duration) Option

WithProofMonitoringExpiryPeriod sets expiry period for proof monitoring service.

func WithSubscriberPoolSize

func WithSubscriberPoolSize(value int) Option

WithSubscriberPoolSize sets the size of the message queue subscriber pool.

type Outbox

type Outbox interface {
	Post(activity *vocab.ActivityType, exclude ...*url.URL) (*url.URL, error)
}

Outbox defines an ActivityPub outbox.

type Providers

type Providers struct {
	ProtocolClientProvider protocol.ClientProvider
	AnchorGraph
	DidAnchors           didAnchors
	PubSub               pubSub
	Metrics              metricsProvider
	Outbox               outboxProvider
	HostMetaLinkResolver resourceResolver
	CASResolver          casResolver
	DocLoader            documentLoader
	Pkf                  verifiable.PublicKeyFetcher
	AnchorLinkStore      anchorLinkStore
	MonitoringSvc        monitoringSvc
	AnchorLinksetBuilder anchorLinksetBuilder
}

Providers contains all of the providers required by the observer.

type PubSub

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

PubSub implements a publisher/subscriber that publishes anchors and DIDs to a queue and processes anchors and DIDs published to the queue.

func NewPubSub

func NewPubSub(pubSub pubSub, anchorProcessor anchorProcessor, didProcessor didProcessor,
	poolSize int) (*PubSub, error)

NewPubSub returns a new publisher/subscriber.

func (*PubSub) PublishAnchor

func (h *PubSub) PublishAnchor(anchorInfo *anchorinfo.AnchorInfo) error

PublishAnchor publishes the anchor to the queue for processing.

func (*PubSub) PublishDID

func (h *PubSub) PublishDID(did string) error

PublishDID publishes the DID to the queue for processing.

type Publisher

type Publisher interface {
	PublishAnchor(anchor *anchorinfo.AnchorInfo) error
	PublishDID(did string) error
}

Publisher publishes anchors and DIDs to a message queue for processing.

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