Documentation
¶
Overview ¶
Package replication provides the push-based replication manager for the registry server and directory-sync support types. The Manager maintains a set of standby subscriber connections and broadcasts snapshots/deltas to all of them. Directory-sync types and helpers used by the server-side handler are also defined here.
Index ¶
- func BoolField(m map[string]interface{}, key string) bool
- func CloneSliceString(s []string) []string
- func CloneSliceUint16(s []uint16) []uint16
- func CloneSliceUint32(s []uint32) []uint32
- func NormalizeExternalID(id string) string
- func StrField(m map[string]interface{}, key string) string
- type DirectoryEntry
- type DirectorySyncRequest
- type DirectorySyncResult
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneSliceString ¶
CloneSliceString returns a defensive copy. nil-in → nil-out.
func CloneSliceUint16 ¶
CloneSliceUint16 returns a defensive copy. nil-in → nil-out.
func CloneSliceUint32 ¶
CloneSliceUint32 returns a defensive copy. nil-in → nil-out.
func NormalizeExternalID ¶
NormalizeExternalID normalizes to lowercase so lookups are case-insensitive.
Types ¶
type DirectoryEntry ¶
type DirectoryEntry struct {
ExternalID string `json:"external_id"` // unique ID from directory (OIDC sub, email, GUID)
DisplayName string `json:"display_name,omitempty"`
Email string `json:"email,omitempty"`
Groups []string `json:"groups,omitempty"` // directory groups
Role string `json:"role,omitempty"` // desired pilot role: "owner", "admin", "member"
Disabled bool `json:"disabled,omitempty"` // deprovisioned users
}
DirectoryEntry represents a user from an enterprise directory (AD, Entra ID, LDAP).
func ParseDirectoryEntries ¶
func ParseDirectoryEntries(raw []interface{}) []DirectoryEntry
ParseDirectoryEntries parses the raw interface{} slice produced by json.Unmarshal into map[string]interface{} — entries missing external_id are dropped.
type DirectorySyncRequest ¶
type DirectorySyncRequest struct {
NetworkID uint16 `json:"network_id"`
Entries []DirectoryEntry `json:"entries"`
// If true, nodes whose external_id is not in the entries list will be kicked.
RemoveUnlisted bool `json:"remove_unlisted,omitempty"`
}
DirectorySyncRequest is the protocol payload for directory sync.
type DirectorySyncResult ¶
type DirectorySyncResult struct {
Updated int `json:"updated"` // roles updated
Disabled int `json:"disabled"` // nodes disabled (kicked)
Mapped int `json:"mapped"` // entries mapped to existing nodes
Unmapped int `json:"unmapped"` // entries with no matching node
Actions []string `json:"actions"`
}
DirectorySyncResult describes what the sync operation did.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles push-based replication from primary to standbys. Standbys connect to the primary and subscribe; the primary pushes snapshots after every state mutation.
func NewManager ¶
func NewManager() *Manager
NewManager creates a Manager ready to accept subscribers.
func (*Manager) Push ¶
Push sends a full snapshot to all subscribers. Failed subscribers are removed. Each write is serialized per-connection via connWriter.wmu.
func (*Manager) PushDelta ¶
func (m *Manager) PushDelta(entries []walpkg.DeltaEntry, seqNo uint64)
PushDelta sends delta entries to all subscribers. This is much smaller than a full snapshot. Standbys that fall behind the delta window will be sent a full snapshot on the next Push().
func (*Manager) StartHeartbeat ¶
func (m *Manager) StartHeartbeat(done <-chan struct{})
StartHeartbeat sends periodic heartbeat messages to all replication subscribers so standbys can detect primary failure within ~30s. It blocks until done is closed.