observer

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 26 Imported by: 1

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 added in v0.1.2

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 added in v0.1.2

type Option func(opts *options)

Option is an option for observer.

func WithDiscoveryDomain added in v0.1.2

func WithDiscoveryDomain(domain string) Option

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

func WithSubscriberPoolSize added in v1.0.0

func WithSubscriberPoolSize(value int) Option

WithSubscriberPoolSize sets the size of the message queue subscriber pool.

type Outbox added in v0.1.3

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
	WebFingerResolver resourceResolver
	CASResolver       casResolver
	DocLoader         documentLoader
	Pkf               verifiable.PublicKeyFetcher
	AnchorLinkStore   anchorLinkStore
}

Providers contains all of the providers required by the TxnProcessor.

type PubSub added in v0.1.2

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 added in v0.1.2

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

NewPubSub returns a new publisher/subscriber.

func (*PubSub) PublishAnchor added in v0.1.2

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

PublishAnchor publishes the anchor to the queue for processing.

func (*PubSub) PublishDID added in v0.1.2

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

PublishDID publishes the DID to the queue for processing.

type Publisher added in v0.1.2

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

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

Jump to

Keyboard shortcuts

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