Documentation ¶
Index ¶
- Constants
- Variables
- type ConsensusService
- type ConsensusServiceProvider
- type ConsensusServiceStatus
- type MySQLBackend
- func (backend *MySQLBackend) AttemptLeadership() error
- func (backend *MySQLBackend) ForceLeadership() error
- func (backend *MySQLBackend) GetHealthyDomainServices() (services []string, err error)
- func (backend *MySQLBackend) GetLeader() string
- func (backend *MySQLBackend) GetSharedDomainServices() (services map[string]string, err error)
- func (backend *MySQLBackend) GetStateDescription() string
- func (backend *MySQLBackend) GetStatus() *ConsensusServiceStatus
- func (backend *MySQLBackend) IsHealthy() bool
- func (backend *MySQLBackend) IsLeader() bool
- func (backend *MySQLBackend) Monitor()
- func (backend *MySQLBackend) ReadLeadership() (leaderState int64, leader string, err error)
- func (backend *MySQLBackend) RecentAppsMap() (result map[string](*base.RecentApp))
- func (backend *MySQLBackend) RecoverHost(hostName string) error
- func (backend *MySQLBackend) Reelect() error
- func (backend *MySQLBackend) RegisterHealth() error
- func (backend *MySQLBackend) SkipHost(hostName string, ttlMinutes int64, expireAt time.Time) error
- func (backend *MySQLBackend) SkippedHostsMap() map[string]time.Time
- func (backend *MySQLBackend) ThrottleApp(appName string, ttlMinutes int64, expireAt time.Time, ratio float64) error
- func (backend *MySQLBackend) ThrottledAppsMap() (result map[string](*base.AppThrottle))
- func (backend *MySQLBackend) UnthrottleApp(appName string) error
- type Store
- func (store *Store) GetLeader() string
- func (store *Store) GetSharedDomainServices() (services map[string]string, err error)
- func (store *Store) GetState() raft.RaftState
- func (store *Store) GetStateDescription() string
- func (store *Store) GetStatus() *ConsensusServiceStatus
- func (store *Store) IsHealthy() bool
- func (store *Store) IsLeader() bool
- func (store *Store) Join(addr string) error
- func (store *Store) Monitor()
- func (store *Store) Open(peerNodes []string) error
- func (store *Store) RecentAppsMap() (result map[string](*base.RecentApp))
- func (store *Store) RecoverHost(hostName string) error
- func (store *Store) SkipHost(hostName string, ttlMinutes int64, expireAt time.Time) error
- func (store *Store) SkippedHostsMap() map[string]time.Time
- func (store *Store) ThrottleApp(appName string, ttlMinutes int64, expireAt time.Time, ratio float64) error
- func (store *Store) ThrottledAppsMap() (result map[string](*base.AppThrottle))
- func (store *Store) UnthrottleApp(appName string) error
Constants ¶
const RaftDBFile = "freno-raft.db"
Variables ¶
var ForceLeadership = false
Functions ¶
This section is empty.
Types ¶
type ConsensusService ¶
type ConsensusService interface { ThrottleApp(appName string, ttlMinutes int64, expireAt time.Time, ratio float64) error ThrottledAppsMap() (result map[string](*base.AppThrottle)) UnthrottleApp(appName string) error RecentAppsMap() (result map[string](*base.RecentApp)) SkipHost(hostName string, ttlMinutes int64, expireAt time.Time) error RecoverHost(hostName string) error SkippedHostsMap() (result map[string]time.Time) IsHealthy() bool IsLeader() bool GetLeader() string GetStateDescription() string GetStatus() *ConsensusServiceStatus Monitor() }
ConsensusService is a freno-oriented interface for making requests that require consensus.
type ConsensusServiceProvider ¶
type ConsensusServiceProvider struct {
// contains filtered or unexported fields
}
func NewConsensusServiceProvider ¶
func NewConsensusServiceProvider(throttler *throttle.Throttler) (p *ConsensusServiceProvider, err error)
func (*ConsensusServiceProvider) GetConsensusService ¶
func (p *ConsensusServiceProvider) GetConsensusService() ConsensusService
func (*ConsensusServiceProvider) Monitor ¶
func (p *ConsensusServiceProvider) Monitor()
type ConsensusServiceStatus ¶
type MySQLBackend ¶
type MySQLBackend struct {
// contains filtered or unexported fields
}
func NewMySQLBackend ¶
func NewMySQLBackend(throttler *throttle.Throttler) (*MySQLBackend, error)
func (*MySQLBackend) AttemptLeadership ¶
func (backend *MySQLBackend) AttemptLeadership() error
func (*MySQLBackend) ForceLeadership ¶
func (backend *MySQLBackend) ForceLeadership() error
func (*MySQLBackend) GetHealthyDomainServices ¶
func (backend *MySQLBackend) GetHealthyDomainServices() (services []string, err error)
GetHealthyDomainServices returns list of services healthy within same domain as this service, including this service
func (*MySQLBackend) GetLeader ¶
func (backend *MySQLBackend) GetLeader() string
func (*MySQLBackend) GetSharedDomainServices ¶
func (backend *MySQLBackend) GetSharedDomainServices() (services map[string]string, err error)
GetSharedDomainServices returns active leader services that have same ShareDomain as this service: - assuming ShareDomain is not empty - excluding this very service
func (*MySQLBackend) GetStateDescription ¶
func (backend *MySQLBackend) GetStateDescription() string
func (*MySQLBackend) GetStatus ¶
func (backend *MySQLBackend) GetStatus() *ConsensusServiceStatus
func (*MySQLBackend) IsHealthy ¶
func (backend *MySQLBackend) IsHealthy() bool
func (*MySQLBackend) IsLeader ¶
func (backend *MySQLBackend) IsLeader() bool
func (*MySQLBackend) Monitor ¶
func (backend *MySQLBackend) Monitor()
func (*MySQLBackend) ReadLeadership ¶
func (backend *MySQLBackend) ReadLeadership() (leaderState int64, leader string, err error)
func (*MySQLBackend) RecentAppsMap ¶
func (backend *MySQLBackend) RecentAppsMap() (result map[string](*base.RecentApp))
func (*MySQLBackend) RecoverHost ¶ added in v1.3.0
func (backend *MySQLBackend) RecoverHost(hostName string) error
func (*MySQLBackend) Reelect ¶
func (backend *MySQLBackend) Reelect() error
func (*MySQLBackend) RegisterHealth ¶
func (backend *MySQLBackend) RegisterHealth() error
func (*MySQLBackend) SkippedHostsMap ¶ added in v1.3.0
func (backend *MySQLBackend) SkippedHostsMap() map[string]time.Time
func (*MySQLBackend) ThrottleApp ¶
func (*MySQLBackend) ThrottledAppsMap ¶
func (backend *MySQLBackend) ThrottledAppsMap() (result map[string](*base.AppThrottle))
func (*MySQLBackend) UnthrottleApp ¶
func (backend *MySQLBackend) UnthrottleApp(appName string) error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
The store is a raft store that is freno-aware. It operates on a `throttler` instance on given events/commands. Store implements consensusService, which is a freno-oriented interface for running operations via consensus.
func (*Store) GetSharedDomainServices ¶
func (*Store) GetStateDescription ¶
GetState returns current raft state
func (*Store) GetStatus ¶
func (store *Store) GetStatus() *ConsensusServiceStatus
func (*Store) Join ¶
Join joins a node, located at addr, to this store. The node must be ready to respond to Raft communications at that address.
func (*Store) Monitor ¶
func (store *Store) Monitor()
Monitor is a utility function to routinely observe leadership state. It doesn't actually do much; merely takes notes.
func (*Store) Open ¶
Open opens the store. If enableSingle is set, and there are no existing peers, then this node becomes the first node, and therefore leader, of the cluster.
func (*Store) RecentAppsMap ¶
func (*Store) RecoverHost ¶ added in v1.3.0
func (*Store) SkippedHostsMap ¶ added in v1.3.0
func (*Store) ThrottleApp ¶
func (store *Store) ThrottleApp(appName string, ttlMinutes int64, expireAt time.Time, ratio float64) error
ThrottleApp, as implied by consensusService, is a raft oepration request which will ask for consensus.
func (*Store) ThrottledAppsMap ¶
func (store *Store) ThrottledAppsMap() (result map[string](*base.AppThrottle))
func (*Store) UnthrottleApp ¶
UnthrottleApp, as implied by consensusService, is a raft oepration request which will ask for consensus.