services

package
v0.15.17 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 19 Imported by: 57

Documentation

Overview

Package services is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advertisement interface {
	// the service being advertised.
	ServiceID() ServiceID

	// sets the service being advertised.
	SetServiceID(service ServiceID) Advertisement

	// optional health function, return an error to indicate unhealthy.
	Health() func() error

	// sets the health function for the advertised instance.
	SetHealth(health func() error) Advertisement

	// PlacementInstance returns the placement instance associated with this advertisement, which
	// contains the ID of the instance advertising and all other relevant fields.
	PlacementInstance() placement.Instance

	// SetPlacementInstance sets the Instance that is advertising.
	SetPlacementInstance(p placement.Instance) Advertisement
}

Advertisement advertises the availability of a given instance of a service.

func NewAdvertisement

func NewAdvertisement() Advertisement

NewAdvertisement creates a new Advertisement.

type CampaignOptions

type CampaignOptions interface {
	// LeaderValue allows the user to override the value a campaign announces
	// (that is, the value an observer sees upon calling Leader()). This
	// defaults to the hostname of the caller.
	LeaderValue() string
	SetLeaderValue(v string) CampaignOptions
}

CampaignOptions provide the ability to override campaign defaults.

func NewCampaignOptions

func NewCampaignOptions() (CampaignOptions, error)

NewCampaignOptions returns an empty CampaignOptions.

type Configuration

type Configuration struct {
	InitTimeout *time.Duration `yaml:"initTimeout"`
}

Configuration is the config for service options.

func (Configuration) NewOptions

func (cfg Configuration) NewOptions() Options

NewOptions creates an Option.

type ElectionConfiguration

type ElectionConfiguration struct {
	LeaderTimeout *time.Duration `yaml:"leaderTimeout"`
	ResignTimeout *time.Duration `yaml:"resignTimeout"`
	TTLSeconds    *int           `yaml:"TTLSeconds"`
}

ElectionConfiguration is for configuring election timeouts and TTLs

func (ElectionConfiguration) NewOptions

func (cfg ElectionConfiguration) NewOptions() ElectionOptions

NewOptions creates an ElectionOptions.

type ElectionOptions

type ElectionOptions interface {
	// Duration after which a call to Leader() will timeout if no response
	// returned from etcd. Defaults to 30 seconds.
	LeaderTimeout() time.Duration
	SetLeaderTimeout(t time.Duration) ElectionOptions

	// Duration after which a call to Resign() will timeout if no response
	// returned from etcd. Defaults to 30 seconds.
	ResignTimeout() time.Duration
	SetResignTimeout(t time.Duration) ElectionOptions

	// TTL returns the TTL used for campaigns. By default (ttl == 0), etcd will
	// set the TTL to 60s.
	TTLSecs() int
	SetTTLSecs(ttl int) ElectionOptions
}

ElectionOptions configure specific election-scoped options.

func NewElectionOptions

func NewElectionOptions() ElectionOptions

NewElectionOptions returns an empty ElectionOptions.

type HeartbeatGen

type HeartbeatGen func(sid ServiceID) (HeartbeatService, error)

HeartbeatGen generates a heartbeat store for a given zone.

type HeartbeatService

type HeartbeatService interface {
	// Heartbeat sends heartbeat for a service instance with a ttl.
	Heartbeat(instance placement.Instance, ttl time.Duration) error

	// Get gets healthy instances for a service.
	Get() ([]string, error)

	// GetInstances returns a deserialized list of healthy Instances.
	GetInstances() ([]placement.Instance, error)

	// Delete deletes the heartbeat for a service instance.
	Delete(instance string) error

	// Watch watches the heartbeats for a service.
	Watch() (xwatch.Watch, error)
}

HeartbeatService manages heartbeating instances.

type KVGen

type KVGen func(zone string) (kv.Store, error)

KVGen generates a kv store for a given zone.

type LeaderGen

type LeaderGen func(sid ServiceID, opts ElectionOptions) (LeaderService, error)

LeaderGen generates a leader service instance for a given service.

type LeaderService

type LeaderService interface {
	// Close closes the election service client entirely. No more campaigns can be
	// started and any outstanding campaigns are closed.
	Close() error

	// Campaign proposes that the caller become the leader for a specified
	// election, with its leadership being refreshed on an interval according to
	// the ElectionOptions the service was created with. It returns a read-only
	// channel of campaign status events that is closed when the user resigns
	// leadership or the campaign is invalidated due to background session
	// expiration (i.e. failing to refresh etcd leadership lease). The caller
	// MUST consume this channel until it is closed or risk goroutine leaks.
	// Users are encouraged to read the package docs of services/leader for
	// advice on proper usage and common gotchas.
	//
	// The leader will announce its hostname to observers unless opts is non-nil
	// and opts.LeaderValue() is non-empty.
	Campaign(electionID string, opts CampaignOptions) (<-chan campaign.Status, error)

	// Resign gives up leadership of a specified election if the caller is the
	// current leader (if the caller is not the leader an error is returned).
	Resign(electionID string) error

	// Leader returns the current leader of a specified election (if there is no
	// leader then leader.ErrNoLeader is returned).
	Leader(electionID string) (string, error)

	// Observe returns a channel on which leader updates for a specified election
	// will be returned. If no one is campaigning for the given election the call
	// will still succeed and the channel will receive its first update when an
	// election is started.
	Observe(electionID string) (<-chan string, error)
}

LeaderService provides access to etcd-backed leader elections.

type Metadata

type Metadata interface {
	// String returns a description of the metadata.
	String() string

	// Port returns the port to be used to contact the service.
	Port() uint32

	// SetPort sets the port.
	SetPort(p uint32) Metadata

	// LivenessInterval is the ttl interval for an instance to be considered as healthy.
	LivenessInterval() time.Duration

	// SetLivenessInterval sets the LivenessInterval.
	SetLivenessInterval(l time.Duration) Metadata

	// HeartbeatInterval is the interval for heatbeats.
	HeartbeatInterval() time.Duration

	// SetHeartbeatInterval sets the HeartbeatInterval.
	SetHeartbeatInterval(h time.Duration) Metadata

	// Proto returns the proto representation for the Metadata.
	Proto() (*metadatapb.Metadata, error)
}

Metadata contains the metadata for a service.

func NewMetadata

func NewMetadata() Metadata

NewMetadata creates new Metadata.

func NewMetadataFromProto

func NewMetadataFromProto(m *metadatapb.Metadata) (Metadata, error)

NewMetadataFromProto converts a Metadata proto message to an instance of Metadata.

type MockAdvertisement

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

MockAdvertisement is a mock of Advertisement interface

func NewMockAdvertisement

func NewMockAdvertisement(ctrl *gomock.Controller) *MockAdvertisement

NewMockAdvertisement creates a new mock instance

func (*MockAdvertisement) EXPECT

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

func (*MockAdvertisement) Health

func (m *MockAdvertisement) Health() func() error

Health mocks base method

func (*MockAdvertisement) PlacementInstance

