cluster

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replay

func Replay(events []ddd.Event) ddd.Aggregate

Replay recreates the cluster from a series of events

Types

type Cluster

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

Cluster represents a kubernetes cluster we are monitoring/deploying to

func Create

func Create(uuid, name, token string, timestamp int64) (*Cluster, error)

Create handles create commands

func (*Cluster) Destroy

func (c *Cluster) Destroy(timestamp int64) error

Destroy handles destroy commands

func (*Cluster) Destroyed added in v0.4.0

func (c *Cluster) Destroyed() bool

Destroyed determines if this deployment has been destroyed

func (*Cluster) Events

func (c *Cluster) Events() []ddd.Event

Events returns this cluster's event history

func (*Cluster) Name

func (c *Cluster) Name() string

Name returns this cluster's name

func (*Cluster) Token

func (c *Cluster) Token() string

Token returns this cluster's agent token

func (*Cluster) UUID

func (c *Cluster) UUID() string

UUID returns this cluster's identifier

func (*Cluster) Update

func (c *Cluster) Update(name string, timestamp int64) error

Update handles update commands

func (*Cluster) Version

func (c *Cluster) Version() int

Version returns this cluster's version number (NOTE: aggregate version!)

type Created

type Created struct {
	Timestamp int64
	UUID      string
	Name      string
	Token     string
}

Created is the event for when a new cluster is created

func (Created) EventType

func (e Created) EventType() string

EventType marks this as an event

type Destroyed

type Destroyed struct {
	Timestamp int64
}

Destroyed is the event for when a cluster is destroyed

func (Destroyed) EventType

func (e Destroyed) EventType() string

EventType marks this as an event

type ReadRepository added in v0.4.0

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

ReadRepository is the repository for dealing with cluster reads

func NewReadRepository added in v0.4.0

func NewReadRepository(s storage.Storage) *ReadRepository

NewReadRepository creates a repository with the given storage

func (*ReadRepository) All added in v0.4.0

func (rr *ReadRepository) All() ([]*Cluster, error)

All gets all clusters

func (*ReadRepository) Load added in v0.4.0

func (rr *ReadRepository) Load(uuid string) (*Cluster, error)

Load gets one cluster

type Service

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

Service is the implementation for twirp to use

func NewService

func NewService(ag agent.AgentAction, au auth.Agent, s storage.Storage) *Service

NewService creates the service

func (Service) All

func (s Service) All(ctx context.Context, req *pb.ReadClusters) (*pb.ClustersRead, error)

All gets all clusters currently configured and their status

func (Service) Create

func (s Service) Create(ctx context.Context, cmd *pb.CreateCluster) (*pb.ClusterCreated, error)

Create adds a cluster to the list of configurations

func (Service) Destroy

func (s Service) Destroy(ctx context.Context, cmd *pb.DestroyCluster) (*pb.ClusterDestroyed, error)

Destroy removes a cluster from the list of configurations

func (Service) Read

func (s Service) Read(ctx context.Context, req *pb.ReadCluster) (*pb.ClusterRead, error)

Read reads out a cluster

func (Service) Ready added in v0.3.2

func (s Service) Ready() error

Ready implements the ReadyService method so this service can be part of a health check routine

func (Service) Token added in v0.7.0

Token gets the cluster's access token

func (Service) Update

func (s Service) Update(ctx context.Context, cmd *pb.UpdateCluster) (*pb.ClusterUpdated, error)

Update edits an already existing cluster

type Updated

type Updated struct {
	Timestamp int64
	Name      string
}

Updated is the event for when a cluster is updated

func (Updated) EventType

func (e Updated) EventType() string

EventType marks this as an event

Jump to

Keyboard shortcuts

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