Documentation
¶
Overview ¶
Package agentsession owns deferred cleanup of coding-agent provider sessions.
Index ¶
- func ProcessNextCleanup(ctx context.Context, ownerWorkerID string, queue *CleanupQueue, ...) (bool, error)
- func RunCleanupLoop(ctx context.Context, ownerWorkerID string, queue *CleanupQueue, ...)
- type CleanupJob
- type CleanupQueue
- func (q *CleanupQueue) Claim(ctx context.Context, ownerWorkerID string, lease time.Duration) (*CleanupJob, error)
- func (q *CleanupQueue) Complete(ctx context.Context, ownerWorkerID, id, claimToken string) error
- func (q *CleanupQueue) EnqueueDAGRunRemoval(ctx context.Context, root ir.DAGRunRef, resources []ir.AgentSessionResource) error
- func (q *CleanupQueue) Release(ctx context.Context, ownerWorkerID, id, claimToken, message string) error
- type SessionDeleter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessNextCleanup ¶
func ProcessNextCleanup( ctx context.Context, ownerWorkerID string, queue *CleanupQueue, repository *persis.DAGRunRepository, deleteSession SessionDeleter, ) (bool, error)
ProcessNextCleanup processes one eligible job.
func RunCleanupLoop ¶
func RunCleanupLoop( ctx context.Context, ownerWorkerID string, queue *CleanupQueue, repository *persis.DAGRunRepository, deleteSession SessionDeleter, )
RunCleanupLoop processes eligible jobs until ctx is cancelled.
Types ¶
type CleanupJob ¶
type CleanupJob struct {
Root ir.DAGRunRef `json:"root"`
Resource ir.AgentSessionResource `json:"resource"`
ID string `json:"id"`
ClaimToken string `json:"claimToken,omitempty"`
ClaimedBy string `json:"claimedBy,omitempty"`
LastError string `json:"lastError,omitempty"`
ClaimedAt int64 `json:"claimedAt,omitempty"`
NextAttemptAt int64 `json:"nextAttemptAt,omitempty"`
Attempts int `json:"attempts,omitempty"`
}
CleanupJob is a durable request to remove one provider session.
type CleanupQueue ¶
type CleanupQueue struct {
// contains filtered or unexported fields
}
CleanupQueue persists provider cleanup until the owning execution host completes it.
func NewCleanupQueue ¶
func NewCleanupQueue(col persis.Collection) *CleanupQueue
NewCleanupQueue creates a cleanup queue backed by col.
func (*CleanupQueue) Claim ¶
func (q *CleanupQueue) Claim(ctx context.Context, ownerWorkerID string, lease time.Duration) (*CleanupJob, error)
Claim reserves the next eligible cleanup job for ownerWorkerID.
func (*CleanupQueue) Complete ¶
func (q *CleanupQueue) Complete(ctx context.Context, ownerWorkerID, id, claimToken string) error
Complete removes a claimed cleanup job.
func (*CleanupQueue) EnqueueDAGRunRemoval ¶
func (q *CleanupQueue) EnqueueDAGRunRemoval(ctx context.Context, root ir.DAGRunRef, resources []ir.AgentSessionResource) error
EnqueueDAGRunRemoval records cleanup for all Dagu-owned sessions retained by root.
type SessionDeleter ¶
type SessionDeleter func(context.Context, ir.AgentSessionResource) error
SessionDeleter removes one provider resource from its owning host.
Click to show internal directories.
Click to hide internal directories.