func (m *MockAdvertisement) PlacementInstance() placement.Instance

PlacementInstance mocks base method

func (*MockAdvertisement) ServiceID

func (m *MockAdvertisement) ServiceID() ServiceID

ServiceID mocks base method

func (*MockAdvertisement) SetHealth

func (m *MockAdvertisement) SetHealth(health func() error) Advertisement

SetHealth mocks base method

func (*MockAdvertisement) SetPlacementInstance

func (m *MockAdvertisement) SetPlacementInstance(p placement.Instance) Advertisement

SetPlacementInstance mocks base method

func (*MockAdvertisement) SetServiceID

func (m *MockAdvertisement) SetServiceID(service ServiceID) Advertisement

SetServiceID mocks base method

type MockAdvertisementMockRecorder

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

MockAdvertisementMockRecorder is the mock recorder for MockAdvertisement

func (*MockAdvertisementMockRecorder) Health

Health indicates an expected call of Health

func (*MockAdvertisementMockRecorder) PlacementInstance

func (mr *MockAdvertisementMockRecorder) PlacementInstance() *gomock.Call

PlacementInstance indicates an expected call of PlacementInstance

func (*MockAdvertisementMockRecorder) ServiceID

func (mr *MockAdvertisementMockRecorder) ServiceID() *gomock.Call

ServiceID indicates an expected call of ServiceID

func (*MockAdvertisementMockRecorder) SetHealth

func (mr *MockAdvertisementMockRecorder) SetHealth(health interface{}) *gomock.Call

SetHealth indicates an expected call of SetHealth

func (*MockAdvertisementMockRecorder) SetPlacementInstance

func (mr *MockAdvertisementMockRecorder) SetPlacementInstance(p interface{}) *gomock.Call

SetPlacementInstance indicates an expected call of SetPlacementInstance

func (*MockAdvertisementMockRecorder) SetServiceID

func (mr *MockAdvertisementMockRecorder) SetServiceID(service interface{}) *gomock.Call

SetServiceID indicates an expected call of SetServiceID

type MockCampaignOptions

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

MockCampaignOptions is a mock of CampaignOptions interface

func NewMockCampaignOptions

func NewMockCampaignOptions(ctrl *gomock.Controller) *MockCampaignOptions

NewMockCampaignOptions creates a new mock instance

func (*MockCampaignOptions) EXPECT

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

func (*MockCampaignOptions) LeaderValue

func (m *MockCampaignOptions) LeaderValue() string

LeaderValue mocks base method

func (*MockCampaignOptions) SetLeaderValue

func (m *MockCampaignOptions) SetLeaderValue(v string) CampaignOptions

SetLeaderValue mocks base method

type MockCampaignOptionsMockRecorder

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

MockCampaignOptionsMockRecorder is the mock recorder for MockCampaignOptions

func (*MockCampaignOptionsMockRecorder) LeaderValue

func (mr *MockCampaignOptionsMockRecorder) LeaderValue() *gomock.Call

LeaderValue indicates an expected call of LeaderValue

func (*MockCampaignOptionsMockRecorder) SetLeaderValue

func (mr *MockCampaignOptionsMockRecorder) SetLeaderValue(v interface{}) *gomock.Call

SetLeaderValue indicates an expected call of SetLeaderValue

type MockElectionOptions

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

MockElectionOptions is a mock of ElectionOptions interface

func NewMockElectionOptions

func NewMockElectionOptions(ctrl *gomock.Controller) *MockElectionOptions

NewMockElectionOptions creates a new mock instance

func (*MockElectionOptions) EXPECT

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

func (*MockElectionOptions) LeaderTimeout

func (m *MockElectionOptions) LeaderTimeout() time.Duration

LeaderTimeout mocks base method

func (*MockElectionOptions) ResignTimeout

func (m *MockElectionOptions) ResignTimeout() time.Duration

ResignTimeout mocks base method

func (*MockElectionOptions) SetLeaderTimeout

func (m *MockElectionOptions) SetLeaderTimeout(t time.Duration) ElectionOptions

SetLeaderTimeout mocks base method

func (*MockElectionOptions) SetResignTimeout

func (m *MockElectionOptions) SetResignTimeout(t time.Duration) ElectionOptions

SetResignTimeout mocks base method

func (*MockElectionOptions) SetTTLSecs

func (m *MockElectionOptions) SetTTLSecs(ttl int) ElectionOptions

SetTTLSecs mocks base method

func (*MockElectionOptions) TTLSecs

func (m *MockElectionOptions) TTLSecs() int

TTLSecs mocks base method

type MockElectionOptionsMockRecorder

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

MockElectionOptionsMockRecorder is the mock recorder for MockElectionOptions

func (*MockElectionOptionsMockRecorder) LeaderTimeout

func (mr *MockElectionOptionsMockRecorder) LeaderTimeout() *gomock.Call

LeaderTimeout indicates an expected call of LeaderTimeout

func (*MockElectionOptionsMockRecorder) ResignTimeout

func (mr *MockElectionOptionsMockRecorder) ResignTimeout() *gomock.Call

ResignTimeout indicates an expected call of ResignTimeout

func (*MockElectionOptionsMockRecorder) SetLeaderTimeout

func (mr *MockElectionOptionsMockRecorder) SetLeaderTimeout(t interface{}) *gomock.Call

SetLeaderTimeout indicates an expected call of SetLeaderTimeout

func (*MockElectionOptionsMockRecorder) SetResignTimeout

func (mr *MockElectionOptionsMockRecorder) SetResignTimeout(t interface{}) *gomock.Call

SetResignTimeout indicates an expected call of SetResignTimeout

func (*MockElectionOptionsMockRecorder) SetTTLSecs

func (mr *MockElectionOptionsMockRecorder) SetTTLSecs(ttl interface{}) *gomock.Call

SetTTLSecs indicates an expected call of SetTTLSecs

func (*MockElectionOptionsMockRecorder) TTLSecs

TTLSecs indicates an expected call of TTLSecs

type MockHeartbeatService

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

MockHeartbeatService is a mock of HeartbeatService interface

func NewMockHeartbeatService

func NewMockHeartbeatService(ctrl *gomock.Controller) *MockHeartbeatService

NewMockHeartbeatService creates a new mock instance

func (*MockHeartbeatService) Delete

func (m *MockHeartbeatService) Delete(instance string) error

Delete mocks base method

func (*MockHeartbeatService) EXPECT

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

func (*MockHeartbeatService) Get

func (m *MockHeartbeatService) Get() ([]string, error)

Get mocks base method

func (*MockHeartbeatService) GetInstances

func (m *MockHeartbeatService) GetInstances() ([]placement.Instance, error)

GetInstances mocks base method

func (*MockHeartbeatService) Heartbeat

func (m *MockHeartbeatService) Heartbeat(instance placement.Instance, ttl time.Duration) error

Heartbeat mocks base method

func (*MockHeartbeatService) Watch

func (m *MockHeartbeatService) Watch() (watch.Watch, error)

