events

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package events is a generated GoMock package.

Package events is a generated GoMock package.

Index

Constants

View Source
const (
	// TransactionsStream is the stream name on which transactions are stored
	TransactionsStream = "TRANSACTIONS"
	// DataStream is the stream name on which the dat/payload is stored (VCs/DIDDocuments)
	DataStream = "DATA"
)
View Source
const PrivateTransactionsStream = "nuts-v2-private-transactions"

PrivateTransactionsStream defines the NATS stream name used for private transactions in the v2 protocol

View Source
const PrivateTransactionsSubject = "nuts.v2.private-transactions"

PrivateTransactionsSubject defines the NATS subject used for private transactions in the v2 protocol

Payload: dag.Transaction

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port       int    `koanf:"events.nats.port"`
	Timeout    int    `koanf:"events.nats.timeout"`
	Hostname   string `koanf:"events.nats.hostname"`
	StorageDir string `koanf:"events.nats.storagedir"`
}

Config holds all the configuration params

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns an instance of Config with the default values.

type Conn

type Conn interface {
	// Close closes the connection
	Close()

	// JetStream returns the JetStream connection
	JetStream(opts ...nats.JSOpt) (nats.JetStreamContext, error)
}

Conn defines the methods required in the NATS connection structure

type ConnectionPool

type ConnectionPool interface {
	// Acquire returns a NATS connection and JetStream context
	Acquire(ctx context.Context) (Conn, JetStreamContext, error)
	// Shutdown closes all the connections
	Shutdown()
}

ConnectionPool defines the interface for a NATS connection-pool

type Event

type Event interface {
	// GetStream returns a predefined stream with file storage.
	// It returns nil when a unknown stream was requested.
	GetStream(streamName string) Stream
	// Pool returns the NATS connection-pool
	Pool() ConnectionPool
}

Event is the event manager interface that gives access to all event related functions

func NewManager

func NewManager() Event

NewManager returns a new event manager

type JetStreamContext

type JetStreamContext interface {
	nats.JetStreamContext
}

JetStreamContext defines the interface for the JetStreamContext of the NATS connection

type MockConn

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

MockConn is a mock of Conn interface.

func NewMockConn

func NewMockConn(ctrl *gomock.Controller) *MockConn

NewMockConn creates a new mock instance.

func (*MockConn) Close

func (m *MockConn) Close()

Close mocks base method.

func (*MockConn) EXPECT

func (m *MockConn) EXPECT() *MockConnMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockConn) JetStream

func (m *MockConn) JetStream(opts ...nats_go.JSOpt) (nats_go.JetStreamContext, error)

JetStream mocks base method.

type MockConnMockRecorder

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

MockConnMockRecorder is the mock recorder for MockConn.

func (*MockConnMockRecorder) Close

func (mr *MockConnMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockConnMockRecorder) JetStream

func (mr *MockConnMockRecorder) JetStream(opts ...interface{}) *gomock.Call

JetStream indicates an expected call of JetStream.

type MockConnectionPool

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

MockConnectionPool is a mock of ConnectionPool interface.

func NewMockConnectionPool

func NewMockConnectionPool(ctrl *gomock.Controller) *MockConnectionPool

NewMockConnectionPool creates a new mock instance.

func (*MockConnectionPool) Acquire

Acquire mocks base method.

func (*MockConnectionPool) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockConnectionPool) Shutdown

func (m *MockConnectionPool) Shutdown()

Shutdown mocks base method.

type MockConnectionPoolMockRecorder

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

MockConnectionPoolMockRecorder is the mock recorder for MockConnectionPool.

func (*MockConnectionPoolMockRecorder) Acquire

func (mr *MockConnectionPoolMockRecorder) Acquire(ctx interface{}) *gomock.Call

Acquire indicates an expected call of Acquire.

func (*MockConnectionPoolMockRecorder) Shutdown

