Documentation ¶
Index ¶
- type DistributedMgmtService
- func (dms *DistributedMgmtService) AddSpeakersToZone(zoneID string, speakerIDs []string) error
- func (dms *DistributedMgmtService) ChangeZoneName(zoneID string, newName string) error
- func (dms *DistributedMgmtService) CreateZone(displayName string, speakerIDs []string) (string, error)
- func (dms *DistributedMgmtService) DeleteZone(zoneID string) error
- func (dms *DistributedMgmtService) GetIsMutedForSpeaker(speakerID string) (bool, error)
- func (dms *DistributedMgmtService) GetSpeakers() []*service.Speaker
- func (dms *DistributedMgmtService) GetTrackForSpeaker(speakerID string) (*service.Track, error)
- func (dms *DistributedMgmtService) GetTrackForZone(zoneID string) (*service.Track, error)
- func (dms *DistributedMgmtService) GetZones() []*service.Zone
- func (dms *DistributedMgmtService) HandleMusicNodeJoin(node *memberlist.Node)
- func (dms *DistributedMgmtService) HandleMusicNodeLeave(node *memberlist.Node)
- func (dms *DistributedMgmtService) RemoveSpeakersFromZone(zoneID string, speakerIDs []string) error
- func (dms *DistributedMgmtService) SetDisplayName(ID string, displayName string, updateBroadcast bool) error
- func (dms *DistributedMgmtService) SetMuteForSpeaker(speakerID string, isMuted bool) error
- type DistributedStore
- func (ds *DistributedStore) AmLeader() bool
- func (ds *DistributedStore) Apply(l *raft.Log) interface{}
- func (ds *DistributedStore) DeleteZoneConfig(zoneID string) error
- func (ds *DistributedStore) GetLeader() string
- func (ds *DistributedStore) GetSpeakerConfig(ID string) (SpeakerConfig, error)
- func (ds *DistributedStore) GetZoneConfigs() []ZoneConfig
- func (ds *DistributedStore) Join(nodeID string, nodeAddress string) error
- func (ds *DistributedStore) Open(bootstrap bool) error
- func (ds *DistributedStore) Restore(rc io.ReadCloser) error
- func (ds *DistributedStore) SaveSpeakerConfig(config SpeakerConfig) error
- func (ds *DistributedStore) SaveZoneConfig(config ZoneConfig) error
- func (ds *DistributedStore) Snapshot() (raft.FSMSnapshot, error)
- type SpeakerConfig
- type ZoneConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributedMgmtService ¶
type DistributedMgmtService struct {
// contains filtered or unexported fields
}
DistributedMgmtService implements MgmtService with a distributed backing store
func NewDistributedMgmtService ¶
func NewDistributedMgmtService(nodes *memberlist.Memberlist, store *DistributedStore) *DistributedMgmtService
NewDistributedMgmtService instantiates the DistributedMgmtService
func (*DistributedMgmtService) AddSpeakersToZone ¶
func (dms *DistributedMgmtService) AddSpeakersToZone(zoneID string, speakerIDs []string) error
AddSpeakersToZone updates a zone with the given speakers
func (*DistributedMgmtService) ChangeZoneName ¶
func (dms *DistributedMgmtService) ChangeZoneName(zoneID string, newName string) error
ChangeZoneName changes the name of the zone
func (*DistributedMgmtService) CreateZone ¶
func (dms *DistributedMgmtService) CreateZone(displayName string, speakerIDs []string) (string, error)
CreateZone will create a new zone with 0 to more speakers
func (*DistributedMgmtService) DeleteZone ¶
func (dms *DistributedMgmtService) DeleteZone(zoneID string) error
DeleteZone will delete a zone
func (*DistributedMgmtService) GetIsMutedForSpeaker ¶
func (dms *DistributedMgmtService) GetIsMutedForSpeaker(speakerID string) (bool, error)
GetIsMutedForSpeaker returns if the given speaker is hard muted
func (*DistributedMgmtService) GetSpeakers ¶
func (dms *DistributedMgmtService) GetSpeakers() []*service.Speaker
GetSpeakers returns information about the speaker (bcg apps) under our management
func (*DistributedMgmtService) GetTrackForSpeaker ¶
func (dms *DistributedMgmtService) GetTrackForSpeaker(speakerID string) (*service.Track, error)
GetTrackForSpeaker returns the track that is playing for the given speaker
func (*DistributedMgmtService) GetTrackForZone ¶
func (dms *DistributedMgmtService) GetTrackForZone(zoneID string) (*service.Track, error)
GetTrackForZone returns the track that is playing on all speakers in the zone
func (*DistributedMgmtService) GetZones ¶
func (dms *DistributedMgmtService) GetZones() []*service.Zone
GetZones returns information about the zones under our management
func (*DistributedMgmtService) HandleMusicNodeJoin ¶
func (dms *DistributedMgmtService) HandleMusicNodeJoin(node *memberlist.Node)
HandleMusicNodeJoin will try to bring the music node back to the zone it belongs
func (*DistributedMgmtService) HandleMusicNodeLeave ¶
func (dms *DistributedMgmtService) HandleMusicNodeLeave(node *memberlist.Node)
HandleMusicNodeLeave will try to preserve any zone by promoting a new leader, if it is the leader who has left
func (*DistributedMgmtService) RemoveSpeakersFromZone ¶
func (dms *DistributedMgmtService) RemoveSpeakersFromZone(zoneID string, speakerIDs []string) error
RemoveSpeakersFromZone updates a zone with the given speakers
func (*DistributedMgmtService) SetDisplayName ¶
func (dms *DistributedMgmtService) SetDisplayName(ID string, displayName string, updateBroadcast bool) error
SetDisplayName will change the user visible name of the speaker
func (*DistributedMgmtService) SetMuteForSpeaker ¶
func (dms *DistributedMgmtService) SetMuteForSpeaker(speakerID string, isMuted bool) error
SetMuteForSpeaker will mute or unmute the given speaker
type DistributedStore ¶
type DistributedStore struct {
// contains filtered or unexported fields
}
DistributedStore is a raft backed store based on: https://github.com/otoolep/hraftd/blob/master/store/store.go
func NewDistributedStore ¶
func NewDistributedStore(localID string, raftPort int, raftDir string) *DistributedStore
NewDistributedStore initializes the store
func (*DistributedStore) AmLeader ¶
func (ds *DistributedStore) AmLeader() bool
AmLeader whether or not the store instance is the leader of the cluster
func (*DistributedStore) Apply ¶
func (ds *DistributedStore) Apply(l *raft.Log) interface{}
Apply applies a Raft log entry to the key-value store.
func (*DistributedStore) DeleteZoneConfig ¶
func (ds *DistributedStore) DeleteZoneConfig(zoneID string) error
DeleteZoneConfig delete a give zone config
func (*DistributedStore) GetLeader ¶
func (ds *DistributedStore) GetLeader() string
GetLeader returns the address of the leader
func (*DistributedStore) GetSpeakerConfig ¶
func (ds *DistributedStore) GetSpeakerConfig(ID string) (SpeakerConfig, error)
GetSpeakerConfig returns the speaker configuration for the given speaker
func (*DistributedStore) GetZoneConfigs ¶
func (ds *DistributedStore) GetZoneConfigs() []ZoneConfig
GetZoneConfigs retrieves all zones
func (*DistributedStore) Join ¶
func (ds *DistributedStore) Join(nodeID string, nodeAddress string) error
Join will join the specified node to participate in the raft cluster
func (*DistributedStore) Open ¶
func (ds *DistributedStore) Open(bootstrap bool) error
Open will open the database for usage
func (*DistributedStore) Restore ¶
func (ds *DistributedStore) Restore(rc io.ReadCloser) error
Restore stores the key-value store to a previous state.
func (*DistributedStore) SaveSpeakerConfig ¶
func (ds *DistributedStore) SaveSpeakerConfig(config SpeakerConfig) error
SaveSpeakerConfig saves the specified SpeakerConfig
func (*DistributedStore) SaveZoneConfig ¶
func (ds *DistributedStore) SaveZoneConfig(config ZoneConfig) error
SaveZoneConfig persists a zone
func (*DistributedStore) Snapshot ¶
func (ds *DistributedStore) Snapshot() (raft.FSMSnapshot, error)
Snapshot returns a snapshot of the key-value store.
type SpeakerConfig ¶
SpeakerConfig used to store persistent speaker configuration