protocol

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentVersion     = "loopernet/v1"
	DefaultLeaseName   = "coordinator"
	DefaultLeaseTTL    = 30 * time.Second
	MinimumDaemonField = "daemonVersion"
	TargetLabelPrefix  = "looper:target:"
)

Variables

This section is empty.

Functions

func CollectTargetLabels

func CollectTargetLabels(labels []string) []string

func CollectTargetLikeLabels

func CollectTargetLikeLabels(labels []string) []string

func HasExactTarget

func HasExactTarget(labels []string, nodeName string) bool

func ParseTargetLabel

func ParseTargetLabel(label string) (string, bool)

func TargetLabelForNode

func TargetLabelForNode(nodeName string) string

func ValidateCompatibility

func ValidateCompatibility(protocolVersion, daemonVersion, minDaemonVersion string) error

func ValidateNodeName

func ValidateNodeName(value string) error

Types

type AuditEnvelope

type AuditEnvelope struct {
	Event       string          `json:"event"`
	Actor       string          `json:"actor"`
	OccurredAt  time.Time       `json:"occurredAt"`
	NetworkID   string          `json:"networkId,omitempty"`
	NodeID      string          `json:"nodeId,omitempty"`
	LeaseName   string          `json:"leaseName,omitempty"`
	LeaseToken  int64           `json:"leaseToken,omitempty"`
	Payload     json.RawMessage `json:"payload,omitempty"`
	WarningText []string        `json:"warnings,omitempty"`
}

type CoordinatorLease

type CoordinatorLease struct {
	Name         string     `json:"name"`
	HolderNodeID string     `json:"holderNodeId,omitempty"`
	FencingToken int64      `json:"fencingToken"`
	ExpiresAt    *time.Time `json:"expiresAt,omitempty"`
}

type CoordinatorLeaseAcquireRequest

type CoordinatorLeaseAcquireRequest struct {
	TTLSeconds int `json:"ttlSeconds,omitempty"`
}

type CoordinatorLeaseHandoffRequest

type CoordinatorLeaseHandoffRequest struct {
	FencingToken   int64  `json:"fencingToken"`
	TargetNodeName string `json:"targetNodeName"`
	TTLSeconds     int    `json:"ttlSeconds,omitempty"`
}

type CoordinatorLeaseRenewRequest

type CoordinatorLeaseRenewRequest struct {
	FencingToken int64 `json:"fencingToken"`
	TTLSeconds   int   `json:"ttlSeconds,omitempty"`
}

type CoordinatorLeaseRevalidateRequest

type CoordinatorLeaseRevalidateRequest struct {
	FencingToken int64  `json:"fencingToken"`
	URL          string `json:"url"`
	Method       string `json:"method,omitempty"`
}

type ExactTargetPlan

type ExactTargetPlan struct {
	DesiredLabel string   `json:"desiredLabel,omitempty"`
	Current      []string `json:"current,omitempty"`
	Add          []string `json:"add,omitempty"`
	Remove       []string `json:"remove,omitempty"`
}

func PlanExactTarget

func PlanExactTarget(labels []string, nodeName string) (ExactTargetPlan, error)

type GitHubIdentity

type GitHubIdentity struct {
	NumericID int64  `json:"numericId"`
	Login     string `json:"login,omitempty"`
}

type HeartbeatRequest

type HeartbeatRequest struct {
	ProtocolVersion string           `json:"protocolVersion"`
	DaemonVersion   string           `json:"daemonVersion"`
	NodeName        string           `json:"nodeName"`
	GitHub          GitHubIdentity   `json:"github"`
	Capabilities    NodeCapabilities `json:"capabilities"`
}

type HeartbeatResponse

type HeartbeatResponse struct {
	RecordedAt time.Time `json:"recordedAt"`
	Warnings   []string  `json:"warnings,omitempty"`
}

type JoinRequest

type JoinRequest struct {
	ProtocolVersion string         `json:"protocolVersion"`
	DaemonVersion   string         `json:"daemonVersion"`
	JoinKey         string         `json:"joinKey"`
	NodeName        string         `json:"nodeName"`
	GitHub          GitHubIdentity `json:"github"`
	TargetLabels    []string       `json:"targetLabels,omitempty"`
}

type JoinResponse

type JoinResponse struct {
	NetworkID string   `json:"networkId"`
	NodeID    string   `json:"nodeId"`
	NodeToken string   `json:"nodeToken"`
	Warnings  []string `json:"warnings,omitempty"`
}

type Membership

type Membership struct {
	NodeID           string           `json:"nodeId"`
	NodeName         string           `json:"nodeName"`
	GitHub           GitHubIdentity   `json:"github"`
	Capabilities     NodeCapabilities `json:"capabilities"`
	TargetLabels     []string         `json:"targetLabels,omitempty"`
	JoinedAt         time.Time        `json:"joinedAt"`
	LastHeartbeatAt  *time.Time       `json:"lastHeartbeatAt,omitempty"`
	DuplicateWarning bool             `json:"duplicateGithubIdentityWarning,omitempty"`
}

type NodeCapabilities

type NodeCapabilities struct {
	Roles               []string                    `json:"roles,omitempty"`
	CoordinatorEligible bool                        `json:"coordinatorEligible"`
	RoutedProjects      int                         `json:"routedProjects"`
	RoutedProjectIDs    []string                    `json:"routedProjectIds,omitempty"`
	ReviewerProjects    []ReviewerProjectCapability `json:"reviewerProjects,omitempty"`
	LocalProjects       int                         `json:"localProjects"`
	DynamicLoad         int                         `json:"dynamicLoad"`
	IdentityDrift       bool                        `json:"identityDrift"`
	DriftReason         string                      `json:"driftReason,omitempty"`
}

type NodeStatusResponse

type NodeStatusResponse struct {
	NetworkID           string           `json:"networkId"`
	Membership          Membership       `json:"membership"`
	Memberships         []Membership     `json:"memberships,omitempty"`
	Lease               CoordinatorLease `json:"lease"`
	Webhook             WebhookHealth    `json:"webhook"`
	Warnings            []string         `json:"warnings,omitempty"`
	CloudReachable      bool             `json:"cloudReachable"`
	CurrentGitHub       GitHubIdentity   `json:"currentGithub"`
	IdentityDrift       bool             `json:"identityDrift"`
	IdentityDriftReason string           `json:"identityDriftReason,omitempty"`
}

type ReviewerProjectCapability

type ReviewerProjectCapability struct {
	ProjectID            string   `json:"projectId"`
	IncludeDrafts        bool     `json:"includeDrafts"`
	RequireReviewRequest *bool    `json:"requireReviewRequest,omitempty"`
	EnableSelfReview     bool     `json:"enableSelfReview"`
	Labels               []string `json:"labels,omitempty"`
	LabelMode            string   `json:"labelMode,omitempty"`
}

type StatusResponse

type StatusResponse struct {
	NetworkID   string           `json:"networkId"`
	Lease       CoordinatorLease `json:"lease"`
	Memberships []Membership     `json:"memberships"`
	Webhook     WebhookHealth    `json:"webhook"`
	Warnings    []string         `json:"warnings,omitempty"`
}

type WebhookHealth

type WebhookHealth struct {
	DeliveriesReceived int        `json:"deliveriesReceived"`
	LastDeliveryAt     *time.Time `json:"lastDeliveryAt,omitempty"`
	LastDeliveryID     string     `json:"lastDeliveryId,omitempty"`
	LastEvent          string     `json:"lastEvent,omitempty"`
	LastRepo           string     `json:"lastRepo,omitempty"`
	EventSubscribers   int        `json:"eventSubscribers"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL