Example #1
0
func (self *Converter) ReadSubscriptionId(input interface{}) operations.SubscriptionId {
	if input == nil {
		panic("Expecting a subscription id but value is missing")
	}
	switch input := input.(type) {
	case string:
		return operations.SubscriptionId(string(self.ReadBase32(input)))
	case []byte:
		return operations.SubscriptionId(string(self.ReadBinary(input)))
	default:
		panic(fmt.Sprintf("Expecting a string or a binary but got a %T", input))
	}
}
Example #2
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
}
Example #3
0
func createSubscriptionIdCandidate() (id operations.SubscriptionId, err error) {
	subidbytes := make([]byte, subscriptionIdNumBytes)
	_, err = rand.Read(subidbytes)
	if err != nil {
		return nil, err
	}
	return operations.SubscriptionId(subidbytes), err
}