Documentation ¶
Index ¶
- Constants
- func BitmaskToFilterPendingsCommands(bitmask FilterBitmask) []pb.GetPendingCommandsRequest_Command
- func ConvertToSubjects(owner string, filterDeviceIDs kitStrings.Set, filterResourceIDs kitStrings.Set, ...) []string
- func IsFilteredBit(filteredEventTypes FilterBitmask, bit FilterBitmask) bool
- type ErrFunc
- type FilterBitmask
- func EventFilterToBitmask(f pb.SubscribeToEvents_CreateSubscription_Event) FilterBitmask
- func EventsFilterToBitmask(commandFilter []pb.SubscribeToEvents_CreateSubscription_Event) FilterBitmask
- func FilterPendingCommandToBitmask(f pb.GetPendingCommandsRequest_Command) FilterBitmask
- func FilterPendingsCommandsToBitmask(commandFilter []pb.GetPendingCommandsRequest_Command) FilterBitmask
- type SendEventFunc
- type SendEventWithTypeFunc
- type Sub
- type SubscriptionsCache
Constants ¶
View Source
const ( FilterBitmaskRegistrations = FilterBitmaskDeviceRegistered | FilterBitmaskDeviceUnregistered FilterBitmaskDevices = FilterBitmaskDeviceMetadata | FilterBitmaskDeviceResourceLinks | FilterBitmaskDeviceDeviceResourcesResource FilterBitmaskDeviceMetadata = FilterBitmaskDeviceMetadataUpdatePending | FilterBitmaskDeviceMetadataUpdated FilterBitmaskDeviceResourceLinks = FilterBitmaskResourcesPublished | FilterBitmaskResourcesUnpublished FilterBitmaskDeviceDeviceResourcesResource = FilterBitmaskResourceChanged | FilterBitmaskResourceCreatePending | FilterBitmaskResourceCreated | FilterBitmaskResourceDeletePending | FilterBitmaskResourceDeleted | FilterBitmaskResourceRetrievePending | FilterBitmaskResourceRetrieved | FilterBitmaskResourceUpdatePending | FilterBitmaskResourceUpdated )
Variables ¶
This section is empty.
Functions ¶
func BitmaskToFilterPendingsCommands ¶
func BitmaskToFilterPendingsCommands(bitmask FilterBitmask) []pb.GetPendingCommandsRequest_Command
func ConvertToSubjects ¶
func ConvertToSubjects(owner string, filterDeviceIDs kitStrings.Set, filterResourceIDs kitStrings.Set, bitmask FilterBitmask) []string
func IsFilteredBit ¶
func IsFilteredBit(filteredEventTypes FilterBitmask, bit FilterBitmask) bool
Types ¶
type FilterBitmask ¶
type FilterBitmask uint64
const ( FilterBitmaskResourceCreatePending FilterBitmask = 1 FilterBitmaskResourceCreated FilterBitmask = 1 << 1 FilterBitmaskResourceRetrievePending FilterBitmask = 1 << 2 FilterBitmaskResourceRetrieved FilterBitmask = 1 << 3 FilterBitmaskResourceUpdatePending FilterBitmask = 1 << 4 FilterBitmaskResourceUpdated FilterBitmask = 1 << 5 FilterBitmaskResourceDeletePending FilterBitmask = 1 << 6 FilterBitmaskResourceDeleted FilterBitmask = 1 << 7 FilterBitmaskDeviceMetadataUpdatePending FilterBitmask = 1 << 8 FilterBitmaskDeviceMetadataUpdated FilterBitmask = 1 << 9 FilterBitmaskDeviceRegistered FilterBitmask = 1 << 10 FilterBitmaskDeviceUnregistered FilterBitmask = 1 << 11 FilterBitmaskResourceChanged FilterBitmask = 1 << 12 FilterBitmaskResourcesPublished FilterBitmask = 1 << 13 FilterBitmaskResourcesUnpublished FilterBitmask = 1 << 14 FilterBitmaskMax FilterBitmask = 0xffffffff )
func EventFilterToBitmask ¶
func EventFilterToBitmask(f pb.SubscribeToEvents_CreateSubscription_Event) FilterBitmask
func EventsFilterToBitmask ¶
func EventsFilterToBitmask(commandFilter []pb.SubscribeToEvents_CreateSubscription_Event) FilterBitmask
func FilterPendingCommandToBitmask ¶
func FilterPendingCommandToBitmask(f pb.GetPendingCommandsRequest_Command) FilterBitmask
func FilterPendingsCommandsToBitmask ¶
func FilterPendingsCommandsToBitmask(commandFilter []pb.GetPendingCommandsRequest_Command) FilterBitmask
type SendEventFunc ¶
type SendEventWithTypeFunc ¶
type SendEventWithTypeFunc = func(e *pb.Event, typeBit FilterBitmask) error
type Sub ¶
type Sub struct {
// contains filtered or unexported fields
}
func New ¶
func New(send SendEventFunc, correlationID string, req *pb.SubscribeToEvents_CreateSubscription) *Sub
func (*Sub) CorrelationId ¶
func (*Sub) ProcessEvent ¶
func (s *Sub) ProcessEvent(e *pb.Event, eventType FilterBitmask) error
type SubscriptionsCache ¶
type SubscriptionsCache struct {
// contains filtered or unexported fields
}
func NewSubscriptionsCache ¶
func NewSubscriptionsCache(conn *nats.Conn, errFunc ErrFunc) *SubscriptionsCache
func (*SubscriptionsCache) Subscribe ¶
func (c *SubscriptionsCache) Subscribe(subject string, onEvent SendEventWithTypeFunc) (close func(), err error)
Subscribe register onEvents handler and creates a NATS subscription, if it does not exist. To free subscription call the returned close function.
Click to show internal directories.
Click to hide internal directories.