Documentation ¶
Index ¶
- Variables
- type Option
- type RecoveryNonce
- type Repository
- func (r *Repository) AddRecoveryNonce(ctx context.Context, nonce string, opt ...Option) error
- func (r *Repository) CleanupNonces(ctx context.Context, opt ...Option) (int, error)
- func (r *Repository) ListNonces(ctx context.Context, opt ...Option) ([]*RecoveryNonce, error)
- func (r *Repository) ListServers(ctx context.Context, serverType ServerType, opt ...Option) ([]*Server, 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() string
- func (x *Server) GetPrivateId() string
- 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 ServerType
Constants ¶
This section is empty.
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 ¶
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 ¶
NewRepository creates a new servers Repository. Supports the options: WithLimit which sets a default limit on results returned by repo operations.
func (*Repository) AddRecoveryNonce ¶
AddRecoveryNonce adds a nonce
func (*Repository) CleanupNonces ¶
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) 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