servers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_controller_servers_v1_servers_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option - how Options are passed as arguments

func WithLimit

func WithLimit(limit int) Option

WithLimit provides an option to provide a limit. Intentionally allowing negative integers. If WithLimit < 0, then unlimited results are returned. If WithLimit == 0, then default limits are used for results.

func WithLiveness

func WithLiveness(liveness time.Duration) Option

WithSkipVetForWrite provides an option to allow skipping vet checks to allow testing lower-level SQL triggers and constraints

func WithUpdateTags added in v0.1.5

func WithUpdateTags(updateTags bool) Option

WithUpdateTags indicates that we should perform tag updates in the DB. This would happen on first sync from a worker after startup or (eventually, perhaps), after a SIGHUP.

type RecoveryNonce

type RecoveryNonce struct {
	Nonce string
}

type Repository

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

Repository is the servers database repository

func NewRepository

func NewRepository(r db.Reader, w db.Writer, kms *kms.Kms) (*Repository, error)

NewRepository creates a new servers Repository. Supports the options: WithLimit which sets a default limit on results returned by repo operations.

func (*Repository) AddRecoveryNonce

func (r *Repository) AddRecoveryNonce(ctx context.Context, nonce string, opt ...Option) error

AddRecoveryNonce adds a nonce

func (*Repository) CleanupNonces

func (r *Repository) CleanupNonces(ctx context.Context, opt ...Option) (int, error)

CleanupNonces removes nonces that no longer need to be stored

func (*Repository) ListNonces

func (r *Repository) ListNonces(ctx context.Context, opt ...Option) ([]*RecoveryNonce, error)

ListNonces lists nonces. Used only for tests at the moment.

func (*Repository) ListServers

func (r *Repository) ListServers(ctx context.Context, serverType ServerType, opt ...Option) ([]*Server, error)

ListServers is a passthrough to listServersWithReader that uses the repo's normal reader.

func (*Repository) ListTagsForServers added in v0.1.5

func (r *Repository) ListTagsForServers(ctx context.Context, serverIds []string, opt ...Option) ([]*ServerTag, error)

ListTagsForServers pulls out tag tuples into ServerTag structs for the given server ID values.

func (*Repository) UpsertServer

func (r *Repository) UpsertServer(ctx context.Context, server *Server, opt ...Option) ([]*Server, int, error)

UpsertServer adds or updates a server in the DB

type Server

type Server struct {

	// Private ID of the resource
	PrivateId string `protobuf:"bytes,10,opt,name=private_id,json=privateId,proto3" json:"private_id,omitempty"`
	// Type of the resource (controller, worker)
	Type string `protobuf:"bytes,20,opt,name=type,proto3" json:"type,omitempty"`
	// Name of the resource. This is deprecated because we ended up setting the
	// private ID and name to be identical, and there is currently no reason we
	// can think of to allow a given server's name to match another within the
	// same cluster. So we simply use the private ID and deprecate this.
	//
	// Deprecated: Do not use.
	Name string `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty"`
	// Description of the resource
	Description string `protobuf:"bytes,40,opt,name=description,proto3" json:"description,omitempty"`
	// Address for the server
	Address string `protobuf:"bytes,50,opt,name=address,proto3" json:"address,omitempty"`
	// First seen time from the RDBMS
	CreateTime *timestamp.Timestamp `protobuf:"bytes,60,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
	// Last time there was an update
	UpdateTime *timestamp.Timestamp `protobuf:"bytes,70,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
	// Tags for workers
	Tags map[string]*TagValues `` /* 150-byte string literal not displayed */
	// contains filtered or unexported fields
}

Server contains all fields related to a Controller or Worker resource

func (*Server) Descriptor deprecated

func (*Server) Descriptor() ([]byte, []int)

Deprecated: Use Server.ProtoReflect.Descriptor instead.

func (*Server) GetAddress

func (x *Server) GetAddress() string

func (*Server) GetCreateTime

func (x *Server) GetCreateTime() *timestamp.Timestamp

func (*Server) GetDescription

func (x *Server) GetDescription() string

func (*Server) GetName deprecated

func (x *Server) GetName() string

Deprecated: Do not use.

func (*Server) GetPrivateId

func (x *Server) GetPrivateId() string

func (*Server) GetTags added in v0.1.5

func (x *Server) GetTags() map[string]*TagValues

func (*Server) GetType

func (x *Server) GetType() string

func (*Server) GetUpdateTime

func (x *Server) GetUpdateTime() *timestamp.Timestamp

func (*Server) ProtoMessage

func (*Server) ProtoMessage()

func (*Server) ProtoReflect

func (x *Server) ProtoReflect() protoreflect.Message

func (*Server) Reset

func (x *Server) Reset()

func (*Server) String

func (x *Server) String() string

func (*Server) TableName

func (s *Server) TableName() string

type ServerTag added in v0.1.5

type ServerTag struct {
	ServerId string
	Key      string
	Value    string
}

ServerTag holds the information for the server_tag table for Gorm.

func (ServerTag) TableName added in v0.1.5

func (ServerTag) TableName() string

TableName overrides the table name used by ServerTag to `server_tag`

type ServerType

type ServerType string
const (
	ServerTypeController ServerType = "controller"
	ServerTypeWorker     ServerType = "worker"
)

func (ServerType) String

func (s ServerType) String() string

type TagValues added in v0.1.5

type TagValues struct {
	Values []string `protobuf:"bytes,10,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

TagValues is used because map fields cannot be repeated but can be a message

func (*TagValues) Descriptor deprecated added in v0.1.5

func (*TagValues) Descriptor() ([]byte, []int)

Deprecated: Use TagValues.ProtoReflect.Descriptor instead.

func (*TagValues) GetValues added in v0.1.5

func (x *TagValues) GetValues() []string

func (*TagValues) ProtoMessage added in v0.1.5

func (*TagValues) ProtoMessage()

func (*TagValues) ProtoReflect added in v0.1.5

func (x *TagValues) ProtoReflect() protoreflect.Message

func (*TagValues) Reset added in v0.1.5

func (x *TagValues) Reset()

func (*TagValues) String added in v0.1.5

func (x *TagValues) String() string

Directories

Path Synopsis
common
Package common contains types and helper functions that are used across the different packages under internal/server/controller.
Package common contains types and helper functions that are used across the different packages under internal/server/controller.

Jump to

Keyboard shortcuts

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