servers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MPL-2.0 Imports: 14 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

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)

list will return a listing of resources and honor the WithLimit option or the repo defaultLimit

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
	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"`
	// 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

func (x *Server) GetName() string

func (*Server) GetPrivateId

func (x *Server) GetPrivateId() string

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 ServerType

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

func (ServerType) String

func (s ServerType) 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