topic

package
Version: v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package topic is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsumerServiceToProto

func ConsumerServiceToProto(cs ConsumerService) (*topicpb.ConsumerService, error)

ConsumerServiceToProto creates proto from a ConsumerService.

func ConsumptionTypeToProto

func ConsumptionTypeToProto(ct ConsumptionType) (topicpb.ConsumptionType, error)

ConsumptionTypeToProto creates proto from a ConsumptionType.

func NewServiceIDFromProto

func NewServiceIDFromProto(sid *topicpb.ServiceID) services.ServiceID

NewServiceIDFromProto creates service id from a proto.

func ServiceIDToProto

func ServiceIDToProto(sid services.ServiceID) *topicpb.ServiceID

ServiceIDToProto creates proto from a service id.

func ToProto

func ToProto(t Topic) (*topicpb.Topic, error)

ToProto creates proto from a topic.

Types

type ConsumerService

type ConsumerService interface {
	// ServiceID returns the service id of the consumer service.
	ServiceID() services.ServiceID

	// SetServiceID sets the service id of the consumer service.
	SetServiceID(value services.ServiceID) ConsumerService

	// ConsumptionType returns the consumption type of the consumer service.
	ConsumptionType() ConsumptionType

	// SetConsumptionType sets the consumption type of the consumer service.
	SetConsumptionType(value ConsumptionType) ConsumerService

	// MessageTTLNanos returns ttl for each message in nanoseconds.
	MessageTTLNanos() int64

	// SetMessageTTLNanos sets ttl for each message in nanoseconds.
	SetMessageTTLNanos(value int64) ConsumerService

	// String returns the string representation of the consumer service.
	String() string
}

ConsumerService is a service that consumes the messages in a topic.

func NewConsumerService

func NewConsumerService() ConsumerService

NewConsumerService creates a ConsumerService.

func NewConsumerServiceFromProto

func NewConsumerServiceFromProto(cs *topicpb.ConsumerService) (ConsumerService, error)

NewConsumerServiceFromProto creates a ConsumerService from a proto.

type ConsumptionType

type ConsumptionType string

ConsumptionType defines how the consumer consumes messages.

const (
	// Unknown is the unknown consumption type.
	Unknown ConsumptionType = "unknown"

	// Shared means the messages for each shard will be
	// shared by all the responsible instances.
	Shared ConsumptionType = "shared"

	// Replicated means the messages for each shard will be
	// replicated to all the responsible instances.
	Replicated ConsumptionType = "replicated"
)

func NewConsumptionType

func NewConsumptionType(str string) (ConsumptionType, error)

NewConsumptionType creates a consumption type from a string.

func NewConsumptionTypeFromProto

func NewConsumptionTypeFromProto(ct topicpb.ConsumptionType) (ConsumptionType, error)

NewConsumptionTypeFromProto creates ConsumptionType from a proto.

func (ConsumptionType) String

func (t ConsumptionType) String() string

type MockService

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

MockService is a mock of Service interface

func NewMockService

func NewMockService(ctrl *gomock.Controller) *MockService

NewMockService creates a new mock instance

func (*MockService) CheckAndSet

func (m *MockService) CheckAndSet(arg0 Topic, arg1 int) (Topic, error)

CheckAndSet mocks base method

func (*MockService) Delete

func (m *MockService) Delete(arg0 string) error

Delete mocks base method

func (*MockService) EXPECT

func (m *MockService) EXPECT() *MockServiceMockRecorder

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

func (*MockService) Get

func (m *MockService) Get(arg0 string) (Topic, error)

Get mocks base method

func (*MockService) Watch

func (m *MockService) Watch(arg0 string) (Watch, error)

Watch mocks base method

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService

func (*MockServiceMockRecorder) CheckAndSet

func (mr *MockServiceMockRecorder) CheckAndSet(arg0, arg1 interface{}) *gomock.Call

CheckAndSet indicates an expected call of CheckAndSet

func (*MockServiceMockRecorder) Delete

func (mr *MockServiceMockRecorder) Delete(arg0 interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockServiceMockRecorder) Get

func (mr *MockServiceMockRecorder) Get(arg0 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockServiceMockRecorder) Watch

func (mr *MockServiceMockRecorder) Watch(arg0 interface{}) *gomock.Call

Watch indicates an expected call of Watch

type Service

type Service interface {
	// Get returns the topic and version for the given name.
	Get(name string) (Topic, error)

	// CheckAndSet sets the topic for the name if the version matches.
	CheckAndSet(t Topic, version int) (Topic, error)

	// Delete deletes the topic with the name.
	Delete(name string) error

	// Watch returns a topic watch.
	Watch(name string) (Watch, error)
}

Service provides accessibility to topics.

func NewService

func NewService(sOpts ServiceOptions) (Service, error)

NewService creates a topic service.

type ServiceOptions

type ServiceOptions interface {
	// ConfigService returns the client of config service.
	ConfigService() client.Client

	// SetConfigService sets the client of config service.
	SetConfigService(c client.Client) ServiceOptions

	// KVOverrideOptions returns the override options for KV store.
	KVOverrideOptions() kv.OverrideOptions

	// SetKVOverrideOptions sets the override options for KV store.
	SetKVOverrideOptions(value kv.OverrideOptions) ServiceOptions
}

ServiceOptions configures the topic service.

func NewServiceOptions

func NewServiceOptions() ServiceOptions

NewServiceOptions returns new ServiceOptions.

type Topic

type Topic interface {
	// Name returns the name of the topic.
	Name() string

	// SetName sets the name of the topic.
	SetName(value string) Topic

	// NumberOfShards returns the total number of shards of the topic.
	NumberOfShards() uint32

	// SetNumberOfShards sets the total number of shards of the topic.
	SetNumberOfShards(value uint32) Topic

	// ConsumerServices returns the consumers of the topic.
	ConsumerServices() []ConsumerService

	// SetConsumerServices sets the consumers of the topic.
	SetConsumerServices(value []ConsumerService) Topic

	// Version returns the version of the topic.
	Version() int

	// SetVersion sets the version of the topic.
	SetVersion(value int) Topic

	// AddConsumerService adds a consumer to the topic.
	AddConsumerService(value ConsumerService) (Topic, error)

	// RemoveConsumerService removes a consumer from the topic.
	RemoveConsumerService(value services.ServiceID) (Topic, error)

	// UpdateConsumerService updates a consumer in the topic.
	UpdateConsumerService(value ConsumerService) (Topic, error)

	// String returns the string representation of the topic.
	String() string

	// Validate() validates the topic.
	Validate() error
}

Topic defines the topic of messages.

func NewTopic

func NewTopic() Topic

NewTopic creates a new topic.

func NewTopicFromProto

func NewTopicFromProto(t *topicpb.Topic) (Topic, error)

NewTopicFromProto creates a topic from a proto.

func NewTopicFromValue

func NewTopicFromValue(v kv.Value) (Topic, error)

NewTopicFromValue creates a topic from a kv.Value.

type Watch

type Watch interface {
	// C returns the notification channel.
	C() <-chan struct{}

	// Get returns the latest version of the topic.
	Get() (Topic, error)

	// Close stops watching for topic updates.
	Close()
}

Watch watches the updates of a topic.

func NewWatch

func NewWatch(w kv.ValueWatch) Watch

NewWatch creates a new topic watch.

Jump to

Keyboard shortcuts

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