seed

package
v0.0.0-...-c9760b3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyProvider

type DummyProvider struct{}

DummyProvider is a no-op for pushing and pulling seeds

func NewDummyProvider

func NewDummyProvider(config map[string]interface{}) (*DummyProvider, error)

NewDummyProvider creates a DummyProvider, ignoring config

func (*DummyProvider) FetchSeed

func (d *DummyProvider) FetchSeed() (Seeds, error)

FetchSeed returns an empty list of seeds

func (*DummyProvider) PushSeed

func (d *DummyProvider) PushSeed(resolver resolver.IPResolver, port string) error

PushSeed does nothing and returns no error

type ManualProvider

type ManualProvider struct {
	IP   string
	Port string
}

ManualProvider always returns the same IP which was provided in config

func NewManualProvider

func NewManualProvider(config map[string]interface{}) (*ManualProvider, error)

NewManualProvider creates a new manual provider

func (*ManualProvider) FetchSeed

func (m *ManualProvider) FetchSeed() (Seeds, error)

FetchSeed returns the seed derived from config

func (*ManualProvider) PushSeed

func (m *ManualProvider) PushSeed(resolver resolver.IPResolver, port string) error

PushSeed is a no-op for a manual provider

type Provider

type Provider interface {
	FetchSeed() (Seeds, error)
	PushSeed(resolver.IPResolver, string) error
}

Provider abstracts the concept of fetching and pushing seeds, to avoid depending on the details of any one cloud or hosting platform.

type S3Provider

type S3Provider struct {
	Bucket string
	Region string
	Key    string
}

S3Provider can retrieve a seed from an object in an S3 bucket. Required permissions for a load balancer are: GetObject, PutObject, ListBucket Required permissions for an application server are: GetObject, ListBucket Without ListBucket you'll get an AccessDenied when you try to fetch a nonexistant seed

func NewS3Provider

func NewS3Provider(config map[string]interface{}) (*S3Provider, error)

NewS3Provider creates a new S3 seed provider from the given config. "availability-zone" is optional; if not given it will be deduced from instance metadata if running on EC2.

func (*S3Provider) FetchSeed

func (s *S3Provider) FetchSeed() (Seeds, error)

FetchSeed makes a call to S3 to retrieve the seed for the AZ this instance is located in.

func (*S3Provider) PushSeed

func (s *S3Provider) PushSeed(resolver resolver.IPResolver, port string) error

PushSeed fetches remote data, updates with local node details and then publishes the details to an S3 bucket so that future nodes can join

type Seed

type Seed struct {
	Address string `json:"address"`
	Port    string `json:"port"`
}

Seed contains the details for a client to connect to a load balancer without requiring multicast or another type of service discovery. This allows us to bootstrap the gossip cluster

type Seeds

type Seeds struct {
	Seeds []Seed `json:"seeds"`
}

Seeds is a collection of seeds in one file.

Jump to

Keyboard shortcuts

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