Watch mocks base method

type MockHeartbeatServiceMockRecorder

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

MockHeartbeatServiceMockRecorder is the mock recorder for MockHeartbeatService

func (*MockHeartbeatServiceMockRecorder) Delete

func (mr *MockHeartbeatServiceMockRecorder) Delete(instance interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockHeartbeatServiceMockRecorder) Get

Get indicates an expected call of Get

func (*MockHeartbeatServiceMockRecorder) GetInstances

func (mr *MockHeartbeatServiceMockRecorder) GetInstances() *gomock.Call

GetInstances indicates an expected call of GetInstances

func (*MockHeartbeatServiceMockRecorder) Heartbeat

func (mr *MockHeartbeatServiceMockRecorder) Heartbeat(instance, ttl interface{}) *gomock.Call

Heartbeat indicates an expected call of Heartbeat

func (*MockHeartbeatServiceMockRecorder) Watch

Watch indicates an expected call of Watch

type MockLeaderService

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

MockLeaderService is a mock of LeaderService interface

func NewMockLeaderService

func NewMockLeaderService(ctrl *gomock.Controller) *MockLeaderService

NewMockLeaderService creates a new mock instance

func (*MockLeaderService) Campaign

func (m *MockLeaderService) Campaign(electionID string, opts CampaignOptions) (<-chan campaign.Status, error)

Campaign mocks base method

func (*MockLeaderService) Close

func (m *MockLeaderService) Close() error

Close mocks base method

func (*MockLeaderService) EXPECT

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

func (*MockLeaderService) Leader

func (m *MockLeaderService) Leader(electionID string) (string, error)

Leader mocks base method

func (*MockLeaderService) Observe

func (m *MockLeaderService) Observe(electionID string) (<-chan string, error)

Observe mocks base method

func (*MockLeaderService) Resign

func (m *MockLeaderService) Resign(electionID string) error

Resign mocks base method

type MockLeaderServiceMockRecorder

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

MockLeaderServiceMockRecorder is the mock recorder for MockLeaderService

func (*MockLeaderServiceMockRecorder) Campaign

func (mr *MockLeaderServiceMockRecorder) Campaign(electionID, opts interface{}) *gomock.Call

Campaign indicates an expected call of Campaign

func (*MockLeaderServiceMockRecorder) Close

Close indicates an expected call of Close

func (*MockLeaderServiceMockRecorder) Leader

func (mr *MockLeaderServiceMockRecorder) Leader(electionID interface{}) *gomock.Call

Leader indicates an expected call of Leader

func (*MockLeaderServiceMockRecorder) Observe

func (mr *MockLeaderServiceMockRecorder) Observe(electionID interface{}) *gomock.Call

Observe indicates an expected call of Observe

func (*MockLeaderServiceMockRecorder) Resign

func (mr *MockLeaderServiceMockRecorder) Resign(electionID interface{}) *gomock.Call

Resign indicates an expected call of Resign

type MockMetadata

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

MockMetadata is a mock of Metadata interface

func NewMockMetadata

func NewMockMetadata(ctrl *gomock.Controller) *MockMetadata

NewMockMetadata creates a new mock instance

func (*MockMetadata) EXPECT

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

func (*MockMetadata) HeartbeatInterval

func (m *MockMetadata) HeartbeatInterval() time.Duration

HeartbeatInterval mocks base method

func (*MockMetadata) LivenessInterval

func (m *MockMetadata) LivenessInterval() time.Duration

LivenessInterval mocks base method

func (*MockMetadata) Port

func (m *MockMetadata) Port() uint32

Port mocks base method

func (*MockMetadata) Proto

func (m *MockMetadata) Proto() (*metadatapb.Metadata, error)

Proto mocks base method

func (*MockMetadata) SetHeartbeatInterval

func (m *MockMetadata) SetHeartbeatInterval(h time.Duration) Metadata

SetHeartbeatInterval mocks base method

func (*MockMetadata) SetLivenessInterval

func (m *MockMetadata) SetLivenessInterval(l time.Duration) Metadata

SetLivenessInterval mocks base method

func (*MockMetadata) SetPort

func (m *MockMetadata) SetPort(p uint32) Metadata

SetPort mocks base method

func (*MockMetadata) String

func (m *MockMetadata) String() string

String mocks base method

type MockMetadataMockRecorder

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

MockMetadataMockRecorder is the mock recorder for MockMetadata

func (*MockMetadataMockRecorder) HeartbeatInterval

func (mr *MockMetadataMockRecorder) HeartbeatInterval() *gomock.Call

HeartbeatInterval indicates an expected call of HeartbeatInterval

func (*MockMetadataMockRecorder) LivenessInterval

func (mr *MockMetadataMockRecorder) LivenessInterval() *gomock.Call

LivenessInterval indicates an expected call of LivenessInterval

func (*MockMetadataMockRecorder) Port

func (mr *MockMetadataMockRecorder) Port() *gomock.Call

Port indicates an expected call of Port

func (*MockMetadataMockRecorder) Proto

func (mr *MockMetadataMockRecorder) Proto() *gomock.Call

Proto indicates an expected call of Proto

func (*MockMetadataMockRecorder) SetHeartbeatInterval

func (mr *MockMetadataMockRecorder) SetHeartbeatInterval(h interface{}) *gomock.Call

SetHeartbeatInterval indicates an expected call of SetHeartbeatInterval

func (*MockMetadataMockRecorder) SetLivenessInterval

func (mr *MockMetadataMockRecorder) SetLivenessInterval(l interface{}) *gomock.Call

SetLivenessInterval indicates an expected call of SetLivenessInterval

func (*MockMetadataMockRecorder) SetPort

func (mr *MockMetadataMockRecorder) SetPort(p interface{}) *gomock.Call

SetPort indicates an expected call of SetPort

func (*MockMetadataMockRecorder) String

func (mr *MockMetadataMockRecorder) String() *gomock.Call

String indicates an expected call of String

type MockNamespaceOptions

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

MockNamespaceOptions is a mock of NamespaceOptions interface

func NewMockNamespaceOptions

func NewMockNamespaceOptions(ctrl *gomock.Controller) *MockNamespaceOptions

NewMockNamespaceOptions creates a new mock instance

func (*MockNamespaceOptions) EXPECT

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

func (*MockNamespaceOptions) MetadataNamespace

func (m *MockNamespaceOptions) MetadataNamespace() string

MetadataNamespace mocks base method

func (*MockNamespaceOptions) PlacementNamespace

func (m *MockNamespaceOptions) PlacementNamespace() string

PlacementNamespace mocks base method

func (*MockNamespaceOptions) SetMetadataNamespace

func (m *MockNamespaceOptions) SetMetadataNamespace(v string) NamespaceOptions

SetMetadataNamespace mocks base method

func (*MockNamespaceOptions) SetPlacementNamespace

func (m *MockNamespaceOptions) SetPlacementNamespace(v string) NamespaceOptions

SetPlacementNamespace mocks base method