func (mr *MockConnectionPoolMockRecorder) Shutdown() *gomock.Call

Shutdown indicates an expected call of Shutdown.

type MockEvent

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

MockEvent is a mock of Event interface.

func NewMockEvent

func NewMockEvent(ctrl *gomock.Controller) *MockEvent

NewMockEvent creates a new mock instance.

func (*MockEvent) EXPECT

func (m *MockEvent) EXPECT() *MockEventMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEvent) GetStream

func (m *MockEvent) GetStream(streamName string) Stream

GetStream mocks base method.

func (*MockEvent) Pool

func (m *MockEvent) Pool() ConnectionPool

Pool mocks base method.

type MockEventMockRecorder

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

MockEventMockRecorder is the mock recorder for MockEvent.

func (*MockEventMockRecorder) GetStream

func (mr *MockEventMockRecorder) GetStream(streamName interface{}) *gomock.Call

GetStream indicates an expected call of GetStream.

func (*MockEventMockRecorder) Pool

func (mr *MockEventMockRecorder) Pool() *gomock.Call

Pool indicates an expected call of Pool.

type MockJetStreamContext

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

MockJetStreamContext is a mock of JetStreamContext interface.

func NewMockJetStreamContext

func NewMockJetStreamContext(ctrl *gomock.Controller) *MockJetStreamContext

NewMockJetStreamContext creates a new mock instance.

func (*MockJetStreamContext) AccountInfo

func (m *MockJetStreamContext) AccountInfo(opts ...nats_go.JSOpt) (*nats_go.AccountInfo, error)

AccountInfo mocks base method.

func (*MockJetStreamContext) AddConsumer

func (m *MockJetStreamContext) AddConsumer(stream string, cfg *nats_go.ConsumerConfig, opts ...nats_go.JSOpt) (*nats_go.ConsumerInfo, error)

AddConsumer mocks base method.

func (*MockJetStreamContext) AddStream

AddStream mocks base method.

func (*MockJetStreamContext) ChanQueueSubscribe

func (m *MockJetStreamContext) ChanQueueSubscribe(subj, queue string, ch chan *nats_go.Msg, opts ...nats_go.SubOpt) (*nats_go.Subscription, error)

ChanQueueSubscribe mocks base method.

func (*MockJetStreamContext) ChanSubscribe

func (m *MockJetStreamContext) ChanSubscribe(subj string, ch chan *nats_go.Msg, opts ...nats_go.SubOpt) (*nats_go.Subscription, error)

ChanSubscribe mocks base method.

func (*MockJetStreamContext) ConsumerInfo

func (m *MockJetStreamContext) ConsumerInfo(stream, name string, opts ...nats_go.JSOpt) (*nats_go.ConsumerInfo, error)

ConsumerInfo mocks base method.

func (*MockJetStreamContext) ConsumerNames

func (m *MockJetStreamContext) ConsumerNames(stream string, opts ...nats_go.JSOpt) <-chan string

ConsumerNames mocks base method.

func (*MockJetStreamContext) ConsumersInfo

func (m *MockJetStreamContext) ConsumersInfo(stream string, opts ...nats_go.JSOpt) <-chan *nats_go.ConsumerInfo

ConsumersInfo mocks base method.

func (*MockJetStreamContext) CreateKeyValue

func (m *MockJetStreamContext) CreateKeyValue(cfg *nats_go.KeyValueConfig) (nats_go.KeyValue, error)

CreateKeyValue mocks base method.

func (*MockJetStreamContext) CreateObjectStore

CreateObjectStore mocks base method.

func (*MockJetStreamContext) DeleteConsumer

func (m *MockJetStreamContext) DeleteConsumer(stream, consumer string, opts ...nats_go.JSOpt) error

DeleteConsumer mocks base method.

func (*MockJetStreamContext) DeleteKeyValue

func (m *MockJetStreamContext) DeleteKeyValue(bucket string) error

DeleteKeyValue mocks base method.

