Documentation
¶
Index ¶
- Constants
- func NewLeadershipServiceFn(leadershipMgr leadership.LeadershipManager) ...
- type GetSettingsFn
- type IsLeaderFn
- type LeadershipService
- type LeadershipSettingsAccessor
- func (lsa *LeadershipSettingsAccessor) Merge(bulkArgs params.MergeLeadershipSettingsBulkParams) (params.ErrorResults, error)
- func (lsa *LeadershipSettingsAccessor) Read(bulkArgs params.Entities) (params.GetLeadershipSettingsBulkResults, error)
- func (lsa *LeadershipSettingsAccessor) WatchLeadershipSettings(arg params.Entities) (params.NotifyWatchResults, error)
- type MergeSettingsChunkFn
- type RegisterWatcherFn
Constants ¶
const ( // FacadeName is the string-representation of this API used both // to register the service, and for the client to resolve the // service endpoint. FacadeName = "LeadershipService" // MinLeaseRequest is the shortest duration for which we will accept // a leadership claim. MinLeaseRequest = 5 * time.Second // MaxLeaseRequest is the longest duration for which we will accept // a leadership claim. MaxLeaseRequest = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func NewLeadershipServiceFn ¶
func NewLeadershipServiceFn( leadershipMgr leadership.LeadershipManager, ) func(*state.State, *common.Resources, common.Authorizer) (LeadershipService, error)
NewLeadershipServiceFn returns a function which can construct a LeadershipService when passed a state, resources, and authorizer. This function signature conforms to Juju's required API server signature.
Types ¶
type GetSettingsFn ¶
GetSettingsFn declares a function-type which will return leadership settings for the given service ID.
type IsLeaderFn ¶
IsLeaderFn declares a function-type which will return whether the given service-unit-id combination is currently the leader.
type LeadershipService ¶
type LeadershipService interface { // ClaimLeadership makes a leadership claim with the given parameters. ClaimLeadership(params params.ClaimLeadershipBulkParams) (params.ClaimLeadershipBulkResults, error) // ReleaseLeadership makes a call to release leadership for all the // parameters passed in. ReleaseLeadership(params params.ReleaseLeadershipBulkParams) (params.ReleaseLeadershipBulkResults, error) // BlockUntilLeadershipReleased blocks the caller until leadership is // released for the given service. BlockUntilLeadershipReleased(serviceTag names.ServiceTag) (params.ErrorResult, error) }
func NewLeadershipService ¶
func NewLeadershipService( state *state.State, resources *common.Resources, authorizer common.Authorizer, leadershipMgr leadership.LeadershipManager, ) (LeadershipService, error)
NewLeadershipService constructs a new LeadershipService.
type LeadershipSettingsAccessor ¶
type LeadershipSettingsAccessor struct {
// contains filtered or unexported fields
}
LeadershipSettingsAccessor provides a type which can read, write, and watch leadership settings.
func NewLeadershipSettingsAccessor ¶
func NewLeadershipSettingsAccessor( authorizer common.Authorizer, registerWatcherFn RegisterWatcherFn, getSettingsFn GetSettingsFn, mergeSettingsChunkFn MergeSettingsChunkFn, isLeaderFn IsLeaderFn, ) *LeadershipSettingsAccessor
NewLeadershipSettingsAccessor creates a new LeadershipSettingsAccessor.
func (*LeadershipSettingsAccessor) Merge ¶
func (lsa *LeadershipSettingsAccessor) Merge(bulkArgs params.MergeLeadershipSettingsBulkParams) (params.ErrorResults, error)
Merge merges in the provided leadership settings. Only leaders for the given service may perform this operation.
func (*LeadershipSettingsAccessor) Read ¶
func (lsa *LeadershipSettingsAccessor) Read(bulkArgs params.Entities) (params.GetLeadershipSettingsBulkResults, error)
Read reads leadership settings for the provided service ID. Any unit of the service may perform this operation.
func (*LeadershipSettingsAccessor) WatchLeadershipSettings ¶
func (lsa *LeadershipSettingsAccessor) WatchLeadershipSettings(arg params.Entities) (params.NotifyWatchResults, error)
WatchLeadershipSettings will block the caller until leadership settings for the given service ID change.
type MergeSettingsChunkFn ¶
MergeSettingsChunk declares a function-type which will write the provided settings chunk into the greater leadership settings for the provided service ID.
type RegisterWatcherFn ¶
SettingsChangeNotifierFn declares a function-type which will return a channel that can be blocked on to be notified of setting changes for the provided document key.