Documentation
¶
Index ¶
- func HashToken(token string) string
- func ValidCapability(value Capability) bool
- type AggregatedResponse
- type Capability
- type Client
- func (c *Client) Do(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)
- func (c *Client) Forward(ctx context.Context, method, path string, body io.Reader) ([]byte, int, map[string]string, error)
- func (c *Client) Get(ctx context.Context, path string) ([]byte, int, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) Post(ctx context.Context, path string, body []byte) ([]byte, int, error)
- type DB
- func (db *DB) Close() error
- func (db *DB) ConsumeInvite(tokenHash string, peerName string) error
- func (db *DB) CreateInvite(invite *Invite) (int64, error)
- func (db *DB) CreatePeer(peer *Peer) (int64, error)
- func (db *DB) DeletePeer(name string) error
- func (db *DB) GetInviteByHash(tokenHash string) (*Invite, error)
- func (db *DB) GetPeer(name string) (*Peer, error)
- func (db *DB) GetPeerPolicy(name string) (*PeerPolicy, error)
- func (db *DB) ListPeers() ([]Peer, error)
- func (db *DB) SetPeerPolicy(policy PeerPolicy) error
- func (db *DB) UpdateLastSeen(name string) error
- type EventPublisher
- type Grant
- type Invite
- type Manager
- func (m *Manager) AddPeer(name, url, apiKey string) error
- func (m *Manager) DB() *DB
- func (m *Manager) ForEachPeer(ctx context.Context, ...) map[string]Result
- func (m *Manager) GetPeer(name string) (*Client, error)
- func (m *Manager) ListPeers() []PeerStatus
- func (m *Manager) RemovePeer(name string) error
- func (m *Manager) ServerName() string
- func (m *Manager) SetEventPublisher(publisher EventPublisher)
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Stop()
- type Peer
- type PeerPolicy
- type PeerStatus
- type Result
- type ServerResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidCapability ¶
func ValidCapability(value Capability) bool
Types ¶
type AggregatedResponse ¶
type AggregatedResponse struct {
Servers map[string]ServerResult `json:"servers"`
}
func AggregateFromPeers ¶
type Capability ¶
type Capability string
const ( CapabilityFleetRead Capability = "fleet.read" CapabilityDeploymentsRead Capability = "deployments.read" CapabilityDeploymentsRun Capability = "deployments.run" CapabilityCapacityRead Capability = "capacity.read" CapabilityCapacityOffer Capability = "capacity.offer" CapabilityEventsPublish Capability = "events.publish" CapabilityRoutingManage Capability = "routing.manage" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) DeletePeer ¶
func (*DB) GetPeerPolicy ¶
func (db *DB) GetPeerPolicy(name string) (*PeerPolicy, error)
func (*DB) SetPeerPolicy ¶
func (db *DB) SetPeerPolicy(policy PeerPolicy) error
func (*DB) UpdateLastSeen ¶
type EventPublisher ¶
type EventPublisher interface {
Publish(events.Event) (events.IngestResult, error)
}
type Grant ¶
type Grant struct {
Capability Capability `json:"capability"`
Deployments []string `json:"deployments,omitempty"`
MaxCPU float64 `json:"max_cpu,omitempty"`
MaxMemory uint64 `json:"max_memory,omitempty"`
MaxReplicas int `json:"max_replicas,omitempty"`
}
func DefaultPeerGrants ¶
func DefaultPeerGrants() []Grant
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) ForEachPeer ¶
func (*Manager) ListPeers ¶
func (m *Manager) ListPeers() []PeerStatus
func (*Manager) RemovePeer ¶
func (*Manager) ServerName ¶
func (*Manager) SetEventPublisher ¶
func (m *Manager) SetEventPublisher(publisher EventPublisher)
type PeerPolicy ¶
type PeerStatus ¶
type ServerResult ¶
type ServerResult struct {
Name string `json:"name"`
Online bool `json:"online"`
Data json.RawMessage `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.