func (*MockJetStreamContext) DeleteMsg

func (m *MockJetStreamContext) DeleteMsg(name string, seq uint64, opts ...nats_go.JSOpt) error

DeleteMsg mocks base method.

func (*MockJetStreamContext) DeleteObjectStore

func (m *MockJetStreamContext) DeleteObjectStore(bucket string) error

DeleteObjectStore mocks base method.

func (*MockJetStreamContext) DeleteStream

func (m *MockJetStreamContext) DeleteStream(name string, opts ...nats_go.JSOpt) error

DeleteStream mocks base method.

func (*MockJetStreamContext) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJetStreamContext) GetMsg

func (m *MockJetStreamContext) GetMsg(name string, seq uint64, opts ...nats_go.JSOpt) (*nats_go.RawStreamMsg, error)

GetMsg mocks base method.

func (*MockJetStreamContext) KeyValue

func (m *MockJetStreamContext) KeyValue(bucket string) (nats_go.KeyValue, error)

KeyValue mocks base method.

func (*MockJetStreamContext) ObjectStore

func (m *MockJetStreamContext) ObjectStore(bucket string) (nats_go.ObjectStore, error)

ObjectStore mocks base method.

func (*MockJetStreamContext) Publish

func (m *MockJetStreamContext) Publish(subj string, data []byte, opts ...nats_go.PubOpt) (*nats_go.PubAck, error)

Publish mocks base method.

func (*MockJetStreamContext) PublishAsync

func (m *MockJetStreamContext) PublishAsync(subj string, data []byte, opts ...nats_go.PubOpt) (nats_go.PubAckFuture, error)

PublishAsync mocks base method.

func (*MockJetStreamContext) PublishAsyncComplete

func (m *MockJetStreamContext) PublishAsyncComplete() <-chan struct{}

PublishAsyncComplete mocks base method.

func (*MockJetStreamContext) PublishAsyncPending

func (m *MockJetStreamContext) PublishAsyncPending() int

PublishAsyncPending mocks base method.

func (*MockJetStreamContext) PublishMsg

func (m_2 *MockJetStreamContext) PublishMsg(m *nats_go.Msg, opts ...nats_go.PubOpt) (*nats_go.PubAck, error)

PublishMsg mocks base method.

func (*MockJetStreamContext) PublishMsgAsync

func (m_2 *MockJetStreamContext) PublishMsgAsync(m *nats_go.Msg, opts ...nats_go.PubOpt) (nats_go.PubAckFuture, error)

PublishMsgAsync mocks base method.

func (*MockJetStreamContext) PullSubscribe

func (m *MockJetStreamContext) PullSubscribe(subj, durable string, opts ...nats_go.SubOpt) (*nats_go.Subscription, error)

PullSubscribe mocks base method.

func (*MockJetStreamContext) PurgeStream

func (m *MockJetStreamContext) PurgeStream(name string, opts ...nats_go.JSOpt) error

PurgeStream mocks base method.

func (*MockJetStreamContext) QueueSubscribe

func (m *MockJetStreamContext) QueueSubscribe(subj, queue string, cb nats_go.MsgHandler, opts ...nats_go.SubOpt) (*nats_go.Subscription, error)

QueueSubscribe mocks base method.

func (*MockJetStreamContext) QueueSubscribeSync

func (m *MockJetStreamContext) QueueSubscribeSync(subj, queue string, opts ...nats_go.SubOpt) (*nats_go.Subscription, error)

QueueSubscribeSync mocks base method.

func (*MockJetStreamContext) StreamInfo

func (m *MockJetStreamContext) StreamInfo(stream string, opts ...nats_go.JSOpt) (*nats_go.StreamInfo, error)

StreamInfo mocks base method.

func (*MockJetStreamContext) StreamNames

func (m *MockJetStreamContext) StreamNames(opts ...nats_go.JSOpt) <-chan string

StreamNames mocks base method.

