observer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 17 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(cid string) (*verifiable.Credential, 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(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 *Observer)

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).

type Providers

type Providers struct {
	ProtocolClientProvider protocol.ClientProvider
	AnchorGraph
	DidAnchors didAnchors
	PubSub     pubSub
}

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) (*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