type MockNamespaceOptionsMockRecorder

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

MockNamespaceOptionsMockRecorder is the mock recorder for MockNamespaceOptions

func (*MockNamespaceOptionsMockRecorder) MetadataNamespace

func (mr *MockNamespaceOptionsMockRecorder) MetadataNamespace() *gomock.Call

MetadataNamespace indicates an expected call of MetadataNamespace

func (*MockNamespaceOptionsMockRecorder) PlacementNamespace

func (mr *MockNamespaceOptionsMockRecorder) PlacementNamespace() *gomock.Call

PlacementNamespace indicates an expected call of PlacementNamespace

func (*MockNamespaceOptionsMockRecorder) SetMetadataNamespace

func (mr *MockNamespaceOptionsMockRecorder) SetMetadataNamespace(v interface{}) *gomock.Call

SetMetadataNamespace indicates an expected call of SetMetadataNamespace

func (*MockNamespaceOptionsMockRecorder) SetPlacementNamespace

func (mr *MockNamespaceOptionsMockRecorder) SetPlacementNamespace(v interface{}) *gomock.Call

SetPlacementNamespace indicates an expected call of SetPlacementNamespace

type MockOptions

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

MockOptions is a mock of Options interface

func NewMockOptions

func NewMockOptions(ctrl *gomock.Controller) *MockOptions

NewMockOptions creates a new mock instance

func (*MockOptions) EXPECT

func (m *MockOptions) EXPECT() *MockOptionsMockRecorder

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

func (*MockOptions) HeartbeatGen

func (m *MockOptions) HeartbeatGen() HeartbeatGen

HeartbeatGen mocks base method

func (*MockOptions) InitTimeout

func (m *MockOptions) InitTimeout() time.Duration

InitTimeout mocks base method

func (*MockOptions) InstrumentsOptions

func (m *MockOptions) InstrumentsOptions() instrument.Options

InstrumentsOptions mocks base method

func (*MockOptions) KVGen

func (m *MockOptions) KVGen() KVGen

KVGen mocks base method

func (*MockOptions) LeaderGen

func (m *MockOptions) LeaderGen() LeaderGen

LeaderGen mocks base method

func (*MockOptions) NamespaceOptions

func (m *MockOptions) NamespaceOptions() NamespaceOptions

NamespaceOptions mocks base method

func (*MockOptions) SetHeartbeatGen

func (m *MockOptions) SetHeartbeatGen(gen HeartbeatGen) Options

SetHeartbeatGen mocks base method

func (*MockOptions) SetInitTimeout

func (m *MockOptions) SetInitTimeout(t time.Duration) Options

SetInitTimeout mocks base method

func (*MockOptions) SetInstrumentsOptions

func (m *MockOptions) SetInstrumentsOptions(iopts instrument.Options) Options

SetInstrumentsOptions mocks base method

func (*MockOptions) SetKVGen

func (m *MockOptions) SetKVGen(gen KVGen) Options

SetKVGen mocks base method

func (*MockOptions) SetLeaderGen

func (m *MockOptions) SetLeaderGen(gen LeaderGen) Options

SetLeaderGen mocks base method

func (*MockOptions) SetNamespaceOptions

func (m *MockOptions) SetNamespaceOptions(opts NamespaceOptions) Options

SetNamespaceOptions mocks base method

func (*MockOptions) Validate

func (m *MockOptions) Validate() error

Validate mocks base method

type MockOptionsMockRecorder

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

MockOptionsMockRecorder is the mock recorder for MockOptions

func (*MockOptionsMockRecorder) HeartbeatGen

func (mr *MockOptionsMockRecorder) HeartbeatGen() *gomock.Call

HeartbeatGen indicates an expected call of HeartbeatGen

func (*MockOptionsMockRecorder) InitTimeout

func (mr *MockOptionsMockRecorder) InitTimeout() *gomock.Call

InitTimeout indicates an expected call of InitTimeout

func (*MockOptionsMockRecorder) InstrumentsOptions

func (mr *MockOptionsMockRecorder) InstrumentsOptions() *gomock.Call

InstrumentsOptions indicates an expected call of InstrumentsOptions

func (*MockOptionsMockRecorder) KVGen

func (mr *MockOptionsMockRecorder) KVGen() *gomock.Call

KVGen indicates an expected call of KVGen

func (*MockOptionsMockRecorder) LeaderGen

func (mr *MockOptionsMockRecorder) LeaderGen() *gomock.Call

LeaderGen indicates an expected call of LeaderGen

func (*MockOptionsMockRecorder) NamespaceOptions

func (mr *MockOptionsMockRecorder) NamespaceOptions() *gomock.Call

NamespaceOptions indicates an expected call of NamespaceOptions

func (*MockOptionsMockRecorder) SetHeartbeatGen

func (mr *MockOptionsMockRecorder) SetHeartbeatGen(gen interface{}) *gomock.Call

SetHeartbeatGen indicates an expected call of SetHeartbeatGen

func (*MockOptionsMockRecorder) SetInitTimeout

func (mr *MockOptionsMockRecorder) SetInitTimeout(t interface{}) *gomock.Call

SetInitTimeout indicates an expected call of SetInitTimeout

func (*MockOptionsMockRecorder) SetInstrumentsOptions

func (mr *MockOptionsMockRecorder) SetInstrumentsOptions(iopts interface{}) *gomock.Call

SetInstrumentsOptions indicates an expected call of SetInstrumentsOptions

func (*MockOptionsMockRecorder) SetKVGen

func (mr *MockOptionsMockRecorder) SetKVGen(gen interface{}) *gomock.Call

SetKVGen indicates an expected call of SetKVGen

func (*MockOptionsMockRecorder) SetLeaderGen

func (mr *MockOptionsMockRecorder) SetLeaderGen(gen interface{}) *gomock.Call

SetLeaderGen indicates an expected call of SetLeaderGen

func (*MockOptionsMockRecorder) SetNamespaceOptions

func (mr *MockOptionsMockRecorder) SetNamespaceOptions(opts interface{}) *gomock.Call

SetNamespaceOptions indicates an expected call of SetNamespaceOptions

func (*MockOptionsMockRecorder) Validate

