Ejemplo n.º 1
0
func (adapter *ETCDStoreAdapter) MaintainNode(storeNode storeadapter.StoreNode) (<-chan bool, chan (chan bool), error) {
	if storeNode.TTL == 0 {
		return nil, nil, storeadapter.ErrorInvalidTTL
	}

	if len(storeNode.Value) == 0 {
		guid, err := uuid.NewV4()
		if err != nil {
			return nil, nil, err
		}

		storeNode.Value = []byte(guid.String())
	}

	releaseNode := make(chan chan bool)
	nodeStatus := make(chan bool)

	go adapter.maintainNode(storeNode, nodeStatus, releaseNode)

	return nodeStatus, releaseNode, nil
}
Ejemplo n.º 2
0
						})
					})
				})
			}
		}

		Context("LegacyFinder", func() {
			BeforeEach(func() {
				finder = dopplerservice.NewLegacyFinder(storeAdapter, 1234, preferredCallback, updateCallback, loggertesthelper.Logger())
				node = storeadapter.StoreNode{
					Key:   dopplerservice.LEGACY_ROOT + "/z1/loggregator_z1/0",
					Value: []byte("10.0.0.1"),
				}

				updateNode = node
				updateNode.Value = []byte("10.0.0.2")
			})

			Context("Basics", testFinder(map[string]string{"/z1/loggregator_z1/0": "udp://10.0.0.1:1234"}))
			Context("Update", testUpdateFinder(map[string]string{"/z1/loggregator_z1/0": "udp://10.0.0.2:1234"}))
		})

		Context("Finder", func() {
			var preferredProtocol string

			BeforeEach(func() {
				preferredProtocol = "udp"
			})

			JustBeforeEach(func() {
				var err error