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) Reelect() error
- func (backend *MySQLBackend) RegisterHealth() error
- 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) 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))
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 ¶ added in v1.0.4
type ConsensusServiceProvider struct {
// contains filtered or unexported fields
}
func NewConsensusServiceProvider ¶ added in v1.0.4
func NewConsensusServiceProvider(throttler *throttle.Throttler) (p *ConsensusServiceProvider, err error)
func (*ConsensusServiceProvider) GetConsensusService ¶ added in v1.0.4
func (p *ConsensusServiceProvider) GetConsensusService() ConsensusService
func (*ConsensusServiceProvider) Monitor ¶ added in v1.0.4
func (p *ConsensusServiceProvider) Monitor()
type ConsensusServiceStatus ¶ added in v1.0.4
type MySQLBackend ¶ added in v1.0.4
type MySQLBackend struct {
// contains filtered or unexported fields
}
func NewMySQLBackend ¶ added in v1.0.4
func NewMySQLBackend(throttler *throttle.Throttler) (*MySQLBackend, error)
func (*MySQLBackend) AttemptLeadership ¶ added in v1.0.4
func (backend *MySQLBackend) AttemptLeadership() error
func (*MySQLBackend) ForceLeadership ¶ added in v1.0.4
func (backend *MySQLBackend) ForceLeadership() error
func (*MySQLBackend) GetHealthyDomainServices ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (backend *MySQLBackend) GetLeader() string
func (*MySQLBackend) GetSharedDomainServices ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (backend *MySQLBackend) GetStateDescription() string
func (*MySQLBackend) GetStatus ¶ added in v1.0.4
func (backend *MySQLBackend) GetStatus() *ConsensusServiceStatus
func (*MySQLBackend) IsHealthy ¶ added in v1.0.4
func (backend *MySQLBackend) IsHealthy() bool
func (*MySQLBackend) IsLeader ¶ added in v1.0.4
func (backend *MySQLBackend) IsLeader() bool
func (*MySQLBackend) Monitor ¶ added in v1.0.4
func (backend *MySQLBackend) Monitor()
func (*MySQLBackend) ReadLeadership ¶ added in v1.0.4
func (backend *MySQLBackend) ReadLeadership() (leaderState int64, leader string, err error)
func (*MySQLBackend) RecentAppsMap ¶ added in v1.0.4
func (backend *MySQLBackend) RecentAppsMap() (result map[string](*base.RecentApp))
func (*MySQLBackend) Reelect ¶ added in v1.0.4
func (backend *MySQLBackend) Reelect() error
func (*MySQLBackend) RegisterHealth ¶ added in v1.0.4
func (backend *MySQLBackend) RegisterHealth() error
func (*MySQLBackend) ThrottleApp ¶ added in v1.0.4
func (*MySQLBackend) ThrottledAppsMap ¶ added in v1.0.4
func (backend *MySQLBackend) ThrottledAppsMap() (result map[string](*base.AppThrottle))
func (*MySQLBackend) UnthrottleApp ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (*Store) GetStateDescription ¶ added in v1.0.4
GetState returns current raft state
func (*Store) GetStatus ¶ added in v1.0.4
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 ¶ added in v1.0.4
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) 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.