Exemplo n.º 1
0
func (s *server) configListener(ch chan struct{}) {
	for range ch {
		configReader, err := s.persister.ReadPersistedConfig()

		if err != nil {
			logging.Println("error reading persisted config", err)
			continue
		}

		newConfig, err := config.Unmarshal(configReader)

		if err != nil {
			logging.Println("error reading marshalled config", err)
			continue
		}

		s.createBucketContainer(newConfig)
	}
}
Exemplo n.º 2
0
func (s *server) HistoricalConfigs() ([]*pb.ServiceConfig, error) {
	configs, err := s.persister.ReadHistoricalConfigs()

	if err != nil {
		return nil, err
	}

	unmarshalledConfigs := make(SortedConfigs, len(configs))

	for i, newConfig := range configs {
		unmarshalledConfig, err := config.Unmarshal(newConfig)

		if err != nil {
			return nil, err
		}

		unmarshalledConfigs[i] = unmarshalledConfig
	}

	sort.Sort(unmarshalledConfigs)

	return unmarshalledConfigs, nil
}