Documentation
¶
Overview ¶
Package log implements the log service
Index ¶
- Variables
- type EventService
- func (n *EventService) Create(ctx context.Context, event *eventsv1.Event) (*eventsv1.Event, error)
- func (n *EventService) Delete(ctx context.Context, id keys.ID) error
- func (n *EventService) Get(ctx context.Context, id keys.ID) (*eventsv1.Event, error)
- func (n *EventService) List(ctx context.Context, limit int32) ([]*eventsv1.Event, error)
- func (n *EventService) Publish(ctx context.Context, ev *eventsv1.Event) (*eventsv1.Event, error)
- func (n *EventService) Subscribe(ctx context.Context, in NodeConnectInput) (Session, error)
- type FencingToken
- type HolderID
- type LeaseGuard
- type LeaseService
- func (l *LeaseService) Acquire(ctx context.Context, taskID ResourceID, nodeID HolderID) (*leasesv1.Lease, string, error)
- func (l *LeaseService) Get(ctx context.Context, taskID ResourceID) (*leasesv1.Lease, error)
- func (l *LeaseService) List(ctx context.Context) ([]*leasesv1.Lease, error)
- func (l *LeaseService) Release(ctx context.Context, taskID ResourceID, holderID HolderID, token string) error
- func (l *LeaseService) Renew(ctx context.Context, taskID ResourceID, nodeID HolderID, token string) (*leasesv1.Lease, string, error)
- func (l *LeaseService) Revoke(ctx context.Context, taskID ResourceID, holderID HolderID) error
- type LeaseStore
- type LogService
- type NodeConnectInput
- type NodeSender
- type NodeService
- func (l *NodeService) Condition(ctx context.Context, id keys.ID, req *typesv1.ConditionRequest) error
- func (l *NodeService) Connect(ctx context.Context, in NodeConnectInput) (Session, error)
- func (l *NodeService) Create(ctx context.Context, node *nodesv1.Node) (*nodesv1.Node, error)
- func (l *NodeService) Delete(ctx context.Context, id keys.ID) error
- func (l *NodeService) Forget(ctx context.Context, id keys.ID) error
- func (l *NodeService) Get(ctx context.Context, id keys.ID) (*nodesv1.Node, error)
- func (l *NodeService) Join(ctx context.Context, id keys.ID, node *nodesv1.Node) (*nodesv1.Node, error)
- func (l *NodeService) List(ctx context.Context, limit int32) ([]*nodesv1.Node, error)
- func (l *NodeService) Patch(ctx context.Context, id keys.ID, patch *nodesv1.Node) error
- func (l *NodeService) Update(ctx context.Context, id keys.ID, node *nodesv1.Node) error
- func (l *NodeService) UpdateStatus(ctx context.Context, id keys.ID, st *nodesv1.Status, mask ...string) error
- func (l *NodeService) Upgrade(ctx context.Context, req *nodesv1.UpgradeRequest) error
- type NodeSessionManager
- func (m *NodeSessionManager) Connect(ctx context.Context, node *nodesv1.Node, in NodeConnectInput) (Session, error)
- func (m *NodeSessionManager) Disconnect(nodeUID string)
- func (m *NodeSessionManager) Get(ctx context.Context, nodeUID string) (*nodesv1.Node, error)
- func (m *NodeSessionManager) IsNodeConnected(nodeUID string) bool
- func (m *NodeSessionManager) List(ctx context.Context, limit int32) ([]*nodesv1.Node, error)
- func (m *NodeSessionManager) SendToNode(ctx context.Context, nodeUID string, ev *eventsv1.Event) error
- func (m *NodeSessionManager) Set(ctx context.Context, nodeUID string, node *nodesv1.Node) error
- type NodeSessionManagerOption
- type ResourceID
- type Scheduler
- type Session
- type SessionManager
- type TaskGetter
- type TaskManager
- type TaskService
- func (l *TaskService) Condition(ctx context.Context, id keys.ID, req *typesv1.ConditionRequest) error
- func (l *TaskService) Create(ctx context.Context, task *tasksv1.Task) (*tasksv1.Task, error)
- func (l *TaskService) Delete(ctx context.Context, id keys.ID) error
- func (l *TaskService) Get(ctx context.Context, id keys.ID) (*tasksv1.Task, error)
- func (l *TaskService) Kill(ctx context.Context, id keys.ID) error
- func (l *TaskService) List(ctx context.Context, limit int32) ([]*tasksv1.Task, error)
- func (l *TaskService) Patch(ctx context.Context, id keys.ID, patch *tasksv1.Task) error
- func (l *TaskService) Start(ctx context.Context, id keys.ID) error
- func (l *TaskService) Stop(ctx context.Context, id keys.ID) error
- func (l *TaskService) Update(ctx context.Context, id keys.ID, task *tasksv1.Task) error
- func (l *TaskService) UpdateStatus(ctx context.Context, id keys.ID, st *tasksv1.Status, mask ...string) error
- type Version
- type VolumeService
- func (l *VolumeService) Condition(ctx context.Context, id keys.ID, req *typesv1.ConditionRequest) error
- func (l *VolumeService) Create(ctx context.Context, volume *volumesv1.Volume) (*volumesv1.Volume, error)
- func (l *VolumeService) Delete(ctx context.Context, id keys.ID) error
- func (l *VolumeService) Get(ctx context.Context, id keys.ID) (*volumesv1.Volume, error)
- func (l *VolumeService) List(ctx context.Context, limit int32) ([]*volumesv1.Volume, error)
- func (l *VolumeService) Patch(ctx context.Context, id keys.ID, patch *volumesv1.Volume) error
- func (l *VolumeService) Update(ctx context.Context, id keys.ID, volume *volumesv1.Volume) error
- func (l *VolumeService) UpdateStatus(ctx context.Context, id keys.ID, st *volumesv1.Status, mask ...string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrNodeNotConnected = errors.New("node not connected") ErrNodeQueueFull = errors.New("node outbound queue full") )
Functions ¶
This section is empty.
Types ¶
type EventService ¶
type EventService struct {
Repo *repository.Repo[*eventsv1.Event]
Logger logger.Logger
Exchange *events.Exchange
Manager SessionManager
// contains filtered or unexported fields
}
func (*EventService) Subscribe ¶
func (n *EventService) Subscribe(ctx context.Context, in NodeConnectInput) (Session, error)
Subscribe implements events.EventServiceClient.
type FencingToken ¶
type FencingToken uint64
type LeaseGuard ¶
type LeaseGuard interface {
IsHolder(ctx context.Context, resourceID ResourceID, holderID HolderID) (bool, error)
AssertHolder(ctx context.Context, resourceID ResourceID, holderID HolderID) (token FencingToken, err error)
}
type LeaseService ¶
type LeaseService struct {
Exchange *events.Exchange
Logger logger.Logger
LeaseTTL uint32
GracePeriod time.Duration
SigningKey *ecdsa.PrivateKey
TokenStore map[string]string
Manager LeaseStore
// contains filtered or unexported fields
}
func (*LeaseService) Acquire ¶
func (l *LeaseService) Acquire(ctx context.Context, taskID ResourceID, nodeID HolderID) (*leasesv1.Lease, string, error)
func (*LeaseService) Get ¶
func (l *LeaseService) Get(ctx context.Context, taskID ResourceID) (*leasesv1.Lease, error)
func (*LeaseService) Release ¶
func (l *LeaseService) Release(ctx context.Context, taskID ResourceID, holderID HolderID, token string) error
func (*LeaseService) Renew ¶
func (l *LeaseService) Renew(ctx context.Context, taskID ResourceID, nodeID HolderID, token string) (*leasesv1.Lease, string, error)
func (*LeaseService) Revoke ¶
func (l *LeaseService) Revoke(ctx context.Context, taskID ResourceID, holderID HolderID) error
type LeaseStore ¶
type LeaseStore interface {
LeaseGuard
Acquire(ctx context.Context, resource ResourceID, holder HolderID, ttl time.Duration) (*leasesv1.Lease, string, error)
Renew(ctx context.Context, resource ResourceID, holder HolderID, ttl time.Duration, token string) (*leasesv1.Lease, string, error)
Release(ctx context.Context, resource ResourceID, holder HolderID, token string) error
Revoke(ctx context.Context, resource ResourceID, holder HolderID) error
Get(ctx context.Context, resource ResourceID) (*leasesv1.Lease, error)
List(ctx context.Context) ([]*leasesv1.Lease, error)
}
type LogService ¶
type LogService struct {
Logger logger.Logger
Exchange *events.Exchange
LogExchange *events.LogExchange
Manager SessionManager
Sender NodeSender
}
func (*LogService) SendStartLogsCommand ¶
func (s *LogService) SendStartLogsCommand(ctx context.Context, req *logsv1.TailLogRequest) error
func (*LogService) SendStopLogsCommand ¶
func (s *LogService) SendStopLogsCommand(ctx context.Context, req *logsv1.TailLogRequest) error
type NodeConnectInput ¶
NodeConnectInput represents the identity established for a node stream. NodeUID and NodeName are expected to come from transport metadata.
type NodeSender ¶
type NodeService ¶
type NodeService struct {
Repo *repository.Repo[*nodesv1.Node]
Exchange *events.Exchange
Logger logger.Logger
Manager SessionManager
Sender NodeSender
// contains filtered or unexported fields
}
func (*NodeService) Condition ¶
func (l *NodeService) Condition(ctx context.Context, id keys.ID, req *typesv1.ConditionRequest) error
func (*NodeService) Connect ¶
func (l *NodeService) Connect(ctx context.Context, in NodeConnectInput) (Session, error)
func (*NodeService) UpdateStatus ¶
func (*NodeService) Upgrade ¶
func (l *NodeService) Upgrade(ctx context.Context, req *nodesv1.UpgradeRequest) error
type NodeSessionManager ¶
type NodeSessionManager struct {
// contains filtered or unexported fields
}
NodeSessionManager owns node stream sessions and enables targeted delivery.
Intended usage: - transport calls Connect() to open a session for a stream - transport forwards inbound stream messages to Session.Handle() - transport writes outbound messages from Session.Next() to the stream - business logic sends targeted events using SendToNode()
func NewNodeSessionManager ¶
func NewNodeSessionManager(exchange *events.Exchange, l logger.Logger, opts ...NodeSessionManagerOption) *NodeSessionManager
func (*NodeSessionManager) Connect ¶
func (m *NodeSessionManager) Connect(ctx context.Context, node *nodesv1.Node, in NodeConnectInput) (Session, error)
func (*NodeSessionManager) Disconnect ¶
func (m *NodeSessionManager) Disconnect(nodeUID string)
Disconnect closes and removes the session for nodeUID, if present.
func (*NodeSessionManager) IsNodeConnected ¶
func (m *NodeSessionManager) IsNodeConnected(nodeUID string) bool
func (*NodeSessionManager) SendToNode ¶
func (m *NodeSessionManager) SendToNode(ctx context.Context, nodeUID string, ev *eventsv1.Event) error
SendToNode enqueues an event for delivery to a single connected node.
It returns ErrNodeNotConnected if the node has no active session. It returns ErrNodeQueueFull if the node session is backpressured.
type NodeSessionManagerOption ¶
type NodeSessionManagerOption func(*NodeSessionManager)
func WithOutboundBuffer ¶
func WithOutboundBuffer(size int) NodeSessionManagerOption
type ResourceID ¶
type ResourceID string
type SessionManager ¶
type TaskGetter ¶
type TaskManager ¶
type TaskService ¶
type TaskService struct {
Repo *repository.Repo[*tasksv1.Task]
Exchange *events.Exchange
Logger logger.Logger
Manager LeaseStore
// contains filtered or unexported fields
}
func (*TaskService) Condition ¶
func (l *TaskService) Condition(ctx context.Context, id keys.ID, req *typesv1.ConditionRequest) error
func (*TaskService) Delete ¶
Delete publishes a delete request and the subscribers are responsible for deleting resources. Once they do, they will update there resource with the status Deleted
type VolumeService ¶
type VolumeService struct {
Repo *repository.Repo[*volumesv1.Volume]
Exchange *events.Exchange
Logger logger.Logger
// contains filtered or unexported fields
}
func (*VolumeService) Condition ¶
func (l *VolumeService) Condition(ctx context.Context, id keys.ID, req *typesv1.ConditionRequest) error
func (*VolumeService) Delete ¶
Delete publishes a delete request and the subscribers are responsible for deleting resources. Once they do, they will update there resource with the status Deleted