federationclient

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const TokenHeader = "X-AFI-Federation-Token"

Variables

This section is empty.

Functions

func PullOnce

func PullOnce(ctx context.Context, c *Client, repo federation.Repository, target federation.ApplyTarget, regionSlug string) (*federation.RegionExport, error)

PullOnce joins (best-effort), loads cursor, exports, and applies.

func RunPullLoop

func RunPullLoop(ctx context.Context, c *Client, repo federation.Repository, target federation.ApplyTarget, regionSlug string, interval time.Duration, onErr func(error))

RunPullLoop polls the hub until ctx is cancelled.

Types

type Client

type Client struct {
	BaseURL    string
	JoinToken  string
	HTTPClient *http.Client
}

Client pulls region exports from a home control plane.

func New

func New(baseURL, joinToken string) *Client

func (*Client) Export

func (c *Client) Export(ctx context.Context, regionSlug string, since int64) (*federation.RegionExport, error)

Export pulls a region export document (optionally since a revision).

func (*Client) Join

Join exchanges the join token for peer identity on the hub.

func (*Client) UsageReports

func (c *Client) UsageReports(ctx context.Context, orgID string, since, until *time.Time, limit int) (*UsageReportsResponse, error)

UsageReports pulls usage events from a regional control plane (hub on-demand).

type UsageReportsResponse

type UsageReportsResponse struct {
	Reports []usage.Record `json:"reports"`
}

UsageReportsResponse is returned by regional usage report pull.

Jump to

Keyboard shortcuts

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