pubsubcontracts

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocking added in v0.92.0

type Blocking[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

func (Blocking[V]) Benchmark added in v0.92.0

func (c Blocking[V]) Benchmark(b *testing.B)

func (Blocking[V]) Spec added in v0.92.0

func (c Blocking[V]) Spec(s *testcase.Spec)

func (Blocking[V]) Test added in v0.92.0

func (c Blocking[V]) Test(t *testing.T)

type Broadcast added in v0.92.0

type Broadcast[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

Broadcast defines a publisher behaviour where each message is published to all registered subscription members.

func (Broadcast[V]) Benchmark added in v0.92.0

func (c Broadcast[V]) Benchmark(b *testing.B)

func (Broadcast[V]) Spec added in v0.92.0

func (c Broadcast[V]) Spec(s *testcase.Spec)

func (Broadcast[V]) Test added in v0.92.0

func (c Broadcast[V]) Test(t *testing.T)

type Buffered added in v0.92.0

type Buffered[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

Buffered defines a publisher behaviour where if the subscription is canceled, the publisher messages can be still consumed after resubscribing.

func (Buffered[V]) Benchmark added in v0.92.0

func (c Buffered[V]) Benchmark(b *testing.B)

func (Buffered[V]) Spec added in v0.92.0

func (c Buffered[V]) Spec(s *testcase.Spec)

func (Buffered[V]) Test added in v0.92.0

func (c Buffered[V]) Test(t *testing.T)

type CreatorPublisher

type CreatorPublisher[Entity, ID any] struct {
	MakeSubject func(testing.TB) CreatorPublisherSubject[Entity, ID]
	MakeContext func(testing.TB) context.Context
	MakeEntity  func(testing.TB) Entity
}

func (CreatorPublisher[Entity, ID]) Benchmark

func (c CreatorPublisher[Entity, ID]) Benchmark(b *testing.B)

func (CreatorPublisher[Entity, ID]) Spec

func (c CreatorPublisher[Entity, ID]) Spec(s *testcase.Spec)

func (CreatorPublisher[Entity, ID]) String

func (c CreatorPublisher[Entity, ID]) String() string

func (CreatorPublisher[Entity, ID]) Test

func (c CreatorPublisher[Entity, ID]) Test(t *testing.T)

type CreatorPublisherSubject

type CreatorPublisherSubject[Entity, ID any] interface {
	spechelper.CRD[Entity, ID]
	pubsub.CreatorPublisher[Entity]
}

type DeleterPublisher

type DeleterPublisher[Entity, ID any] struct {
	MakeSubject func(testing.TB) DeleterPublisherSubject[Entity, ID]
	MakeContext func(testing.TB) context.Context
	MakeEntity  func(testing.TB) Entity
}

func (DeleterPublisher[Entity, ID]) Benchmark

func (c DeleterPublisher[Entity, ID]) Benchmark(b *testing.B)

func (DeleterPublisher[Entity, ID]) HasDeleteEntity

func (c DeleterPublisher[Entity, ID]) HasDeleteEntity(tb testing.TB, getList func() []interface{}, e interface{})

func (DeleterPublisher[Entity, ID]) Spec

func (c DeleterPublisher[Entity, ID]) Spec(s *testcase.Spec)

func (DeleterPublisher[Entity, ID]) String

func (c DeleterPublisher[Entity, ID]) String() string

func (DeleterPublisher[Entity, ID]) Test

func (c DeleterPublisher[Entity, ID]) Test(t *testing.T)

type DeleterPublisherSubject

type DeleterPublisherSubject[Entity, ID any] interface {
	spechelper.CRD[Entity, ID]
	pubsub.DeleterPublisher[ID]
}

type FIFO added in v0.92.0

type FIFO[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

FIFO

It stands for First-In-First-Out approach. In this, the new element is inserted below the existing element, So that the oldest element can be at the top and taken out first. Therefore, the first element to be entered in this approach, gets out First. In computing, FIFO approach is used as an operating system algorithm, which gives every process CPU time in the order they arrive. The data structure that implements FIFO is Queue.

func (FIFO[V]) Benchmark added in v0.92.0

func (c FIFO[V]) Benchmark(b *testing.B)

func (FIFO[V]) Spec added in v0.92.0

func (c FIFO[V]) Spec(s *testcase.Spec)

func (FIFO[V]) Test added in v0.92.0

func (c FIFO[V]) Test(t *testing.T)

type LIFO added in v0.92.0

type LIFO[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

LIFO

It stands for Last-In-First-Out approach in programming. In this, the new element is inserted above the existing element, So that the newest element can be at the top and taken out first. Therefore, the first element to be entered in this approach, gets out Last. In computing, LIFO approach is used as a queuing theory that refers to the way items are stored in types of data structures. The data structure that implements LIFO is Stack.

func (LIFO[V]) Benchmark added in v0.92.0

func (c LIFO[V]) Benchmark(b *testing.B)

func (LIFO[V]) Spec added in v0.92.0

func (c LIFO[V]) Spec(s *testcase.Spec)

func (LIFO[V]) Test added in v0.92.0

func (c LIFO[V]) Test(t *testing.T)

type PubSub added in v0.92.0

type PubSub[V any] interface {
	pubsub.Publisher[V]
	pubsub.Subscriber[V]
	crud.Purger
}

type Publisher

type Publisher[Entity, ID any] struct {
	MakeSubject func(testing.TB) PublisherSubject[Entity, ID]
	MakeContext func(testing.TB) context.Context
	MakeEntity  func(testing.TB) Entity
}

func (Publisher[Entity, ID]) Benchmark

func (c Publisher[Entity, ID]) Benchmark(b *testing.B)

func (Publisher[Entity, ID]) Spec

func (c Publisher[Entity, ID]) Spec(s *testcase.Spec)

func (Publisher[Entity, ID]) String

func (c Publisher[Entity, ID]) String() string

func (Publisher[Entity, ID]) Test

func (c Publisher[Entity, ID]) Test(t *testing.T)

type PublisherSubject

type PublisherSubject[Entity, ID any] interface {
	spechelper.CRD[Entity, ID]
	pubsub.CreatorPublisher[Entity]
	pubsub.UpdaterPublisher[Entity]
	pubsub.DeleterPublisher[ID]
}

type Queue added in v0.92.0

type Queue[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

Queue defines a publisher behaviour where each message is only delivered to a single subscriber, and not to all registered subscribers. If a message is ack-ed, the message will be permanently removed from the Queue.

func (Queue[V]) Benchmark added in v0.92.0

func (c Queue[V]) Benchmark(b *testing.B)

func (Queue[V]) Spec added in v0.92.0

func (c Queue[V]) Spec(s *testcase.Spec)

func (Queue[V]) Test added in v0.92.0

func (c Queue[V]) Test(t *testing.T)

type UpdaterPublisher

type UpdaterPublisher[Entity, ID any] struct {
	MakeSubject func(testing.TB) UpdaterPublisherSubject[Entity, ID]
	MakeContext func(testing.TB) context.Context
	MakeEntity  func(testing.TB) Entity
}

func (UpdaterPublisher[Entity, ID]) Benchmark

func (c UpdaterPublisher[Entity, ID]) Benchmark(b *testing.B)

func (UpdaterPublisher[Entity, ID]) Spec

func (c UpdaterPublisher[Entity, ID]) Spec(s *testcase.Spec)

func (UpdaterPublisher[Entity, ID]) String

func (c UpdaterPublisher[Entity, ID]) String() string

func (UpdaterPublisher[Entity, ID]) Test

func (c UpdaterPublisher[Entity, ID]) Test(t *testing.T)

type UpdaterPublisherSubject

type UpdaterPublisherSubject[Entity, ID any] interface {
	spechelper.CRD[Entity, ID]
	crud.Updater[Entity]
	pubsub.UpdaterPublisher[Entity]
}

type Volatile added in v0.92.0

type Volatile[V any] struct {
	MakeSubject func(testing.TB) PubSub[V]
	MakeContext func(testing.TB) context.Context
	MakeV       func(testing.TB) V
}

Volatile defines a publisher behaviour where if the subscription is canceled, published messages won't be delivered. In certain scenarios, you may want to send a volatile message with no assurances over a publisher, when timely delivery is more important than losing messages.

func (Volatile[V]) Benchmark added in v0.92.0

func (c Volatile[V]) Benchmark(b *testing.B)

func (Volatile[V]) Spec added in v0.92.0

func (c Volatile[V]) Spec(s *testcase.Spec)

func (Volatile[V]) Test added in v0.92.0

func (c Volatile[V]) Test(t *testing.T)

Jump to

Keyboard shortcuts

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