func (mr *MockOptionsMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate

type MockOverrideOptions

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

MockOverrideOptions is a mock of OverrideOptions interface

func NewMockOverrideOptions

func NewMockOverrideOptions(ctrl *gomock.Controller) *MockOverrideOptions

NewMockOverrideOptions creates a new mock instance

func (*MockOverrideOptions) EXPECT

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

func (*MockOverrideOptions) NamespaceOptions

func (m *MockOverrideOptions) NamespaceOptions() NamespaceOptions

NamespaceOptions mocks base method

func (*MockOverrideOptions) SetNamespaceOptions

func (m *MockOverrideOptions) SetNamespaceOptions(opts NamespaceOptions) OverrideOptions

SetNamespaceOptions mocks base method

type MockOverrideOptionsMockRecorder

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

MockOverrideOptionsMockRecorder is the mock recorder for MockOverrideOptions

func (*MockOverrideOptionsMockRecorder) NamespaceOptions

func (mr *MockOverrideOptionsMockRecorder) NamespaceOptions() *gomock.Call

NamespaceOptions indicates an expected call of NamespaceOptions

func (*MockOverrideOptionsMockRecorder) SetNamespaceOptions

func (mr *MockOverrideOptionsMockRecorder) SetNamespaceOptions(opts interface{}) *gomock.Call

SetNamespaceOptions indicates an expected call of SetNamespaceOptions

type MockQueryOptions

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

MockQueryOptions is a mock of QueryOptions interface

func NewMockQueryOptions

func NewMockQueryOptions(ctrl *gomock.Controller) *MockQueryOptions

NewMockQueryOptions creates a new mock instance

func (*MockQueryOptions) EXPECT

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

func (*MockQueryOptions) IncludeUnhealthy

func (m *MockQueryOptions) IncludeUnhealthy() bool

IncludeUnhealthy mocks base method

func (*MockQueryOptions) SetIncludeUnhealthy

func (m *MockQueryOptions) SetIncludeUnhealthy(h bool) QueryOptions

SetIncludeUnhealthy mocks base method

type MockQueryOptionsMockRecorder

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

MockQueryOptionsMockRecorder is the mock recorder for MockQueryOptions

func (*MockQueryOptionsMockRecorder) IncludeUnhealthy

func (mr *MockQueryOptionsMockRecorder) IncludeUnhealthy() *gomock.Call

IncludeUnhealthy indicates an expected call of IncludeUnhealthy

func (*MockQueryOptionsMockRecorder) SetIncludeUnhealthy

func (mr *MockQueryOptionsMockRecorder) SetIncludeUnhealthy(h interface{}) *gomock.Call

SetIncludeUnhealthy indicates an expected call of SetIncludeUnhealthy

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

func (m *MockService) EXPECT() *MockServiceMockRecorder

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

func (*MockService) Instance

func (m *MockService) Instance(instanceID string) (ServiceInstance, error)

Instance mocks base method

func (*MockService) Instances

func (m *MockService) Instances() []ServiceInstance

Instances mocks base method

func (*MockService) Replication

func (m *MockService) Replication() ServiceReplication

Replication mocks base method

func (*MockService) SetInstances

func (m *MockService) SetInstances(insts []ServiceInstance) Service

SetInstances mocks base method

func (*MockService) SetReplication

func (m *MockService) SetReplication(r ServiceReplication) Service

SetReplication mocks base method

func (*MockService) SetSharding

func (m *MockService) SetSharding(s ServiceSharding) Service

SetSharding mocks base method

func (*MockService) Sharding

func (m *MockService) Sharding() ServiceSharding

Sharding mocks base method

type MockServiceID

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

MockServiceID is a mock of ServiceID interface

func NewMockServiceID

func NewMockServiceID(ctrl *gomock.Controller) *MockServiceID

NewMockServiceID creates a new mock instance

func (*MockServiceID) EXPECT

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

func (*MockServiceID) Environment

func (m *MockServiceID) Environment() string

Environment mocks base method

func (*MockServiceID) Equal

func (m *MockServiceID) Equal(value ServiceID) bool

Equal mocks base method

func (*MockServiceID) Name

func (m *MockServiceID) Name() string

Name mocks base method

func (*MockServiceID) SetEnvironment

func (m *MockServiceID) SetEnvironment(env string) ServiceID

SetEnvironment mocks base method

func (*MockServiceID) SetName

func (m *MockServiceID) SetName(s string) ServiceID

SetName mocks base method

func (*MockServiceID) SetZone

func (m *MockServiceID) SetZone(zone string) ServiceID

SetZone mocks base method

func (*MockServiceID) String

func (m *MockServiceID) String() string

String mocks base method

func (*MockServiceID) Zone

func (m *MockServiceID) Zone() string

Zone mocks base method

type MockServiceIDMockRecorder

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

MockServiceIDMockRecorder is the mock recorder for MockServiceID

func (*MockServiceIDMockRecorder) Environment

func (mr *MockServiceIDMockRecorder) Environment() *gomock.Call

Environment indicates an expected call of Environment

func (*MockServiceIDMockRecorder) Equal

func (mr *MockServiceIDMockRecorder) Equal(value interface{}) *gomock.Call

Equal indicates an expected call of Equal

func (*MockServiceIDMockRecorder) Name

Name indicates an expected call of Name

func (*MockServiceIDMockRecorder) SetEnvironment

func (mr *MockServiceIDMockRecorder) SetEnvironment(env interface{}) *gomock.Call

SetEnvironment indicates an expected call of SetEnvironment

func (*MockServiceIDMockRecorder) SetName

func (mr *MockServiceIDMockRecorder) SetName(s interface{}) *gomock.Call

SetName indicates an expected call of SetName

func (*MockServiceIDMockRecorder) SetZone

func (mr *MockServiceIDMockRecorder) SetZone(zone interface{}) *gomock.Call

SetZone indicates an expected call of SetZone

func (*MockServiceIDMockRecorder) String

func (mr *MockServiceIDMockRecorder) String() *gomock.Call

String indicates an expected call of String

func (*MockServiceIDMockRecorder) Zone

Zone indicates an expected call of Zone

type MockServiceInstance

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

MockServiceInstance is a mock of ServiceInstance interface

func NewMockServiceInstance

func NewMockServiceInstance(ctrl *gomock.Controller) *MockServiceInstance

NewMockServiceInstance creates a new mock instance

func (*MockServiceInstance) EXPECT

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

func (*MockServiceInstance) Endpoint

func (m *MockServiceInstance) Endpoint() string

Endpoint mocks base method

func (*MockServiceInstance) InstanceID

func (m *MockServiceInstance) InstanceID() string

InstanceID mocks base method

func (*MockServiceInstance) ServiceID

func (m *MockServiceInstance) ServiceID() ServiceID

ServiceID mocks base method

func (*MockServiceInstance) SetEndpoint

func (m *MockServiceInstance) SetEndpoint(e string) ServiceInstance

SetEndpoint mocks base method

func (*MockServiceInstance) SetInstanceID

func (m *MockServiceInstance) SetInstanceID(id string) ServiceInstance

SetInstanceID mocks base method

func (*MockServiceInstance) SetServiceID

func (m *MockServiceInstance) SetServiceID(service ServiceID) ServiceInstance

SetServiceID mocks base method

func (*MockServiceInstance) SetShards

SetShards mocks base method

func (*MockServiceInstance) Shards

func (m *MockServiceInstance) Shards() shard.Shards

Shards mocks base method

type MockServiceInstanceMockRecorder

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

MockServiceInstanceMockRecorder is the mock recorder for MockServiceInstance

func (*MockServiceInstanceMockRecorder) Endpoint

Endpoint indicates an expected call of Endpoint

func (*MockServiceInstanceMockRecorder) InstanceID

func (mr *MockServiceInstanceMockRecorder) InstanceID() *gomock.Call

InstanceID indicates an expected call of InstanceID

func (*MockServiceInstanceMockRecorder) ServiceID

func (mr *MockServiceInstanceMockRecorder) ServiceID() *gomock.Call

ServiceID indicates an expected call of ServiceID

func (*MockServiceInstanceMockRecorder) SetEndpoint

func (mr *MockServiceInstanceMockRecorder) SetEndpoint(e interface{}) *gomock.Call

SetEndpoint indicates an expected call of SetEndpoint

func (*MockServiceInstanceMockRecorder) SetInstanceID

func (mr *MockServiceInstanceMockRecorder) SetInstanceID(id interface{}) *gomock.Call

SetInstanceID indicates an expected call of SetInstanceID

func (*MockServiceInstanceMockRecorder) SetServiceID

func (mr *MockServiceInstanceMockRecorder) SetServiceID(service interface{}) *gomock.Call

SetServiceID indicates an expected call of SetServiceID

func (*MockServiceInstanceMockRecorder) SetShards

func (mr *MockServiceInstanceMockRecorder) SetShards(s interface{}) *gomock.Call

SetShards indicates an expected call of SetShards

func (*MockServiceInstanceMockRecorder) Shards

Shards indicates an expected call of Shards

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService

func (*MockServiceMockRecorder) Instance

func (mr *MockServiceMockRecorder) Instance(instanceID interface{}) *gomock.Call

Instance indicates an expected call of Instance

func (*MockServiceMockRecorder) Instances

func (mr *MockServiceMockRecorder) Instances() *gomock.Call

Instances indicates an expected call of Instances

func (*MockServiceMockRecorder) Replication

func (mr *MockServiceMockRecorder) Replication() *gomock.Call

Replication indicates an expected call of Replication

func (*MockServiceMockRecorder) SetInstances

func (mr *MockServiceMockRecorder) SetInstances(insts interface{}) *gomock.Call

SetInstances indicates an expected call of SetInstances

func (*MockServiceMockRecorder) SetReplication

func (mr *MockServiceMockRecorder) SetReplication(r interface{}) *gomock.Call

SetReplication indicates an expected call of SetReplication

func (*MockServiceMockRecorder) SetSharding

func (mr *MockServiceMockRecorder) SetSharding(s interface{}) *gomock.Call

SetSharding indicates an expected call of SetSharding

func (*MockServiceMockRecorder) Sharding

func (mr *MockServiceMockRecorder) Sharding() *gomock.Call

Sharding indicates an expected call of Sharding

type MockServiceReplication

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

MockServiceReplication is a mock of ServiceReplication interface

func NewMockServiceReplication

func NewMockServiceReplication(ctrl *gomock.Controller) *MockServiceReplication

NewMockServiceReplication creates a new mock instance

func (*MockServiceReplication) EXPECT

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

func (*MockServiceReplication) Replicas

func (m *MockServiceReplication) Replicas() int

Replicas mocks base method

func (*MockServiceReplication) SetReplicas

func (m *MockServiceReplication) SetReplicas(r int) ServiceReplication

SetReplicas mocks base method

type MockServiceReplicationMockRecorder

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

MockServiceReplicationMockRecorder is the mock recorder for MockServiceReplication

func (*MockServiceReplicationMockRecorder) Replicas

Replicas indicates an expected call of Replicas

func (*MockServiceReplicationMockRecorder) SetReplicas

func (mr *MockServiceReplicationMockRecorder) SetReplicas(r interface{}) *gomock.Call

SetReplicas indicates an expected call of SetReplicas

type MockServiceSharding

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

MockServiceSharding is a mock of ServiceSharding interface

func NewMockServiceSharding

func NewMockServiceSharding(ctrl *gomock.Controller) *MockServiceSharding

NewMockServiceSharding creates a new mock instance

func (*MockServiceSharding) EXPECT

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

func (*MockServiceSharding) IsSharded

func (m *MockServiceSharding) IsSharded() bool

IsSharded mocks base method

func (*MockServiceSharding) NumShards

func (m *MockServiceSharding) NumShards() int

NumShards mocks base method

func (*MockServiceSharding) SetIsSharded

func (m *MockServiceSharding) SetIsSharded(s bool) ServiceSharding

SetIsSharded mocks base method

func (*MockServiceSharding) SetNumShards

func (m *MockServiceSharding) SetNumShards(n int) ServiceSharding

SetNumShards mocks base method

type MockServiceShardingMockRecorder

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

MockServiceShardingMockRecorder is the mock recorder for MockServiceSharding

func (*MockServiceShardingMockRecorder) IsSharded

func (mr *MockServiceShardingMockRecorder) IsSharded() *gomock.Call

IsSharded indicates an expected call of IsSharded

func (*MockServiceShardingMockRecorder) NumShards

func (mr *MockServiceShardingMockRecorder) NumShards() *gomock.Call

NumShards indicates an expected call of NumShards

func (*MockServiceShardingMockRecorder) SetIsSharded

func (mr *MockServiceShardingMockRecorder) SetIsSharded(s interface{}) *gomock.Call

SetIsSharded indicates an expected call of SetIsSharded

func (*MockServiceShardingMockRecorder) SetNumShards

func (mr *MockServiceShardingMockRecorder) SetNumShards(n interface{}) *gomock.Call

SetNumShards indicates an expected call of SetNumShards

type MockServices

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

MockServices is a mock of Services interface

func NewMockServices

func NewMockServices(ctrl *gomock.Controller) *MockServices

NewMockServices creates a new mock instance

func (*MockServices) Advertise

func (m *MockServices) Advertise(ad Advertisement) error

Advertise mocks base method

func (*MockServices) DeleteMetadata added in v0.8.0

func (m *MockServices) DeleteMetadata(sid ServiceID) error

DeleteMetadata mocks base method

func (*MockServices) EXPECT

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

func (*MockServices) HeartbeatService

func (m *MockServices) HeartbeatService(service ServiceID) (HeartbeatService, error)

HeartbeatService mocks base method

func (*MockServices) LeaderService

func (m *MockServices) LeaderService(service ServiceID, opts ElectionOptions) (LeaderService, error)

LeaderService mocks base method

func (*MockServices) Metadata

func (m *MockServices) Metadata(sid ServiceID) (Metadata, error)

Metadata mocks base method

func (*MockServices) PlacementService

func (m *MockServices) PlacementService(sid ServiceID, popts placement.Options) (placement.Service, error)

PlacementService mocks base method

func (*MockServices) Query

func (m *MockServices) Query(service ServiceID, opts QueryOptions) (Service, error)

Query mocks base method

func (*MockServices) SetMetadata

func (m_2 *MockServices) SetMetadata(sid ServiceID, m Metadata) error

SetMetadata mocks base method

func (*MockServices) Unadvertise

func (m *MockServices) Unadvertise(service ServiceID, id string) error

Unadvertise mocks base method

func (*MockServices) Watch

func (m *MockServices) Watch(service ServiceID, opts QueryOptions) (Watch, error)

Watch mocks base method

type MockServicesMockRecorder

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

MockServicesMockRecorder is the mock recorder for MockServices

func (*MockServicesMockRecorder) Advertise

func (mr *MockServicesMockRecorder) Advertise(ad interface{}) *gomock.Call

Advertise indicates an expected call of Advertise

func (*MockServicesMockRecorder) DeleteMetadata added in v0.8.0

func (mr *MockServicesMockRecorder) DeleteMetadata(sid interface{}) *gomock.Call

DeleteMetadata indicates an expected call of DeleteMetadata

func (*MockServicesMockRecorder) HeartbeatService

func (mr *MockServicesMockRecorder) HeartbeatService(service interface{}) *gomock.Call

HeartbeatService indicates an expected call of HeartbeatService

func (*MockServicesMockRecorder) LeaderService

func (mr *MockServicesMockRecorder) LeaderService(service, opts interface{}) *gomock.Call

LeaderService indicates an expected call of LeaderService

func (*MockServicesMockRecorder) Metadata

func (mr *MockServicesMockRecorder) Metadata(sid interface{}) *gomock.Call

Metadata indicates an expected call of Metadata

func (*MockServicesMockRecorder) PlacementService

func (mr *MockServicesMockRecorder) PlacementService(sid, popts interface{}) *gomock.Call

PlacementService indicates an expected call of PlacementService

func (*MockServicesMockRecorder) Query

func (mr *MockServicesMockRecorder) Query(service, opts interface{}) *gomock.Call

Query indicates an expected call of Query

func (*MockServicesMockRecorder) SetMetadata

func (mr *MockServicesMockRecorder) SetMetadata(sid, m interface{}) *gomock.Call

SetMetadata indicates an expected call of SetMetadata

func (*MockServicesMockRecorder) Unadvertise

func (mr *MockServicesMockRecorder) Unadvertise(service, id interface{}) *gomock.Call

Unadvertise indicates an expected call of Unadvertise

func (*MockServicesMockRecorder) Watch

func (mr *MockServicesMockRecorder) Watch(service, opts interface{}) *gomock.Call

Watch indicates an expected call of Watch

type MockWatch

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

MockWatch is a mock of Watch interface

func NewMockWatch

func NewMockWatch(ctrl *gomock.Controller) *MockWatch

NewMockWatch creates a new mock instance

func (*MockWatch) C

func (m *MockWatch) C() <-chan struct{}

C mocks base method

func (*MockWatch) Close

func (m *MockWatch) Close()

Close mocks base method

func (*MockWatch) EXPECT

func (m *MockWatch) EXPECT() *MockWatchMockRecorder

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

func (*MockWatch) Get

func (m *MockWatch) Get() Service

Get mocks base method

type MockWatchMockRecorder

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

MockWatchMockRecorder is the mock recorder for MockWatch

func (*MockWatchMockRecorder) C

C indicates an expected call of C

func (*MockWatchMockRecorder) Close

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

Close indicates an expected call of Close

func (*MockWatchMockRecorder) Get

func (mr *MockWatchMockRecorder) Get() *gomock.Call

Get indicates an expected call of Get

type NamespaceOptions

type NamespaceOptions interface {
	// PlacementNamespace is the custom namespace for placement.
	PlacementNamespace() string

	// SetPlacementNamespace sets the custom namespace for placement.
	SetPlacementNamespace(v string) NamespaceOptions

	// MetadataNamespace is the custom namespace for metadata.
	MetadataNamespace() string

	// SetMetadataNamespace sets the custom namespace for metadata.
	SetMetadataNamespace(v string) NamespaceOptions
}

NamespaceOptions are options to provide custom namespaces in service discovery service. TODO(cw): Provide overrides for leader service and heartbeat service.

func NewNamespaceOptions

func NewNamespaceOptions() NamespaceOptions

NewNamespaceOptions constructs a new NamespaceOptions.

type NamespacesConfiguration

type NamespacesConfiguration struct {
	Placement string `yaml:"placement"`
	Metadata  string `yaml:"metadata"`
}

NamespacesConfiguration configs the NamespaceOptions.

func (NamespacesConfiguration) NewOptions

func (cfg NamespacesConfiguration) NewOptions() NamespaceOptions

NewOptions creates a new NamespaceOptions.

type Options

type Options interface {
	// InitTimeout is the max time to wait on a new service watch for a valid initial value.
	// If the value is set to 0, then no wait will be done and the watch could return empty value.
	InitTimeout() time.Duration

	// SetInitTimeout sets the InitTimeout.
	SetInitTimeout(t time.Duration) Options

	// KVGen is the function to generate a kv store for a given zone.
	KVGen() KVGen

	// SetKVGen sets the KVGen.
	SetKVGen(gen KVGen) Options

	// HeartbeatGen is the function to generate a heartbeat store for a given zone.
	HeartbeatGen() HeartbeatGen

	// SetHeartbeatGen sets the HeartbeatGen.
	SetHeartbeatGen(gen HeartbeatGen) Options

	// LeaderGen is the function to generate a leader service instance for a
	// given service.
	LeaderGen() LeaderGen

	// SetLeaderGen sets the leader generation function.
	SetLeaderGen(gen LeaderGen) Options

	// InstrumentsOptions is the instrument options.
	InstrumentsOptions() instrument.Options

	// SetInstrumentsOptions sets the InstrumentsOptions.
	SetInstrumentsOptions(iopts instrument.Options) Options

	// NamespaceOptions is the custom namespaces.
	NamespaceOptions() NamespaceOptions

	// SetNamespaceOptions sets the NamespaceOptions.
	SetNamespaceOptions(opts NamespaceOptions) Options

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

Options are options for the client of Services.

func NewOptions

func NewOptions() Options

NewOptions creates an Option

type OverrideConfiguration

type OverrideConfiguration struct {
	Namespaces NamespacesConfiguration `yaml:"namespaces"`
}

OverrideConfiguration configs the override options.

func (OverrideConfiguration) NewOptions

func (cfg OverrideConfiguration) NewOptions() OverrideOptions

NewOptions creates a new override options.

type OverrideOptions

type OverrideOptions interface {
	// NamespaceOptions is the namespace options.
	NamespaceOptions() NamespaceOptions

	// SetNamespaceOptions sets namespace options.
	SetNamespaceOptions(opts NamespaceOptions) OverrideOptions
}

OverrideOptions configs the override for service discovery.

func NewOverrideOptions

func NewOverrideOptions() OverrideOptions

NewOverrideOptions constructs a new OverrideOptions.

type QueryOptions

type QueryOptions interface {
	// IncludeUnhealthy decides whether unhealthy instances should be returned.
	IncludeUnhealthy() bool

	// SetIncludeUnhealthy sets the value of IncludeUnhealthy.
	SetIncludeUnhealthy(h bool) QueryOptions
}

QueryOptions are options to service discovery queries.

func NewQueryOptions

func NewQueryOptions() QueryOptions

NewQueryOptions creates new QueryOptions.

type Service

type Service interface {
	// Instance returns the service instance with the instance id.
	Instance(instanceID string) (ServiceInstance, error)

	// Instances returns the service instances.
	Instances() []ServiceInstance

	// SetInstances sets the service instances.
	SetInstances(insts []ServiceInstance) Service

	// Replication returns the service replication description or nil if none.
	Replication() ServiceReplication

	// SetReplication sets the service replication description or nil if none.
	SetReplication(r ServiceReplication) Service

	// Sharding returns the service sharding description or nil if none.
	Sharding() ServiceSharding

	// SetSharding sets the service sharding description or nil if none
	SetSharding(s ServiceSharding) Service
}

Service describes the metadata and instances of a service.

func NewService

func NewService() Service

NewService creates a new Service.

func NewServiceFromPlacement

func NewServiceFromPlacement(p placement.Placement, sid ServiceID) Service

NewServiceFromPlacement creates a Service from the placement and service ID.

func NewServiceFromProto

func NewServiceFromProto(
	p *placementpb.Placement,
	sid ServiceID,
) (Service, error)

NewServiceFromProto takes the data from a placement and a service id and returns the corresponding Service object.

type ServiceID

type ServiceID interface {
	// Name returns the service name of the ServiceID.
	Name() string

	// SetName sets the service name of the ServiceID.
	SetName(s string) ServiceID

	// Environment returns the environment of the ServiceID.
	Environment() string

	// SetEnvironment sets the environment of the ServiceID.
	SetEnvironment(env string) ServiceID

	// Zone returns the zone of the ServiceID.
	Zone() string

	// SetZone sets the zone of the ServiceID.
	SetZone(zone string) ServiceID

	// Equal retruns if the service IDs are equivalent.
	Equal(value ServiceID) bool

	// String returns a description of the ServiceID.
	String() string
}

ServiceID contains the fields required to id a service.

func NewServiceID

func NewServiceID() ServiceID

NewServiceID creates new ServiceID.

type ServiceIDConfiguration

type ServiceIDConfiguration struct {
	Name        string `yaml:"name"`
	Environment string `yaml:"environment"`
	Zone        string `yaml:"zone"`
}

ServiceIDConfiguration is for configuring serviceID.

func (ServiceIDConfiguration) NewServiceID

func (cfg ServiceIDConfiguration) NewServiceID() ServiceID

NewServiceID creates a ServiceID.

type ServiceInstance

type ServiceInstance interface {
	// ServiceID returns the service id of the instance.
	ServiceID() ServiceID

	// SetServiceID sets the service id of the instance.
	SetServiceID(service ServiceID) ServiceInstance

	// InstanceID returns the id of the instance.
	InstanceID() string

	// SetInstanceID sets the id of the instance.
	SetInstanceID(id string) ServiceInstance

	// Endpoint returns the endpoint of the instance.
	Endpoint() string

	// SetEndpoint sets the endpoint of the instance.
	SetEndpoint(e string) ServiceInstance

	// Shards returns the shards of the instance.
	Shards() shard.Shards

	// SetShards sets the shards of the instance.
	SetShards(s shard.Shards) ServiceInstance
}

ServiceInstance is a single instance of a service.

func NewServiceInstance

func NewServiceInstance() ServiceInstance

NewServiceInstance creates a new ServiceInstance.

func NewServiceInstanceFromPlacementInstance

func NewServiceInstanceFromPlacementInstance(
	instance placement.Instance,
	sid ServiceID,
) ServiceInstance

NewServiceInstanceFromPlacementInstance creates a new service instance from placement instance.

func NewServiceInstanceFromProto

func NewServiceInstanceFromProto(
	instance *placementpb.Instance,
	sid ServiceID,
) (ServiceInstance, error)

NewServiceInstanceFromProto creates a new service instance from proto.

type ServiceReplication

type ServiceReplication interface {
	// Replicas is the count of replicas.
	Replicas() int

	// SetReplicas sets the count of replicas.
	SetReplicas(r int) ServiceReplication
}

ServiceReplication describes the replication of a service.

func NewServiceReplication

func NewServiceReplication() ServiceReplication

NewServiceReplication creates a new ServiceReplication.

type ServiceSharding

type ServiceSharding interface {
	// NumShards is the number of shards to use for sharding.
	NumShards() int

	// SetNumShards sets the number of shards to use for sharding.
	SetNumShards(n int) ServiceSharding

	// IsSharded() returns whether this service is sharded.
	IsSharded() bool

	// SetIsSharded sets IsSharded.
	SetIsSharded(s bool) ServiceSharding
}

ServiceSharding describes the sharding of a service.

func NewServiceSharding

func NewServiceSharding() ServiceSharding

NewServiceSharding creates a new ServiceSharding.

type Services

type Services interface {
	// Advertise advertises the availability of an instance of a service.
	Advertise(ad Advertisement) error

	// Unadvertise indicates a given instance is no longer available.
	Unadvertise(service ServiceID, id string) error

	// Query returns the topology for a given service.
	Query(service ServiceID, opts QueryOptions) (Service, error)

	// Watch returns a watch on metadata and a list of available instances for a given service.
	Watch(service ServiceID, opts QueryOptions) (Watch, error)

	// Metadata returns the metadata for a given service.
	Metadata(sid ServiceID) (Metadata, error)

	// SetMetadata sets the metadata for a given service.
	SetMetadata(sid ServiceID, m Metadata) error

	// DeleteMetadata deletes the metadata for a given service
	DeleteMetadata(sid ServiceID) error

	// PlacementService returns a client of placement.Service.
	PlacementService(sid ServiceID, popts placement.Options) (placement.Service, error)

	// HeartbeatService returns a heartbeat store for the given service.
	HeartbeatService(service ServiceID) (HeartbeatService, error)

	// LeaderService returns an instance of a leader service for the given
	// service ID.
	LeaderService(service ServiceID, opts ElectionOptions) (LeaderService, error)
}

Services provides access to the service topology.

func NewServices

func NewServices(opts Options) (Services, error)

NewServices returns a client of Services.

type Watch

type Watch interface {
	// Close closes the watch.
	Close()

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

	// Get returns the latest service of the service watchable.
	Get() Service
}

Watch is a watcher that issues notification when a service is updated.

func NewWatch

func NewWatch(w watch.Watch) Watch

NewWatch creates a Watch.

Directories

Path Synopsis
heartbeat
Package leader provides functionality for etcd-backed leader elections.
Package leader provides functionality for etcd-backed leader elections.
campaign
Package campaign encapsulates the state of a campaign.
Package campaign encapsulates the state of a campaign.
election
Package election provides a wrapper around a subset of the Election functionality of etcd's concurrency package with error handling for common failure scenarios such as lease expiration.
Package election provides a wrapper around a subset of the Election functionality of etcd's concurrency package with error handling for common failure scenarios such as lease expiration.

Jump to

Keyboard shortcuts

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