func (*MockJetStreamContext) StreamsInfo

func (m *MockJetStreamContext) StreamsInfo(opts ...nats_go.JSOpt) <-chan *nats_go.StreamInfo

StreamsInfo mocks base method.

func (*MockJetStreamContext) Subscribe

Subscribe mocks base method.

func (*MockJetStreamContext) SubscribeSync

func (m *MockJetStreamContext) SubscribeSync(subj string, opts ...nats_go.SubOpt) (*nats_go.Subscription, error)

SubscribeSync mocks base method.

func (*MockJetStreamContext) UpdateConsumer

func (m *MockJetStreamContext) UpdateConsumer(stream string, cfg *nats_go.ConsumerConfig, opts ...nats_go.JSOpt) (*nats_go.ConsumerInfo, error)

UpdateConsumer mocks base method.

func (*MockJetStreamContext) UpdateStream

func (m *MockJetStreamContext) UpdateStream(cfg *nats_go.StreamConfig, opts ...nats_go.JSOpt) (*nats_go.StreamInfo, error)

UpdateStream mocks base method.

type MockJetStreamContextMockRecorder

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

MockJetStreamContextMockRecorder is the mock recorder for MockJetStreamContext.

func (*MockJetStreamContextMockRecorder) AccountInfo

func (mr *MockJetStreamContextMockRecorder) AccountInfo(opts ...interface{}) *gomock.Call

AccountInfo indicates an expected call of AccountInfo.

func (*MockJetStreamContextMockRecorder) AddConsumer

func (mr *MockJetStreamContextMockRecorder) AddConsumer(stream, cfg interface{}, opts ...interface{}) *gomock.Call

AddConsumer indicates an expected call of AddConsumer.

func (*MockJetStreamContextMockRecorder) AddStream

func (mr *MockJetStreamContextMockRecorder) AddStream(cfg interface{}, opts ...interface{}) *gomock.Call

AddStream indicates an expected call of AddStream.

func (*MockJetStreamContextMockRecorder) ChanQueueSubscribe

func (mr *MockJetStreamContextMockRecorder) ChanQueueSubscribe(subj, queue, ch interface{}, opts ...interface{}) *gomock.Call

ChanQueueSubscribe indicates an expected call of ChanQueueSubscribe.

func (*MockJetStreamContextMockRecorder) ChanSubscribe

func (mr *MockJetStreamContextMockRecorder) ChanSubscribe(subj, ch interface{}, opts ...interface{}) *gomock.Call

ChanSubscribe indicates an expected call of ChanSubscribe.

func (*MockJetStreamContextMockRecorder) ConsumerInfo

func (mr *MockJetStreamContextMockRecorder) ConsumerInfo(stream, name interface{}, opts ...interface{}) *gomock.Call

ConsumerInfo indicates an expected call of ConsumerInfo.

func (*MockJetStreamContextMockRecorder) ConsumerNames

func (mr *MockJetStreamContextMockRecorder) ConsumerNames(stream interface{}, opts ...interface{}) *gomock.Call

ConsumerNames indicates an expected call of ConsumerNames.

func (*MockJetStreamContextMockRecorder) ConsumersInfo

func (mr *MockJetStreamContextMockRecorder) ConsumersInfo(stream interface{}, opts ...interface{}) *gomock.Call

ConsumersInfo indicates an expected call of ConsumersInfo.

func (*MockJetStreamContextMockRecorder) CreateKeyValue

func (mr *MockJetStreamContextMockRecorder) CreateKeyValue(cfg interface{}) *gomock.Call

CreateKeyValue indicates an expected call of CreateKeyValue.

func (*MockJetStreamContextMockRecorder) CreateObjectStore

func (mr *MockJetStreamContextMockRecorder) CreateObjectStore(cfg interface{}) *gomock.Call

CreateObjectStore indicates an expected call of CreateObjectStore.

func (*MockJetStreamContextMockRecorder) DeleteConsumer

