sync

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, c *gh.Client, plan util.Plan) error

func BuildPlan

func BuildPlan(ctx context.Context, c *gh.Client, cfg *config.Root) (util.Plan, error)

Types

type Handler added in v0.2.4

type Handler interface {
	Apply(ctx context.Context, c *gh.Client, ch util.Change) error
}

Handler applies a single planned change against GitHub.

Implementations should be idempotent where possible; the planner already filters out no-op changes, but partial failures mid-apply are possible.

type HandlerFunc added in v0.2.4

type HandlerFunc func(ctx context.Context, c *gh.Client, ch util.Change) error

HandlerFunc adapts an ordinary function to the Handler interface.

func (HandlerFunc) Apply added in v0.2.4

func (f HandlerFunc) Apply(ctx context.Context, c *gh.Client, ch util.Change) error

Apply implements Handler.

type HandlerRegistry added in v0.2.4

type HandlerRegistry struct {
	// contains filtered or unexported fields
}

HandlerRegistry resolves change kinds (scope:action) to handlers and orders them.

func NewHandlerRegistry added in v0.2.4

func NewHandlerRegistry() *HandlerRegistry

NewHandlerRegistry returns an empty registry.

func (*HandlerRegistry) Lookup added in v0.2.4

func (r *HandlerRegistry) Lookup(scope, action string) (Handler, bool)

Lookup returns the Handler registered for scope:action, if any.

func (*HandlerRegistry) Precedence added in v0.2.4

func (r *HandlerRegistry) Precedence(scope, action string) int

Precedence returns the ordering weight for scope:action. Unregistered keys sort last so unknown change kinds don't silently jump the queue.

func (*HandlerRegistry) Register added in v0.2.4

func (r *HandlerRegistry) Register(scope, action string, precedence int, h Handler)

Register binds a Handler to scope:action with the given precedence. Lower precedence runs first. Duplicate registrations panic so misconfigured registries fail fast at startup rather than during an apply.

type State

type State struct {
	Org          string
	ManagedRepos map[string]bool

	// Cached API results to avoid duplicate calls
	ActualTeams []*github.Team
	ActualRepos []*github.Repository

	// Current state from GitHub
	CurrentTeams       int
	CurrentTeamMembers int
	CurrentRepos       int
	CurrentRepoPerms   int
	CurrentCustomRoles int

	// Desired state from config
	DesiredTeams       int
	DesiredTeamMembers int
	DesiredRepos       int
	DesiredRepoPerms   int
	DesiredCustomRoles int
}

Jump to

Keyboard shortcuts

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