Documentation
¶
Overview ¶
Package service provides the service methods for the relation domain.
Index ¶
- type Service
- func (s *Service) AddRelation(ctx context.Context, eps []relation.Endpoint) error
- func (s *Service) AllRelations(ctx context.Context) ([]corerelation.UUID, error)
- func (s *Service) ApplicationRelationEndpointNames(ctx context.Context, id application.ID) ([]string, error)
- func (s *Service) ApplicationRelations(ctx context.Context, id application.ID) ([]corerelation.UUID, error)
- func (s *Service) ApplicationRelationsInfo(ctx context.Context, applicationID application.ID) ([]relation.EndpointRelationData, error)
- func (s *Service) EnterScope(ctx context.Context, relationID corerelation.UnitUUID) error
- func (s *Service) GetRelatedEndpoints(ctx context.Context, relationUUID corerelation.UUID, applicationName string) ([]internalrelation.Endpoint, error)
- func (s *Service) GetRelationApplicationSettings(ctx context.Context, relationUUID corerelation.UUID, ...) (map[string]string, error)
- func (s *Service) GetRelationEndpoint(ctx context.Context, relationUUID corerelation.UUID, ...) (internalrelation.Endpoint, error)
- func (s *Service) GetRelationEndpoints(ctx context.Context, id application.ID) ([]internalrelation.Endpoint, error)
- func (s *Service) GetRelationID(ctx context.Context, relationUUID corerelation.UUID) int
- func (s *Service) GetRelationStatus(ctx context.Context, relationID corerelation.UUID) (corestatus.StatusInfo, error)
- func (s *Service) GetRelationString(ctx context.Context, relationUUID corerelation.UUID) string
- func (s *Service) GetRelationTag(ctx context.Context, relationUUID corerelation.UUID) names.Tag
- func (s *Service) GetRelationUnit(ctx context.Context, relationUUID corerelation.UUID, unitName string) (corerelation.UnitUUID, error)
- func (s *Service) GetRelationUnitSettings(ctx context.Context, relationUnitUUID corerelation.UnitUUID) (map[string]string, error)
- func (s *Service) IsRelationSuspended(ctx context.Context, relationUUID corerelation.UUID) bool
- func (s *Service) LeaveScope(ctx context.Context, relationID corerelation.UnitUUID) error
- func (s Service) ReestablishRelation(ctx context.Context, relationUUID corerelation.UUID) error
- func (s *Service) RelationSuspendedReason(ctx context.Context, relationUUID corerelation.UUID) string
- func (s *Service) RelationUnitEndpointName(ctx context.Context, relationUnitUUID corerelation.UnitUUID) (string, error)
- func (s *Service) RelationUnitInScope(ctx context.Context, relationUnitUUID corerelation.UnitUUID) (bool, error)
- func (s *Service) RelationUnitValid(ctx context.Context, relationUnitUUID corerelation.UnitUUID) (bool, error)
- func (s *Service) SetRelationApplicationSettings(ctx context.Context, relationUUID corerelation.UUID, ...) error
- func (s *Service) SetRelationStatus(ctx context.Context, relationID int, info corestatus.StatusInfo) error
- func (s *Service) SetRelationSuspended(ctx context.Context, relationUUID corerelation.UUID, reason string) error
- func (s *Service) SetRelationUnitSettings(ctx context.Context, relationUnitUUID corerelation.UnitUUID, ...) error
- type State
- type WatchableService
- func (s *WatchableService) WatchApplicationSettings(ctx context.Context, relationUUID corerelation.UUID, ...) (watcher.NotifyWatcher, error)
- func (s *WatchableService) WatchLifeSuspendedStatus(ctx context.Context, relationUUID corerelation.UUID) (watcher.StringsWatcher, error)
- func (s *WatchableService) WatchUnitRelations(ctx context.Context, relationUnit corerelation.UnitUUID) (relation.RelationUnitsWatcher, error)
- func (s *WatchableService) WatchUnitScopes(ctx context.Context, relationUnit corerelation.UnitUUID) (relation.RelationScopeWatcher, error)
- type WatcherFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides the API for working with relations.
func NewService ¶
NewService returns a new service reference wrapping the input state.
func (*Service) AddRelation ¶
AddRelation adds a relation between the two provided endpoints.
func (*Service) AllRelations ¶
AllRelations Note: AllRelations replaces client.AllRelations for status. This needs to be investigated further.
func (*Service) ApplicationRelationEndpointNames ¶
func (s *Service) ApplicationRelationEndpointNames(ctx context.Context, id application.ID) ([]string, error)
ApplicationRelationEndpointNames returns a slice of names of the given application's relation endpoints. Note: Replaces the functionality in CharmRelations method of the application facade.
func (*Service) ApplicationRelations ¶
func (s *Service) ApplicationRelations(ctx context.Context, id application.ID) ( []corerelation.UUID, error)
ApplicationRelations returns relation UUIDs for the given application ID.
func (*Service) ApplicationRelationsInfo ¶
func (s *Service) ApplicationRelationsInfo( ctx context.Context, applicationID application.ID, ) ([]relation.EndpointRelationData, error)
ApplicationRelationsInfo returns all EndpointRelationData for an application. Note: Replaces the functionality of the relationData method in the application facade. Used for UnitInfo call.
func (*Service) EnterScope ¶
EnterScope updates the given relation to indicate it is in scope.
func (*Service) GetRelatedEndpoints ¶
func (s *Service) GetRelatedEndpoints( ctx context.Context, relationUUID corerelation.UUID, applicationName string, ) ([]internalrelation.Endpoint, error)
GetRelatedEndpoints returns the endpoints of the relation with which units of the named application will establish relations.
func (*Service) GetRelationApplicationSettings ¶
func (s *Service) GetRelationApplicationSettings( ctx context.Context, relationUUID corerelation.UUID, applicationID application.ID, ) (map[string]string, error)
GetRelationApplicationSettings returns the application settings for the given application and relation identifier combination.
func (*Service) GetRelationEndpoint ¶
func (s *Service) GetRelationEndpoint( ctx context.Context, relationUUID corerelation.UUID, applicationID application.ID, ) (internalrelation.Endpoint, error)
GetRelationEndpoint returns the endpoint for the given application and relation identifier combination.
func (*Service) GetRelationEndpoints ¶
func (s *Service) GetRelationEndpoints(ctx context.Context, id application.ID) ([]internalrelation.Endpoint, error)
GetRelationEndpoints returns all endpoints for the given application identifier.
func (*Service) GetRelationID ¶
GetRelationID returns the relation ID for the given relation UUID.
func (*Service) GetRelationStatus ¶
func (s *Service) GetRelationStatus( ctx context.Context, relationID corerelation.UUID, ) (corestatus.StatusInfo, error)
GetRelationStatus returns the status of the given relation.
func (*Service) GetRelationString ¶
RelationString returns a key identifier for the given relation UUID. The key describes the relation defined by endpoints in sorted order. Note: See the state.relationKey() function.
func (*Service) GetRelationTag ¶
func (s *Service) GetRelationTag(ctx context.Context, relationUUID corerelation.UUID) names.Tag
RelationTag returns the tag for the given relation UUID.
func (*Service) GetRelationUnit ¶
func (s *Service) GetRelationUnit( ctx context.Context, relationUUID corerelation.UUID, unitName string, ) (corerelation.UnitUUID, error)
GetRelationUnit returns the relation unit UUID for the given unit for the given relation.
func (*Service) GetRelationUnitSettings ¶
func (s *Service) GetRelationUnitSettings( ctx context.Context, relationUnitUUID corerelation.UnitUUID, ) (map[string]string, error)
GetRelationApplicationSettings returns the application settings for the given unit and relation identifier combination.
func (*Service) IsRelationSuspended ¶
IsRelationSuspended returns a boolean to indicate if the given relation UUID is suspended.
func (*Service) LeaveScope ¶
LeaveScope updates the given relation to indicate it is not in scope.
func (Service) ReestablishRelation ¶
ReestablishRelation brings the given relation back to normal after suspension, any reason given for the suspension is cleared.
func (*Service) RelationSuspendedReason ¶
func (s *Service) RelationSuspendedReason(ctx context.Context, relationUUID corerelation.UUID) string
RelationSuspendedReason returns the reason a relation was suspended if provided by the user.
func (*Service) RelationUnitEndpointName ¶
func (s *Service) RelationUnitEndpointName( ctx context.Context, relationUnitUUID corerelation.UnitUUID, ) (string, error)
RelationUnitEndpointName returns the name of the endpoint for the given relation unit. Note: replaces calls to relUnit.Endpoint().Name in the uniter facade.
func (*Service) RelationUnitInScope ¶
func (s *Service) RelationUnitInScope(ctx context.Context, relationUnitUUID corerelation.UnitUUID) (bool, error)
RelationUnitInScope returns a boolean to indicate whether the given relation unit is in scope.
func (*Service) RelationUnitValid ¶
func (s *Service) RelationUnitValid(ctx context.Context, relationUnitUUID corerelation.UnitUUID) (bool, error)
RelationUnitInScope returns a boolean to indicate whether the given relation unit is in scope.
func (*Service) SetRelationApplicationSettings ¶
func (s *Service) SetRelationApplicationSettings( ctx context.Context, relationUUID corerelation.UUID, applicationID application.ID, settings map[string]string, ) error
func (*Service) SetRelationStatus ¶
func (s *Service) SetRelationStatus( ctx context.Context, relationID int, info corestatus.StatusInfo, ) error
SetRelationStatus sets the status of the relation to the status provided.
func (*Service) SetRelationSuspended ¶
func (s *Service) SetRelationSuspended( ctx context.Context, relationUUID corerelation.UUID, reason string, ) error
SetRelationSuspended marks the given relation as suspended. Providing a reason is optional.
func (*Service) SetRelationUnitSettings ¶
type State ¶
type State interface{}
State describes retrieval and persistence methods for relations.
type WatchableService ¶
type WatchableService struct { *Service // contains filtered or unexported fields }
WatchableService provides the API for working with applications and the ability to create watchers.
func NewWatchableService ¶
func NewWatchableService( st State, watcherFactory WatcherFactory, logger logger.Logger, ) *WatchableService
NewWatchableService returns a new watchable service reference wrapping the input state.
func (*WatchableService) WatchApplicationSettings ¶
func (s *WatchableService) WatchApplicationSettings( ctx context.Context, relationUUID corerelation.UUID, applicationID application.ID, ) (watcher.NotifyWatcher, error)
WatchApplicationSettings returns a notify watcher that will signal whenever the specified application's relation settings are changed.
func (*WatchableService) WatchLifeSuspendedStatus ¶
func (s *WatchableService) WatchLifeSuspendedStatus( ctx context.Context, relationUUID corerelation.UUID, ) (watcher.StringsWatcher, error)
WatchLifeSuspendedStatus returns a watcher that notifies of changes to the life or suspended status of the relation.
func (*WatchableService) WatchUnitRelations ¶
func (s *WatchableService) WatchUnitRelations( ctx context.Context, relationUnit corerelation.UnitUUID, ) (relation.RelationUnitsWatcher, error)
WatchUnitRelations returns a watcher that notifies of changes to counterpart units in the relation.
func (*WatchableService) WatchUnitScopes ¶
func (s *WatchableService) WatchUnitScopes( ctx context.Context, relationUnit corerelation.UnitUUID, ) (relation.RelationScopeWatcher, error)
WatchUnitScopes returns a watcher which notifies of counterpart units entering and leaving the unit's scope.
type WatcherFactory ¶
type WatcherFactory interface { }
WatcherFactory instances return watchers for a given namespace and UUID.