Ejemplo n.º 1
0
func (self *iterateState) iterateFunction(state *operations.IterateState) (end bool) {

	numberOfKeyElements := len(state.Key)
	clientId := client.Id(state.Key[numberOfKeyElements-2])
	subscriptionId := operations.SubscriptionId(state.Key[numberOfKeyElements-1])

	ns := new(operations.NotificationSubscribe)
	ns.ClientId = clientId
	ns.Id = subscriptionId

	// Get configuration from value
	returnConfiguration := new(operations.SubscribeReturnConfig)
	deserializeConfig(state.Value[0], returnConfiguration)

	valuePtr := self.opPut.Value
	hashesVar := self.opPut.Hashes

	returnconfig.ProcessSubscribeEntry(returnConfiguration,
		self.opPut.Key, valuePtr,
		hashesVar, ns)
	ns.DroppingIsAllowed = returnConfiguration.DroppingAllowed

	self.notificationReceiver(ns)
	return false
}
Ejemplo n.º 2
0
func generateConnectionIdCandidate(clientType ClientType) (clientId client.Id,
	err error) {

	buffer := make([]byte, connectionManagerClientIdLen+1)
	_, err = rand.Read(buffer[1:])
	if err != nil {
		return
	}
	buffer[0] = uint8(clientType)
	clientId = client.Id(buffer)
	return
}