func (mr *MockJetStreamContextMockRecorder) DeleteConsumer(stream, consumer interface{}, opts ...interface{}) *gomock.Call

DeleteConsumer indicates an expected call of DeleteConsumer.

func (*MockJetStreamContextMockRecorder) DeleteKeyValue

func (mr *MockJetStreamContextMockRecorder) DeleteKeyValue(bucket interface{}) *gomock.Call

DeleteKeyValue indicates an expected call of DeleteKeyValue.

func (*MockJetStreamContextMockRecorder) DeleteMsg

func (mr *MockJetStreamContextMockRecorder) DeleteMsg(name, seq interface{}, opts ...interface{}) *gomock.Call

DeleteMsg indicates an expected call of DeleteMsg.

func (*MockJetStreamContextMockRecorder) DeleteObjectStore

func (mr *MockJetStreamContextMockRecorder) DeleteObjectStore(bucket interface{}) *gomock.Call

DeleteObjectStore indicates an expected call of DeleteObjectStore.

func (*MockJetStreamContextMockRecorder) DeleteStream

func (mr *MockJetStreamContextMockRecorder) DeleteStream(name interface{}, opts ...interface{}) *gomock.Call

DeleteStream indicates an expected call of DeleteStream.

func (*MockJetStreamContextMockRecorder) GetMsg

func (mr *MockJetStreamContextMockRecorder) GetMsg(name, seq interface{}, opts ...interface{}) *gomock.Call

GetMsg indicates an expected call of GetMsg.

func (*MockJetStreamContextMockRecorder) KeyValue

func (mr *MockJetStreamContextMockRecorder) KeyValue(bucket interface{}) *gomock.Call

KeyValue indicates an expected call of KeyValue.

func (*MockJetStreamContextMockRecorder) ObjectStore

func (mr *MockJetStreamContextMockRecorder) ObjectStore(bucket interface{}) *gomock.Call

ObjectStore indicates an expected call of ObjectStore.

func (*MockJetStreamContextMockRecorder) Publish

func (mr *MockJetStreamContextMockRecorder) Publish(subj, data interface{}, opts ...interface{}) *gomock.Call

Publish indicates an expected call of Publish.

func (*MockJetStreamContextMockRecorder) PublishAsync

func (mr *MockJetStreamContextMockRecorder) PublishAsync(subj, data interface{}, opts ...interface{}) *gomock.Call

PublishAsync indicates an expected call of PublishAsync.

func (*MockJetStreamContextMockRecorder) PublishAsyncComplete

func (mr *MockJetStreamContextMockRecorder) PublishAsyncComplete() *gomock.Call

PublishAsyncComplete indicates an expected call of PublishAsyncComplete.

func (*MockJetStreamContextMockRecorder) PublishAsyncPending

func (mr *MockJetStreamContextMockRecorder) PublishAsyncPending() *gomock.Call

PublishAsyncPending indicates an expected call of PublishAsyncPending.

func (*MockJetStreamContextMockRecorder) PublishMsg

func (mr *MockJetStreamContextMockRecorder) PublishMsg(m interface{}, opts ...interface{}) *gomock.Call

PublishMsg indicates an expected call of PublishMsg.

func (*MockJetStreamContextMockRecorder) PublishMsgAsync

func (mr *MockJetStreamContextMockRecorder) PublishMsgAsync(m interface{}, opts ...interface{}) *gomock.Call

PublishMsgAsync indicates an expected call of PublishMsgAsync.

func (*MockJetStreamContextMockRecorder) PullSubscribe

func (mr *MockJetStreamContextMockRecorder) PullSubscribe(subj, durable interface{}, opts ...interface{}) *gomock.Call

PullSubscribe indicates an expected call of PullSubscribe.

func (*MockJetStreamContextMockRecorder) PurgeStream

func (mr *MockJetStreamContextMockRecorder) PurgeStream(name interface{}, opts ...interface{}) *gomock.Call

