Documentation ¶
Index ¶
- Constants
- Variables
- type Nonce
- type Option
- type Repository
- func (r *Repository) AddNonce(ctx context.Context, nonce, purpose string, opt ...Option) error
- func (r *Repository) CleanupNonces(ctx context.Context, opt ...Option) (int, error)
- func (r *Repository) ListNonces(ctx context.Context, purpose string, opt ...Option) ([]*Nonce, error)
- func (r *Repository) ListServers(ctx context.Context, serverType ServerType, opt ...Option) ([]*Server, error)
- func (r *Repository) ListTagsForServers(ctx context.Context, serverIds []string, opt ...Option) ([]*ServerTag, error)
- func (r *Repository) UpsertServer(ctx context.Context, server *Server, opt ...Option) ([]*Server, int, error)
- type Server
- func (*Server) Descriptor() ([]byte, []int)deprecated
- func (x *Server) GetAddress() string
- func (x *Server) GetCreateTime() *timestamp.Timestamp
- func (x *Server) GetDescription() string
- func (x *Server) GetName() stringdeprecated
- func (x *Server) GetPrivateId() string
- func (x *Server) GetTags() map[string]*TagValues
- func (x *Server) GetType() string
- func (x *Server) GetUpdateTime() *timestamp.Timestamp
- func (*Server) ProtoMessage()
- func (x *Server) ProtoReflect() protoreflect.Message
- func (x *Server) Reset()
- func (x *Server) String() string
- func (s *Server) TableName() string
- type ServerTag
- type ServerType
- type TagValues
Constants ¶
const ( NoncePurposeRecovery = "recovery" NoncePurposeWorkerAuth = "worker-auth" )
const ( // DefaultLiveness is the setting that controls the server "liveness" time, // or the maximum allowable time that a worker can't send a status update to // the controller for. After this, the server is considered dead, and it will // be taken out of the rotation for allowable workers for connections, and // connections will possibly start to be terminated and marked as closed // depending on the grace period setting (see // base.Server.StatusGracePeriodDuration). This value serves as the default // and minimum allowable setting for the grace period. DefaultLiveness = 15 * time.Second )
Variables ¶
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 ¶
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 ¶
WithLiveness indicates how far back we want to search for server entries. Use 0 for the default liveness (15 seconds). A liveness value of -1 removes the liveliness condition.
func WithUpdateTags ¶ added in v0.1.5
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 Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is the servers database repository
func NewRepository ¶
NewRepository creates a new servers Repository. Supports the options: WithLimit which sets a default limit on results returned by repo operations.
func (*Repository) CleanupNonces ¶
CleanupNonces removes nonces that no longer need to be stored
func (*Repository) ListNonces ¶
func (r *Repository) ListNonces(ctx context.Context, purpose string, opt ...Option) ([]*Nonce, 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. // @inject_tag: `gorm:"-"` // // Deprecated: Do not use. Name string `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty" gorm:"-"` // 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 // @inject_tag: `gorm:"-"` Tags map[string]*TagValues `` /* 159-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) GetAddress ¶
func (*Server) GetCreateTime ¶
func (*Server) GetDescription ¶
func (*Server) GetPrivateId ¶
func (*Server) GetUpdateTime ¶
func (*Server) ProtoMessage ¶
func (*Server) ProtoMessage()
func (*Server) ProtoReflect ¶
func (x *Server) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶ added in v0.1.5
func (*TagValues) ProtoMessage()
func (*TagValues) ProtoReflect ¶ added in v0.1.5
func (x *TagValues) ProtoReflect() protoreflect.Message
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. |
common
Package common contains types and helper functions that are used across the different packages under internal/server/worker.
|
Package common contains types and helper functions that are used across the different packages under internal/server/worker. |
proxy
Package proxy contains a collection of proxy handlers for the worker to call once a connection has been authorized.
|
Package proxy contains a collection of proxy handlers for the worker to call once a connection has been authorized. |