Documentation
¶
Overview ¶
Package state safely maintains the global registry consumed by ACC's CoreDNS plugin. It deliberately has no CoreDNS dependency: the JSON schema is the contract between the host-side ACC process and the plugin container.
Index ¶
- func DefaultPath() (string, error)
- type Container
- type NetworkAttachment
- type State
- type Store
- func (s *Store) Ensure(ctx context.Context) error
- func (s *Store) Read(ctx context.Context) (State, error)
- func (s *Store) Remove(ctx context.Context, ids []string) error
- func (s *Store) Update(ctx context.Context, mutate func(*State) error) (State, error)
- func (s *Store) Upsert(ctx context.Context, container Container) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath returns ACC's default host-global CoreDNS state path.
Types ¶
type Container ¶
type Container struct {
ID string `json:"id"`
Service string `json:"service"`
Nameservers []string `json:"nameservers,omitempty"`
Networks map[string]NetworkAttachment `json:"networks"`
}
Container is one service endpoint in the global registry.
type NetworkAttachment ¶
type NetworkAttachment struct {
Addresses []string `json:"addresses"`
Aliases []string `json:"aliases,omitempty"`
}
NetworkAttachment holds one container's addresses and Compose aliases on a runtime network.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store atomically edits a single state file. Its lock file serializes read-modify-write cycles across independent ACC processes.
func (*Store) Remove ¶
Remove deletes records with the supplied container IDs. Empty IDs are rejected to prevent an accidental broad mutation.