PurgeStream indicates an expected call of PurgeStream.

func (*MockJetStreamContextMockRecorder) QueueSubscribe

func (mr *MockJetStreamContextMockRecorder) QueueSubscribe(subj, queue, cb interface{}, opts ...interface{}) *gomock.Call

QueueSubscribe indicates an expected call of QueueSubscribe.

func (*MockJetStreamContextMockRecorder) QueueSubscribeSync

func (mr *MockJetStreamContextMockRecorder) QueueSubscribeSync(subj, queue interface{}, opts ...interface{}) *gomock.Call

QueueSubscribeSync indicates an expected call of QueueSubscribeSync.

func (*MockJetStreamContextMockRecorder) StreamInfo

func (mr *MockJetStreamContextMockRecorder) StreamInfo(stream interface{}, opts ...interface{}) *gomock.Call

StreamInfo indicates an expected call of StreamInfo.

func (*MockJetStreamContextMockRecorder) StreamNames

func (mr *MockJetStreamContextMockRecorder) StreamNames(opts ...interface{}) *gomock.Call

StreamNames indicates an expected call of StreamNames.

func (*MockJetStreamContextMockRecorder) StreamsInfo

func (mr *MockJetStreamContextMockRecorder) StreamsInfo(opts ...interface{}) *gomock.Call

StreamsInfo indicates an expected call of StreamsInfo.

func (*MockJetStreamContextMockRecorder) Subscribe

func (mr *MockJetStreamContextMockRecorder) Subscribe(subj, cb interface{}, opts ...interface{}) *gomock.Call

Subscribe indicates an expected call of Subscribe.

func (*MockJetStreamContextMockRecorder) SubscribeSync

func (mr *MockJetStreamContextMockRecorder) SubscribeSync(subj interface{}, opts ...interface{}) *gomock.Call

SubscribeSync indicates an expected call of SubscribeSync.

func (*MockJetStreamContextMockRecorder) UpdateConsumer

func (mr *MockJetStreamContextMockRecorder) UpdateConsumer(stream, cfg interface{}, opts ...interface{}) *gomock.Call

UpdateConsumer indicates an expected call of UpdateConsumer.

func (*MockJetStreamContextMockRecorder) UpdateStream

func (mr *MockJetStreamContextMockRecorder) UpdateStream(cfg interface{}, opts ...interface{}) *gomock.Call

UpdateStream indicates an expected call of UpdateStream.

type NATSConnectFunc

type NATSConnectFunc func(url string, options ...nats.Option) (Conn, error)

NATSConnectFunc defines the function signature for the NATS connection factory

type NATSConnectionPool

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

NATSConnectionPool implements a thread-safe pool of NATS connections (currently using a single NATS connection)

func NewNATSConnectionPool

func NewNATSConnectionPool(config Config) *NATSConnectionPool

NewNATSConnectionPool creates a new NATSConnectionPool

func (*NATSConnectionPool) Acquire

Acquire returns a NATS connection and JetStream context, it will connect if not already connected

func (*NATSConnectionPool) Shutdown

func (pool *NATSConnectionPool) Shutdown()

type Stream

type Stream interface {
	// Config returns the server configuration of the NATS stream
	Config() *nats.StreamConfig
	// ClientOpts returns the NATS client subscribe options
	ClientOpts() []nats.SubOpt
	// Subscribe to a stream on the NATS server
	// The consumerName is used as the durable config name.
	// The subjectFilter can be used to filter messages on the stream (eg: TRANSACTIONS.* or DATA.VerificableCredential)
	Subscribe(conn Conn, consumerName string, subjectFilter string, handler nats.MsgHandler) error
}

Stream contains configuration for a NATS stream both on the server and client side

func NewDisposableStream

func NewDisposableStream(name string, subjects []string, maxMessages int64) Stream

NewDisposableStream configures a stream with memory storage, discard old policy and a message limit retention policy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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